knife-opc 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 21e309366d62a87b653421397ba19dbc9d2c794bf15e6afd523c22b012c465cb
4
- data.tar.gz: 2e71da62849d8b082b194ada7ac061150ee79a0d9b07f9bf178fa72350e46718
3
+ metadata.gz: 873c3bbd2e19b0f9d16f0cf3f0e40c9d1a00835b7a95c5fb43b0545855ab8cc9
4
+ data.tar.gz: 6afadda7acf3cff454c379f7430d967423eaaf77a599bf9db3c92db3d6a25994
5
5
  SHA512:
6
- metadata.gz: 758d67e9f2dc3b87559729cddeb03a265a7803f1651fac7aacf6c63c62bb758f2aed2373861d5db2d87b52c9cfdfe389c7ee0a3b95a5e95869cba38896fc5c7e
7
- data.tar.gz: 60553dd5d5ed676f9b94582654b832860e59956597b707d37b066ba1fda78582910a00002e4e3b1977acdad5d028f280dfb84dd6d5d395c824294a932cc39456
6
+ metadata.gz: 78e053766a19dd42555c568a3a86d10f89662ed4a3beef4cd0dad6717959bf8de00ece54270d551faa4a80e7dd10a2e17876ff52f0cf5b9a57272d2425b4b35a
7
+ data.tar.gz: 1f6f0af328eb5d8f9e90c53effce7cfc68f7cbb7256282d51ceecfab564e5adb32c36510bb46d0407ff8c1b5d889500f0f7622f531dbe54e922ca9002ea115ad
@@ -18,18 +18,18 @@
18
18
 
19
19
  module Opc
20
20
  class OpcOrgCreate < Chef::Knife
21
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
21
+ category "CHEF ORGANIZATION MANAGEMENT"
22
22
  banner "knife opc org create ORG_SHORT_NAME ORG_FULL_NAME (options)"
23
23
 
24
24
  option :filename,
25
- :long => "--filename FILENAME",
26
- :short => "-f FILENAME",
27
- :description => "Write validator private key to FILENAME rather than STDOUT"
25
+ long: "--filename FILENAME",
26
+ short: "-f FILENAME",
27
+ description: "Write validator private key to FILENAME rather than STDOUT"
28
28
 
29
29
  option :association_user,
30
- :long => "--association_user USERNAME",
31
- :short => "-a USERNAME",
32
- :description => "Invite USERNAME to the new organization after creation"
30
+ long: "--association_user USERNAME",
31
+ short: "-a USERNAME",
32
+ description: "Invite USERNAME to the new organization after creation"
33
33
 
34
34
  attr_accessor :org_name, :org_full_name
35
35
 
@@ -19,7 +19,7 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcOrgDelete < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc org delete ORG_NAME"
24
24
 
25
25
  include Chef::Mixin::RootRestv0
@@ -19,7 +19,7 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcOrgEdit < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc org edit ORG"
24
24
 
25
25
  def run
@@ -19,18 +19,18 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcOrgList < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc org list"
24
24
 
25
25
  option :with_uri,
26
- :long => "--with-uri",
27
- :short => "-w",
28
- :description => "Show corresponding URIs"
26
+ long: "--with-uri",
27
+ short: "-w",
28
+ description: "Show corresponding URIs"
29
29
 
30
30
  option :all_orgs,
31
- :long => "--all-orgs",
32
- :short => "-a",
33
- :description => "Show auto-generated hidden orgs in output"
31
+ long: "--all-orgs",
32
+ short: "-a",
33
+ description: "Show auto-generated hidden orgs in output"
34
34
 
35
35
  include Chef::Mixin::RootRestv0
36
36
 
@@ -19,7 +19,7 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcOrgShow < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc org show ORGNAME"
24
24
 
25
25
  include Chef::Mixin::RootRestv0
@@ -18,14 +18,14 @@
18
18
 
19
19
  module Opc
20
20
  class OpcOrgUserAdd < Chef::Knife
21
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
21
+ category "CHEF ORGANIZATION MANAGEMENT"
22
22
  banner "knife opc org user add ORG_NAME USER_NAME"
23
23
  attr_accessor :org_name, :username
24
24
 
25
25
  option :admin,
26
- :long => "--admin",
27
- :short => "-a",
28
- :description => "Add user to admin group"
26
+ long: "--admin",
27
+ short: "-a",
28
+ description: "Add user to admin group"
29
29
 
