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

Change default of where stack is created #971

Merged
merged 2 commits into from
Feb 26, 2018
Merged

Change default of where stack is created #971

merged 2 commits into from
Feb 26, 2018

Conversation

justinvp
Copy link
Member

If currently logged in, stack init creates a managed stack. Otherwise, it creates a local stack. This avoids the need to specify --local when not using the service.

As today, --local can be passed, which will create a local stack regardless of being logged in or not.

A new flag, --remote, has been added, which can be passed to indicate a managed stack, used to force an error if not logged into the service.

Fixes #816

If currently logged in, `stack init` creates a managed stack. Otherwise, it creates a local
stack. This avoids the need to specify `--local` when not using the service.

As today, `--local` can be passed, which will create a local stack regardless of being logged
in or not.

A new flag, `--remote`, has been added, which can be passed to indicate a managed stack,
used to force an error if not logged into the service.
Copy link
Contributor

@ellismg ellismg left a comment

Choose a reason for hiding this comment

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

LGTM. Sorry for the delay, thought I reviewed this yesterday!

@justinvp
Copy link
Member Author

justinvp commented Feb 24, 2018

@ellismg, No problem.

I was about to merge this and looked over the changes again and I realized I made a mistake when factoring out the "is logged in" check to its own function. If we want to keep it factored this way, cloudURL needs to be passed as a pointer so its value can be changed to the default URL when empty, since cloudURL is then used subsequently when creating the cloud backend. Not sure how I missed this while I was manually testing the change earlier. The test suite didn't catch it as the cloud tests only run when PULUMI_API is set, which is then used to set --cloud-url explicitly (so cloudURL would never be empty). It'd be nice to add a regression test for this, but I don't think we want the tests using the default URL. In any case, I manually confirmed when logged-in pulumi stack init foo fails before the new commit and works as expected after the new commit.

Mind taking a quick look at the new commit?

@ellismg
Copy link
Contributor

ellismg commented Feb 26, 2018

It it possible to restructure the code such that we use cloud.ValueOrDefaultURL(string), instead (like maybe at the start of the function that handles the cobra commands)? I think that would let us remove the by reference stuff. If the code ends up looking worse adopting that, then we can go with this instead, just feels a little strange.

@justinvp
Copy link
Member Author

Sure, I'll change it to that.

Copy link
Contributor

@ellismg ellismg left a comment

Choose a reason for hiding this comment

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

LGTM

@justinvp justinvp merged commit ac58f15 into master Feb 26, 2018
@justinvp justinvp deleted the justin/stackinit branch February 26, 2018 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants