chef / chef-server

Chef Infra Server is a hub for configuration data; storing cookbooks, node policies and metadata of managed nodes.
https://www.chef.io/chef/
Apache License 2.0
291 stars 210 forks source link

chef-server-ctl org-users-list <org-name> #1610

Open Stromweld opened 5 years ago

Stromweld commented 5 years ago

Describe the Enhancement:

chef-server-ctl commands to list users belonging to specific organization and to list admins of the organization. Commands like:

chef-server-ctl org-users-list chef-server-ctl org-admins-list

Describe the Need:

Anyone. This would also make fixing the idempotency of the chef-ingredient cookbook org resource user properties idempotent https://github.com/chef-cookbooks/chef-ingredient/blob/master/resources/chef_org.rb#L52

Current Alternative

Not to my knowledge

Can We Help You Implement This?:

Have to find how similar commands work and see if can replicate them at the org level

btm commented 2 years ago

The functionality here in chef-server-ctl for managing orgs/users used to come from knife-opc but that merged into core knife around Infra Client 17 which knife also made a break from being part of the Infra Client.

There was related functionality in knife-acl that made a similar move which gives us knife group list and knife user list commands (as well as more dangerous knife acl commands).

Since the related chef-server-ctl commands are already just a knife wrapper in https://github.com/chef/chef-server/blob/main/src/chef-server-ctl/plugins/wrap-knife-opc.rb, it would be relatively trivial to add a similar wrapper or refactor that wrapper a little to add chef-server-ctl org-users-list and chef-server-ctl org-admins-list.

As well as others for chef-server-ctl of high value like:

mapping is the trickiest part to avoid too terribly of a UX

knife group add user USERNAME admins

could become:

chef-server-ctl org-group-add-user ORG USERNAME admins
or
chef-server-ctl org-group-add ORG user USERNAME admins
btm commented 2 years ago

Note if we do something like this, as a followup we need to ensure similar coverage in Automate's wrappers around chef-server-ctl in https://github.com/chef/automate/blob/main/components/automate-cs-nginx/cmd/chef-server-ctl/ctl.go.