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

Create new minishift profile in case it was never created before #67

Merged

Conversation

psiroky
Copy link

@psiroky psiroky commented Aug 13, 2018

There are two similar cases, which both need to be covered:

  1. minishift status --profile <name> will return "Does not exist",
    in case someone already configured the profile with minishift profile set <name>(or in case it got deleted with minishift delete).

  2. minishift status --profile <name> will return error saying the
    profile doesn't exist at all (e.g. this is the first time it is being
    used and queried for). minishift start will then create that
    profile.

This change brings support for case 2), by checking the result code of
the minishift status call.

@psiroky psiroky force-pushed the fix-minishift-profile-create branch from 740c19a to 775e1dc Compare August 13, 2018 15:15
@psiroky
Copy link
Author

psiroky commented Aug 13, 2018

@arilivigni or @dirgim could you please take a quick look?

@@ -58,4 +58,4 @@

# Initialize minishift
- import_tasks: init_minishift.yml
when: minishift_exist.stdout != ""
when: (minishift_profile_status.stdout|lower == "does not exist") or minishift_profile_status.rc != 0
Copy link
Member

Choose a reason for hiding this comment

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

why parens around one and not the other if you are going to use them?

Copy link
Author

Choose a reason for hiding this comment

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

Let me fix that.

Copy link
Author

Choose a reason for hiding this comment

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

I kept those parens in as the conditional seems easier to read then (but I can also remove it if preferred).

There are two similar cases, which both need to be covered:

  1) `minishift status --profile <name>` will return "Does not exist",
     in case someone already configured the profile with `minishift
     profile set <name>`(or in case it got deleted with `minishift delete`).

  2) `minishift status --profile <name>` will return error saying the
     profile doesn't exist at all (e.g. this is the first time it is being
     used and queried for). `minishift start` will then create that profile.

This change brings support for case 2), by checking the result code of
the `minishift status` call.
@psiroky psiroky force-pushed the fix-minishift-profile-create branch from 775e1dc to f59a330 Compare August 13, 2018 15:19
Copy link
Collaborator

@dirgim dirgim left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@arilivigni arilivigni left a comment

Choose a reason for hiding this comment

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

Not really sure why this is needed. Do you have a failure to show where this happens that this is needed?

@psiroky
Copy link
Author

psiroky commented Aug 13, 2018

If you run minishift status --profile non-existent-profile,
it will return Profile 'non-existent' doesn't exist, Use 'minishift profile set non-existent' or 'minishift start --profile non-existent' to create.

That specific profile was never used, so minishift is not aware of that name.

One other alternative would be to call minishift profile set <name> explicitly before checkins the status of that profile.

@arilivigni
Copy link
Member

@psiroky gotcha your approach is fine then, just one nit on the or in parens that I made a comment on.

@psiroky
Copy link
Author

psiroky commented Aug 13, 2018

@arilivigni so I added the parens to the right side of the oras well. Let me know if you prefer to remove them.

Copy link
Member

@arilivigni arilivigni left a comment

Choose a reason for hiding this comment

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

LGTM

@arilivigni arilivigni merged commit ef0a1b8 into CentOS-PaaS-SIG:master Aug 13, 2018
@psiroky psiroky deleted the fix-minishift-profile-create branch August 13, 2018 15:45
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