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

generate user + service box keys #380

Merged
merged 3 commits into from
Apr 14, 2016
Merged

generate user + service box keys #380

merged 3 commits into from
Apr 14, 2016

Conversation

bookshelfdave
Copy link
Contributor

This PR adds the following commands to generate keys:

hab origin key generate someorigin
    OR
export HAB_ORIGIN=someorigin
hab origin key generate
hab user key generate foo someorg
    OR
export HAB_ORG=someorg
hab user key generate foo
hab service key generate foo.bar someorg
    OR
export HAB_ORG=xyz
hab service key generate foo.bar
  • Clap verifies SERVICE_GROUP to be in the format .+\\..+
    • ie. "a string with a . in the middle"
  • NOTE: hab origin key generate looks to have been reverted to hab origin generate_key, so this PR fixes that.

this also reverts the generate origin key command back to:

    hab origin key generate <foo>
Ok(keyname)
}

// generate a service box key, return the name of the key we generated
Copy link
Collaborator

Choose a reason for hiding this comment

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

A double slash is for code comments and a triple slash is for documentation. Since this is a public function I'm assuming you wanted this to show up in the documentation so you would want to add one more slash. If you didn't want it to show up in the docs then this is how you do it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, fixed.

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@reset
Copy link
Collaborator

reset commented Apr 13, 2016

@metadave super clean

gif-keyboard-17029802905543702544

@bookshelfdave
Copy link
Contributor Author

TODO:

  • - user + service keys get an organization, not an origin!
  • hab user key generate dave neato
    • where USERID=dave ORGANIZATION=neato
  • ORGANIZATION has a default value of ENV[‘HABITAT_ORG’]
  • hab origin key generate core is ORIGIN, and has a default value of ENV[‘HABITAT_ORIGIN’]
  • hab service key generate redis.default neato is SERVICEGROUP ORGANIZATION where ORGANIZATION is ENV[‘HABITAT_ORG’]
  • hab service key generate redis.default
  • hab user key generate dave
  • Document: "habitat packages come from an origin and run in an organization

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@bookshelfdave
Copy link
Contributor Author

updated!

gif-keyboard-3132165516587860708

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@smith
Copy link
Contributor

smith commented Apr 14, 2016

I thought I remembered seeing we were using the HAB prefix for environment variables: HAB_ORIGIN instead of HABITAT_ORIGIN. Is this still the case (or was it ever?)

@bookshelfdave
Copy link
Contributor Author

I was trying to stay consistent starting from https://github.com/chef/bldr/blob/master/components/hab/src/main.rs#L41

we can change it to whatever, as long as we are consistent across the board.

@bookshelfdave
Copy link
Contributor Author

env vars renamed to HAB_ORIGIN and HAB_ORG

@chef-delivery
Copy link
Contributor

This PR has passed 'Verify' and is ready for review and approval!
Use: '@delivery approve' when code review is complete.

@bookshelfdave
Copy link
Contributor Author

@delivery approve

@chef-delivery chef-delivery merged commit 9dba4b0 into master Apr 14, 2016
@chef-delivery chef-delivery deleted the dp_gen_box_keys branch April 14, 2016 20:02
@chef-delivery
Copy link
Contributor

Change: 07c843fb-9336-462c-a336-a66616553363 approved by: @metadave

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.

4 participants