30
30
  deps do
31
31
  require "chef/org"
@@ -18,14 +18,14 @@
18
18
 
19
19
  module Opc
20
20
  class OpcOrgUserRemove < Chef::Knife
21
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
21
+ category "CHEF ORGANIZATION MANAGEMENT"
22
22
  banner "knife opc org user remove ORG_NAME USER_NAME"
23
23
  attr_accessor :org_name, :username
24
24
 
25
25
  option :force_remove_from_admins,
26
- :long => "--force",
27
- :short => "-f",
28
- :description => "Force removal of user from the organization's admins and billing-admins group."
26
+ long: "--force",
27
+ short: "-f",
28
+ description: "Force removal of user from the organization's admins and billing-admins group."
29
29
 
30
30
  deps do
31
31
  require "chef/org"
@@ -47,10 +47,10 @@ module Opc
47
47
  if config[:force_remove_from_admins]
48
48
  if org.actor_delete_would_leave_admins_empty?
49
49
  failure_error_message(org_name, username)
50
- ui.msg <<-EOF
51
- You ran with --force which force removes the user from the admins and billing-admins groups.
52
- However, removing #{username} from the admins group would leave it empty, which breaks the org.
53
- Please add another user to org #{org_name} admins group and try again.
50
+ ui.msg <<~EOF
51
+ You ran with --force which force removes the user from the admins and billing-admins groups.
52
+ However, removing #{username} from the admins group would leave it empty, which breaks the org.
53
+ Please add another user to org #{org_name} admins group and try again.
54
54
  EOF
55
55
  exit 1
56
56
  end
@@ -66,11 +66,11 @@ EOF
66
66
  exit 1
67
67
  elsif e.response.code == "403"
68
68
  body = Chef::JSONCompat.from_json(e.response.body)
69
- if body.has_key?("error") && body["error"] == "Please remove #{username} from this organization's admins group before removing him or her from the organization."
69
+ if body.key?("error") && body["error"] == "Please remove #{username} from this organization's admins group before removing him or her from the organization."
70
70
  failure_error_message(org_name, username)
71
- ui.msg <<-EOF
72
- User #{username} is in the organization's admin group. Removing users from an organization without removing them from the admins group is not allowed.
73
- Re-run this command with --force to remove this user from the admins prior to removing it from the organization.
71
+ ui.msg <<~EOF
72
+ User #{username} is in the organization's admin group. Removing users from an organization without removing them from the admins group is not allowed.
73
+ Re-run this command with --force to remove this user from the admins prior to removing it from the organization.
74
74
  EOF
75
75
  exit 1
76
76
  else
@@ -90,9 +90,9 @@ EOF
90
90
  org.remove_user_from_group(admin_group_string, username)
91
91
  rescue Net::HTTPServerException => e
92
92
  if e.response.code == "404"
93
- ui.warn <<-EOF
94
- User #{username} is not in the #{admin_group_string} group for organization #{org_name}.
95
- You probably don't need to pass --force.
93
+ ui.warn <<~EOF
94
+ User #{username} is not in the #{admin_group_string} group for organization #{org_name}.
95
+ You probably don't need to pass --force.
96
96
  EOF
97
97
  else
98
98
  raise e
@@ -19,23 +19,23 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserCreate < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user create USERNAME FIRST_NAME [MIDDLE_NAME] LAST_NAME EMAIL PASSWORD"
24
24
 
25
25
  option :filename,
26
- :long => "--filename FILENAME",
27
- :short => "-f FILENAME",
28
- :description => "Write private key to FILENAME rather than STDOUT"
26
+ long: "--filename FILENAME",
27
+ short: "-f FILENAME",
28
+ description: "Write private key to FILENAME rather than STDOUT"
29
29
 
30
30
  option :orgname,
31
- :long => "--orgname ORGNAME",
32
- :short => "-o ORGNAME",
33
- :description => "Associate new user to an organization matching ORGNAME"
31
+ long: "--orgname ORGNAME",
32
+ short: "-o ORGNAME",
33
+ description: "Associate new user to an organization matching ORGNAME"
34
34
 
35
35
  option :passwordprompt,
36
- :long => "--prompt-for-password",
37
- :short => "-p",
38
- :description => "Prompt for user password"
36
+ long: "--prompt-for-password",
37
+ short: "-p",
38
+ description: "Prompt for user password"
39
39
 
40
40
  include Chef::Mixin::RootRestv0
41
41
 
@@ -60,19 +60,19 @@ module Opc
60
60
  middle_name ||= ""
61
61
 
62
62
  user_hash = {
63
- :username => username,
64
- :first_name => first_name,
65
- :middle_name => middle_name,
66
- :last_name => last_name,
67
- :display_name => "#{first_name} #{last_name}",
68
- :email => email,
69
- :password => password,
63
+ username: username,
64
+ first_name: first_name,
65
+ middle_name: middle_name,
66
+ last_name: last_name,
67
+ display_name: "#{first_name} #{last_name}",
68
+ email: email,
69
+ password: password,
70
70
  }
71
71
 
72
72
  # Check the file before creating the user so the api is more transactional.
73
73
  if config[:filename]
74
74
  file = config[:filename]
75
- unless File.exists?(file) ? File.writable?(file) : File.writable?(File.dirname(file))
75
+ unless File.exist?(file) ? File.writable?(file) : File.writable?(File.dirname(file))
76
76
  ui.fatal "File #{config[:filename]} is not writable. Check permissions."
77
77
  exit 1
78
78
  end
@@ -87,10 +87,10 @@ module Opc
87
87
  ui.msg result["private_key"]
88
88
  end
89
89
  if config[:orgname]
90
- request_body = { :user => username }
90
+ request_body = { user: username }
91
91
  response = root_rest.post("organizations/#{config[:orgname]}/association_requests", request_body)
92
92
  association_id = response["uri"].split("/").last
93
- root_rest.put("users/#{username}/association_requests/#{association_id}", { :response => "accept" })
93
+ root_rest.put("users/#{username}/association_requests/#{association_id}", { response: "accept" })
94
94
  end
95
95
  end
96
96
 
@@ -19,13 +19,13 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserDelete < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user delete USERNAME [-d] [-R]"
24
24
 
25
25
  option :no_disassociate_user,
26
- :long => "--no-disassociate-user",
27
- :short => "-d",
28
- :description => "Don't disassociate the user first"
26
+ long: "--no-disassociate-user",
27
+ short: "-d",
28
+ description: "Don't disassociate the user first"
29
29
 
30
30
  option :remove_from_admin_groups,
31
31
  long: "--remove-from-admin-groups",
@@ -112,10 +112,10 @@ module Opc
112
112
  def error_exit_admin_group_member!(username, admin_of)
113
113
  message = "#{username} is in the 'admins' group of the following organization(s):\n\n"
114
114
  admin_of.each { |org| message << "- #{org.name}\n" }
115
- message << <<EOM
115
+ message << <<~EOM
116
116
 
117
- Run this command again with the --remove-from-admin-groups option to
118
- remove the user from these admin group(s) automatically.
117
+ Run this command again with the --remove-from-admin-groups option to
118
+ remove the user from these admin group(s) automatically.
119
119
 
120
120
  EOM
121
121
  ui.fatal message
@@ -123,18 +123,18 @@ EOM
123
123
  end
124
124
 
125
125
  def error_exit_cant_remove_admin_membership!(username, only_admin_of)
126
- message = <<EOM
126
+ message = <<~EOM
127
127
 
128
- #{username} is the only member of the 'admins' group of the
129
- following organization(s):
128
+ #{username} is the only member of the 'admins' group of the
129
+ following organization(s):
130
130
 
131
131
  EOM
132
132
  only_admin_of.each { |org| message << "- #{org.name}\n" }
133
- message << <<EOM
133
+ message << <<~EOM
134
134
 
135
- Removing the only administrator of an organization can break it.
136
- Assign additional users or groups to the admin group(s) before
137
- deleting this user.
135
+ Removing the only administrator of an organization can break it.
136
+ Assign additional users or groups to the admin group(s) before
137
+ deleting this user.
138
138
 
139
139
  EOM
140
140
  ui.fatal message
@@ -19,18 +19,18 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserEdit < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user edit USERNAME"
24
24
 
25
25
  option :input,
26
- :long => "--input FILENAME",
27
- :short => "-i FILENAME",
28
- :description => "Name of file to use for PUT or POST"
26
+ long: "--input FILENAME",
27
+ short: "-i FILENAME",
28
+ description: "Name of file to use for PUT or POST"
29
29
 
30
30
  option :filename,
31
- :long => "--filename FILENAME",
32
- :short => "-f FILENAME",
33
- :description => "Write private key to FILENAME rather than STDOUT"
31
+ long: "--filename FILENAME",
32
+ short: "-f FILENAME",
33
+ description: "Write private key to FILENAME rather than STDOUT"
34
34
 
35
35
  include Chef::Mixin::RootRestv0
36
36
 
@@ -19,13 +19,13 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserList < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user list"
24
24
 
25
25
  option :with_uri,
26
- :long => "--with-uri",
27
- :short => "-w",
28
- :description => "Show corresponding URIs"
26
+ long: "--with-uri",
27
+ short: "-w",
28
+ description: "Show corresponding URIs"
29
29
 
30
30
  include Chef::Mixin::RootRestv0
31
31
 
@@ -19,13 +19,13 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserPassword < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user password USERNAME [PASSWORD | --enable-external-auth]"
24
24
 
25
25
  option :enable_external_auth,
26
- :long => "--enable-external-auth",
27
- :short => "-e",
28
- :description => "Enable external authentication for this user (such as LDAP)"
26
+ long: "--enable-external-auth",
27
+ short: "-e",
28
+ description: "Enable external authentication for this user (such as LDAP)"
29
29
 
30
30
  include Chef::Mixin::RootRestv0
31
31
 
@@ -19,12 +19,12 @@ require "chef/mixin/root_rest"
19
19
 
20
20
  module Opc
21
21
  class OpcUserShow < Chef::Knife
22
- category "OPSCODE PRIVATE CHEF ORGANIZATION MANAGEMENT"
22
+ category "CHEF ORGANIZATION MANAGEMENT"
23
23
  banner "knife opc user show USERNAME"
24
24
 
25
25
  option :with_orgs,
26
- :long => "--with-orgs",
27
- :short => "-l"
26
+ long: "--with-orgs",
27
+ short: "-l"
28
28
 
29
29
  include Chef::Mixin::RootRestv0
30
30
 
@@ -24,7 +24,7 @@ class Chef
24
24
  # Rather than upgrade all of this code to move to v1, the goal is to remove the
25
25
  # need for this plugin. See
26
26
  # https://github.com/chef/chef/issues/3517
27
- @root_rest ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { :api_version => "0" })
27
+ @root_rest ||= Chef::ServerAPI.new(Chef::Config[:chef_server_root], { api_version: "0" })
28
28
  end
29
29
  end
30
30
  end
@@ -24,22 +24,22 @@ class Chef
24
24
 
25
25
  def name(arg = nil)
26
26
  set_or_return(:name, arg,
27
- :regex => /^[a-z0-9\-_]+$/)
27
+ regex: /^[a-z0-9\-_]+$/)
28
28
  end
29
29
 
30
30
  def full_name(arg = nil)
31
31
  set_or_return(:full_name,
32
- arg, :kind_of => String)
32
+ arg, kind_of: String)
33
33
  end
34
34
 
35
35
  def private_key(arg = nil)
36
36
  set_or_return(:private_key,
37
- arg, :kind_of => String)
37
+ arg, kind_of: String)
38
38
  end
39
39
 
40
40
  def guid(arg = nil)
41
41
  set_or_return(:guid,
42
- arg, :kind_of => String)
42
+ arg, kind_of: String)
43
43
  end
44
44
 
45
45
  def to_hash
@@ -57,13 +57,13 @@ class Chef
57
57
  end
58
58
 
59
59
  def create
60
- payload = { :name => name, :full_name => full_name }
60
+ payload = { name: name, full_name: full_name }
61
61
  new_org = chef_rest.post_rest("organizations", payload)
62
62
  Chef::Org.from_hash(to_hash.merge(new_org))
63
63
  end
64
64
 
65
65
  def update
66
- payload = { :name => name, :full_name => full_name }
66
+ payload = { name: name, full_name: full_name }
67
67
  new_org = chef_rest.put_rest("organizations/#{name}", payload)
68
68
  Chef::Org.from_hash(to_hash.merge(new_org))
69
69
  end
@@ -83,10 +83,10 @@ class Chef
83
83
  end
84
84
 
85
85
  def associate_user(username)
86
- request_body = { :user => username }
86
+ request_body = { user: username }
87
87
  response = chef_rest.post_rest "organizations/#{@name}/association_requests", request_body
88
88
  association_id = response["uri"].split("/").last
89
- chef_rest.put_rest "users/#{username}/association_requests/#{association_id}", { :response => "accept" }
89
+ chef_rest.put_rest "users/#{username}/association_requests/#{association_id}", { response: "accept" }
90
90
  end
91
91
 
92
92
  def dissociate_user(username)
@@ -16,8 +16,8 @@ class Chef
16
16
  def add_user_to_group(groupname, username)
17
17
  group = group(groupname)
18
18
  body_hash = {
19
- :groupname => "#{groupname}",
20
- :actors => {
19
+ groupname: "#{groupname}",
20
+ actors: {
21
21
  "users" => group["actors"].concat([username]),
22
22
  "groups" => group["groups"],
23
23
  },
@@ -29,8 +29,8 @@ class Chef
29
29
  group = group(groupname)
30
30
  group["actors"].delete(username)
31
31
  body_hash = {
32
- :groupname => "#{groupname}",
33
- :actors => {
32
+ groupname: "#{groupname}",
33
+ actors: {
34
34
  "users" => group["actors"],
35
35
  "groups" => group["groups"],
36
36
  },
@@ -1,3 +1,3 @@
1
1
  module KnifeOPC
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1".freeze
3
3
  end
metadata CHANGED
@@ -1,25 +1,22 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-opc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Danna
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-06 00:00:00.000000000 Z
11
+ date: 2018-12-20 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Knife Tools for Chef Server
14
14
  email: steve@chef.io
15
15
  executables: []
16
16
  extensions: []
17
- extra_rdoc_files:
18
- - README.md
19
- - LICENSE
17
+ extra_rdoc_files: []
20
18
  files:
21
19
  - LICENSE
22
- - README.md
23
20
  - lib/chef/knife/opc_org_create.rb
24
21
  - lib/chef/knife/opc_org_delete.rb
25
22
  - lib/chef/knife/opc_org_edit.rb
data/README.md DELETED
@@ -1,147 +0,0 @@
1
- # knife OPC
2
-
3
- [![Gem Version](https://badge.fury.io/rb/knife-opc.svg)](https://rubygems.org/gems/knife-opc) [![Build Status](https://travis-ci.org/chef/knife-opc.svg?branch=master)](https://travis-ci.org/chef/knife-opc)
4
-
5
- This knife plugin supports basic organization and user operations in Enterprise Chef (formerly Opscode Private Chef) and Chef Server 12.
6
-
7
- - Documentation: <https://github.com/chef/knife-opc/blob/master/README.md>
8
- - Source: <http://github.com/chef/knife-opc/tree/master>
9
- - Issues: <https://github.com/chef/knife-opc/issues>
10
- - Slack: <http://community-slack.chef.io/>
11
- - Mailing list: <https://discourse.chef.io/>
12
-
13
- ## Installation
14
-
15
- Using [ChefDK](https://downloads.chef.io/chef-dk/), simply install the Gem:
16
-
17
- ```bash
18
- chef gem install knife-opc
19
- ```
20
-
21
- ## Configuration
22
-
23
- ### knife.rb
24
-
25
- Unlike other knife subcommands the subcommands in the knife-opc plugin make API calls against the root of your OPC installations API endpoint.
26
-
27
- Typically the chef_server_url for your OPC installation may look like this:
28
-
29
- ```
30
- chef_server_url https://chef.yourdomain.com/organizations/ORGNAME
31
- ```
32
-
33
- To configure knife-opc, set the `chef_server_root` option to the root of your OPC installation:
34
-
35
- ```
36
- chef_server_root https://chef.yourdomain.com/
37
- ```
38
-
39
- Note that most users in an OPC installation lack the permissions to run most of the commands from this plugin. On Chef Server 12, the majority of the commands provided by this plugin can be accessed via `chef-server-ctl` wrapper commands that properly configure knife-opc for administrative action. We recommend you use the wrapper commands whenever possible
40
-
41
- When using knife-opc directly, many of the commands require special permissions. For instance, in order to use commands such as `knife opc org create`, you must authenticate as the 'pivotal' user.
42
-
43
- Note that the key for the pivotal user is in /etc/opscode on any node in your Chef Server cluster. We recommend that you only use the pivotal user from a Chef Server itself and not copy this key off the machine. In that case, you should run knife opc on the **Frontend server** as root, with a `knife.rb` in root's home directory.
44
-
45
- ```ruby
46
- current_dir = File.dirname(__FILE__)
47
- log_level :info
48
- log_location STDOUT
49
- node_name "pivotal"
50
- client_key "/etc/opscode/pivotal.pem"
51
- chef_server_root "https://chef.yourdomain.com/"
52
- ```
53
-
54
- ## Knife Sub Commands
55
-
56
- ### knife opc user list (options)
57
-
58
- _Options_
59
-
60
- - `-w`, `--with-uri`: Show corresponding URIs
61
-
62
- Show a list of all users in your OPC installation.
63
-
64
- ### knife opc user show USERNAME (options)
65
-
66
- - `-l`, `--with-orgs`: Show the organizations of which the user is a member.
67
-
68
- Shows the details of a user in your OPC installation.
69
-
70
- ### knife opc user create USERNAME FIRST_NAME [MIDDLE_NAME] LAST_NAME EMAIL [PASSWORD] (options)
71
-
72
- - `-f FILENAME`, `--filename FILENAME`: Write private key to FILENAME rather than STDOUT.
73
- - `-p`, `--prompt-for-password`: Prompt for password rather than providing it on the command line.
74
-
75
- Creates a new user in your OPC installation. The user's private key will be returned in response. Without this key, the user will need to log into the WebUI and regenerate their key before they can use knife.
76
-
77
- ### knife opc user delete USERNAME [-d]
78
-
79
- Deletes the given OPC user.
80
-
81
- ### knife opc user edit USERNAME
82
-
83
- Will open $EDITOR. When finished, Knife will update the given OPC user.
84
-
85
- ### knife opc user password USERNAME [PASSWORD | --enable_external_auth]
86
-
87
- Command for managing password and authentication for a user.
88
-
89
- The last argument should either be a string you want the password to or you can pass --enable_external_auth instead of a password to enable external authentication for this user.
90
-
91
- ### knife opc org list
92
-
93
- - `-w`, `--with-uri`: Show corresponding URIs
94
- - `-a`, `--all-orgs`: Display hidden orgs
95
-
96
- Show a list of all organizations in your OPC installation.
97
-
98
- ### knife opc org show ORG_NAME
99
-
100
- Shows description of given ORG_NAME.
101
-
102
- ### knife opc org create ORG_NAME ORG_FULL_NAME
103
-
104
- - `-f FILENAME`, `--filename FILENAME`: Write private key to FILENAME rather than STDOUT.
105
- - `-a USERNAME`, `--association_user USERNAME`, Associate USERNAME with the organization after creation.
106
-
107
- Creates a new OPC Organization. The private key for the organization's validator client is returned.
108
-
109
- ### knife opc org delete ORG_NAME
110
-
111
- Deletes the given OPC organization.
112
-
113
- ### knife opc org user add ORGNAME USERNAME
114
-
115
- Adds a user to an organization. Requires that the named organization and user both exist.
116
-
117
- ### knife opc org user remove ORGNAME USERNAME
118
-
119
- Removes a user from an organization. Requires that the named organization and user both exist, and that the user is currently associated with the organization.
120
-
121
- ## KNOWN ISSUES
122
-
123
- - Attempting to delete and immediately recreate an organization will result in an error (a 500 or a 409 Conflict depending on the server version). This is because of a server-side cache that must be cleared. Restarting the frontend services before recreating the org is necessary to avoid the error.
124
-
125
- ## Contributing
126
-
127
- For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
128
-
129
- ## License
130
-
131
- Copyright:: Copyright (c) 2011-2016 Chef Software, Inc.
132
-
133
- License:: Apache License, Version 2.0
134
-
135
- ```text
136
- Licensed under the Apache License, Version 2.0 (the "License");
137
- you may not use this file except in compliance with the License.
138
- You may obtain a copy of the License at
139
-
140
- http://www.apache.org/licenses/LICENSE-2.0
141
-
142
- Unless required by applicable law or agreed to in writing, software
143
- distributed under the License is distributed on an "AS IS" BASIS,
144
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145
- See the License for the specific language governing permissions and
146
- limitations under the License.
147
- ```