Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: undefined service key during garden status #153

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/plugin-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,12 @@ export function createPluginContext(garden: Garden): PluginContext {
const services = await ctx.getServices()

const serviceStatus = await Bluebird.map(
services, (service: Service<any>) => ctx.getServiceStatus({ serviceName: service.name }),
services, (service: Service<any>) =>
ctx.getServiceStatus({ serviceName: service.name })
.then( svc => {
svc["name"] = service.name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This kinda goes around TypeScript (it ignores the ["name"] assignment, and then you have an unexpected property on the object), which works in this case but we generally try to avoid since it can come up in unexpected ways later.

I would suggest instead to change the output schema to have services as a list (although that would mean changing a bit more code) or to key by name before mapping over the services.

Copy link
Contributor Author

@Deepakkothandan Deepakkothandan Jun 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I will rework it, just getting myself familiar with the codebase and ts.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All good! Feel free to ping us if you need help with something or have questions, we're all happy to help.

return svc
}),
)

return {
Expand Down