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

Renamed 'juju charm resources' to 'juju charm-resources'. #7695

Merged
merged 2 commits into from
Aug 2, 2017

Conversation

anastasiamac
Copy link
Contributor

Description of change

'juju charm resources' was not compliant with Juju standard naming convention for commands.

This PR deprecates 'juju charm' and 'juju charm resources' commands for backward compatibility but adds a warning to their output.

The PR introduces a new top level command 'juju charm-resources'.

It was not possible to simply alias older commands as our aliases can only be one word.

QA steps

  1. 'juju charm' and 'juju charm resources' (and aliased 'juju charm list-resources') still work as before but now output a deprecated message as well.
  2. 'juju charm-resources' works as 'juju charm resources' did.

Documentation changes

All references to 'juju charm resources' need to be updated to 'juju charm-resources'.
Command list will still contain 'juju charm resources'.

Bug reference

https://bugs.launchpad.net/juju/+bug/1707564

Copy link

@mjs mjs left a comment

Choose a reason for hiding this comment

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

Thanks for sorting out this mess!

}

func (c *baseCharmResourcesCommand) baseRun(ctx *cmd.Context) error {
// TODO(ericsnow) Adjust this to the charm store.
Copy link

Choose a reason for hiding this comment

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

Do we know what this even means?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I do not claim to know :)
There are a few of puzzling to-dos in this area. I opted to leave them in case at some point in th future we'd come to realise what they mean... There must have been a really good reason to have these to-dos in first place, no?

Copy link

Choose a reason for hiding this comment

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

Eric had a tendency to leave lots of TODOs behind. It's not always obvious how important they were.

return client.ListResources(ids)
}

func resolveCharms(charms []string) ([]*charm.URL, error) {
Copy link

Choose a reason for hiding this comment

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

Not your doing I know but this is kinda silly given that there can only be exactly one charm. This could easily go and resolveCharm could be called directly instead. This would simplify baseRun as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agreed. I'll look into simplifying to just calling once.
Although the purpose of PR was not to simplify this area...

Purpose: "Display the resources for a charm in the charm store.",
Doc: `
Purpose: "DEPRECATED: Display the resources for a charm in the charm store.",
Doc: `This command is DEPRECATED from Juju 2.3.x
Copy link

Choose a reason for hiding this comment

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

Replace "from" with "since"?

It might be good if the help also directed people to the correct command.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Funny, originally I did write "since" but somehow it felt awkward. I'll change back... and will add a note to about new command.

// Info implements cmd.Command.
func (c *CharmResourcesCommand) Info() *cmd.Info {
i := c.baseInfo()
i.Name = "charm-resources"
Copy link

Choose a reason for hiding this comment

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

To follow the usual pattern, should there also be a "list-charm-resources" alias? (like for example juju models and juju list-models)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can certainly put in this alias. It felt like a mouthful to me though :D

Copy link

Choose a reason for hiding this comment

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

It is a bit long but at least it's clear and consistent.

Copy link

@mjs mjs left a comment

Choose a reason for hiding this comment

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

Thanks - looks great.

// Info implements cmd.Command.
func (c *CharmResourcesCommand) Info() *cmd.Info {
i := c.baseInfo()
i.Name = "charm-resources"
Copy link

Choose a reason for hiding this comment

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

It is a bit long but at least it's clear and consistent.

}

func (c *baseCharmResourcesCommand) baseRun(ctx *cmd.Context) error {
// TODO(ericsnow) Adjust this to the charm store.
Copy link

Choose a reason for hiding this comment

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

Eric had a tendency to leave lots of TODOs behind. It's not always obvious how important they were.

@anastasiamac
Copy link
Contributor Author

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Aug 2, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Aug 2, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/80

@anastasiamac
Copy link
Contributor Author

$$merge$$

That's a new one... let's try again :D

[xenial] ----------------------------------------------------------------------
[xenial] FAIL: server_test.go:143: DebugHooksServerSuite.TestRunHook
[xenial]
[xenial] server_test.go:176:
[xenial] // flock was released before we found the debug dir.
[xenial] c.Fatalf("could not find hook.sh\nerr: %v\noutput: %s", err, output.String())
[xenial] ... Error: could not find hook.sh
[xenial] err: signal: killed
[xenial] output:
[xenial]
[xenial] OOPS: 4 passed, 1 FAILED
[xenial] --- FAIL: TestPackage (0.03s)
[xenial] FAIL
[xenial] FAIL github.com/juju/juju/worker/uniter/runner/debug 0.667s

@jujubot
Copy link
Collaborator

jujubot commented Aug 2, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot
Copy link
Collaborator

jujubot commented Aug 2, 2017

Build failed: Tests failed
build url: http://juju-ci.vapour.ws:8080/job/github-merge-juju/82

@anastasiamac
Copy link
Contributor Author

$$merge$$
unrelated, intermittent known instance poller test failure

@jujubot
Copy link
Collaborator

jujubot commented Aug 2, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 9ce3e51 into juju:develop Aug 2, 2017
@anastasiamac anastasiamac deleted the rename-charm-resources branch August 2, 2017 08:33
@anastasiamac
Copy link
Contributor Author

@pmatulis,

This change may require documentation update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants