knife-opc 0.4.1 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/chef/knife/opc_org_create.rb +8 -8
- data/lib/chef/knife/opc_org_delete.rb +1 -1
- data/lib/chef/knife/opc_org_edit.rb +1 -1
- data/lib/chef/knife/opc_org_list.rb +7 -7
- data/lib/chef/knife/opc_org_show.rb +1 -1
- data/lib/chef/knife/opc_org_user_add.rb +5 -5
- data/lib/chef/knife/opc_org_user_remove.rb +8 -8
- data/lib/chef/knife/opc_user_create.rb +10 -10
- data/lib/chef/knife/opc_user_delete.rb +6 -6
- data/lib/chef/knife/opc_user_edit.rb +8 -8
- data/lib/chef/knife/opc_user_list.rb +4 -4
- data/lib/chef/knife/opc_user_password.rb +6 -6
- data/lib/chef/knife/opc_user_show.rb +3 -3
- data/lib/chef/org.rb +5 -5
- data/lib/chef/org/group_operations.rb +1 -1
- data/lib/knife-opc/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f4cf5e1a92fee2ee1e35f580036e8af3e9279d347b6505a435939fc877ab474
|
4
|
+
data.tar.gz: 35066972be85972f7d2f92fd1d1cd9f8cb2ec671b773d22c34d10a4f61384e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 818b97758d14e242b40e7b887fbd2ad3388c7e40e647917d7e59b6562edb7e7ba35aa89606abd3007fa505177623985e26d54eb0239e52f358a49fbe3b7a323c
|
7
|
+
data.tar.gz: cd739ebf8b8b3134478274208e40d9c7889079ea474dbc62e1b7459b522d752105ddde0a609e1d159a78a4ed973afc41bc34dc24c321500a35d6dc709be13ca7
|
@@ -22,20 +22,20 @@ module Opc
|
|
22
22
|
banner "knife opc org create ORG_SHORT_NAME ORG_FULL_NAME (options)"
|
23
23
|
|
24
24
|
option :filename,
|
25
|
-
|
26
|
-
|
27
|
-
|
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
|
-
|
31
|
-
|
32
|
-
|
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
|
|
36
36
|
deps do
|
37
|
-
|
38
|
-
|
37
|
+
require_relative "../org"
|
38
|
+
require_relative "../org/group_operations"
|
39
39
|
end
|
40
40
|
|
41
41
|
def run
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcOrgList < Chef::Knife
|
@@ -23,14 +23,14 @@ module Opc
|
|
23
23
|
banner "knife opc org list"
|
24
24
|
|
25
25
|
option :with_uri,
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
long: "--with-uri",
|
27
|
+
short: "-w",
|
28
|
+
description: "Show corresponding URIs"
|
29
29
|
|
30
30
|
option :all_orgs,
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
|
@@ -23,13 +23,13 @@ module Opc
|
|
23
23
|
attr_accessor :org_name, :username
|
24
24
|
|
25
25
|
option :admin,
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
long: "--admin",
|
27
|
+
short: "-a",
|
28
|
+
description: "Add user to admin group"
|
29
29
|
|
30
30
|
deps do
|
31
|
-
|
32
|
-
|
31
|
+
require_relative "../org"
|
32
|
+
require_relative "../org/group_operations"
|
33
33
|
end
|
34
34
|
|
35
35
|
def run
|
@@ -23,13 +23,13 @@ module Opc
|
|
23
23
|
attr_accessor :org_name, :username
|
24
24
|
|
25
25
|
option :force_remove_from_admins,
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
31
|
+
require_relative "../org"
|
32
|
+
require_relative "../org/group_operations"
|
33
33
|
require "chef/json_compat"
|
34
34
|
end
|
35
35
|
|
@@ -51,7 +51,7 @@ module Opc
|
|
51
51
|
You ran with --force which force removes the user from the admins and billing-admins groups.
|
52
52
|
However, removing #{username} from the admins group would leave it empty, which breaks the org.
|
53
53
|
Please add another user to org #{org_name} admins group and try again.
|
54
|
-
EOF
|
54
|
+
EOF
|
55
55
|
exit 1
|
56
56
|
end
|
57
57
|
remove_user_from_admin_group(org, org_name, username, "admins")
|
@@ -71,7 +71,7 @@ EOF
|
|
71
71
|
ui.msg <<~EOF
|
72
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
73
|
Re-run this command with --force to remove this user from the admins prior to removing it from the organization.
|
74
|
-
EOF
|
74
|
+
EOF
|
75
75
|
exit 1
|
76
76
|
else
|
77
77
|
raise e
|
@@ -93,7 +93,7 @@ EOF
|
|
93
93
|
ui.warn <<~EOF
|
94
94
|
User #{username} is not in the #{admin_group_string} group for organization #{org_name}.
|
95
95
|
You probably don't need to pass --force.
|
96
|
-
EOF
|
96
|
+
EOF
|
97
97
|
else
|
98
98
|
raise e
|
99
99
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserCreate < Chef::Knife
|
@@ -23,19 +23,19 @@ module Opc
|
|
23
23
|
banner "knife opc user create USERNAME FIRST_NAME [MIDDLE_NAME] LAST_NAME EMAIL PASSWORD"
|
24
24
|
|
25
25
|
option :filename,
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
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
|
-
|
37
|
-
|
38
|
-
|
36
|
+
long: "--prompt-for-password",
|
37
|
+
short: "-p",
|
38
|
+
description: "Prompt for user password"
|
39
39
|
|
40
40
|
include Chef::Mixin::RootRestv0
|
41
41
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserDelete < Chef::Knife
|
@@ -36,8 +36,8 @@ module Opc
|
|
36
36
|
include Chef::Mixin::RootRestv0
|
37
37
|
|
38
38
|
deps do
|
39
|
-
|
40
|
-
|
39
|
+
require_relative "../org"
|
40
|
+
require_relative "../org/group_operations"
|
41
41
|
end
|
42
42
|
|
43
43
|
def run
|
@@ -117,7 +117,7 @@ module Opc
|
|
117
117
|
Run this command again with the --remove-from-admin-groups option to
|
118
118
|
remove the user from these admin group(s) automatically.
|
119
119
|
|
120
|
-
EOM
|
120
|
+
EOM
|
121
121
|
ui.fatal message
|
122
122
|
exit 1
|
123
123
|
end
|
@@ -128,7 +128,7 @@ EOM
|
|
128
128
|
#{username} is the only member of the 'admins' group of the
|
129
129
|
following organization(s):
|
130
130
|
|
131
|
-
EOM
|
131
|
+
EOM
|
132
132
|
only_admin_of.each { |org| message << "- #{org.name}\n" }
|
133
133
|
message << <<~EOM
|
134
134
|
|
@@ -136,7 +136,7 @@ EOM
|
|
136
136
|
Assign additional users or groups to the admin group(s) before
|
137
137
|
deleting this user.
|
138
138
|
|
139
|
-
EOM
|
139
|
+
EOM
|
140
140
|
ui.fatal message
|
141
141
|
exit 1
|
142
142
|
end
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserEdit < Chef::Knife
|
@@ -23,14 +23,14 @@ module Opc
|
|
23
23
|
banner "knife opc user edit USERNAME"
|
24
24
|
|
25
25
|
option :input,
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
-
|
32
|
-
|
33
|
-
|
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
|
|
@@ -52,7 +52,7 @@ module Opc
|
|
52
52
|
if original_user != edited_user
|
53
53
|
result = root_rest.put("users/#{user_name}", edited_user)
|
54
54
|
ui.msg("Saved #{user_name}.")
|
55
|
-
|
55
|
+
unless result["private_key"].nil?
|
56
56
|
if config[:filename]
|
57
57
|
File.open(config[:filename], "w") do |f|
|
58
58
|
f.print(result["private_key"])
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserList < Chef::Knife
|
@@ -23,9 +23,9 @@ module Opc
|
|
23
23
|
banner "knife opc user list"
|
24
24
|
|
25
25
|
option :with_uri,
|
26
|
-
|
27
|
-
|
28
|
-
|
26
|
+
long: "--with-uri",
|
27
|
+
short: "-w",
|
28
|
+
description: "Show corresponding URIs"
|
29
29
|
|
30
30
|
include Chef::Mixin::RootRestv0
|
31
31
|
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserPassword < Chef::Knife
|
@@ -23,9 +23,9 @@ module Opc
|
|
23
23
|
banner "knife opc user password USERNAME [PASSWORD | --enable-external-auth]"
|
24
24
|
|
25
25
|
option :enable_external_auth,
|
26
|
-
|
27
|
-
|
28
|
-
|
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
|
|
@@ -34,7 +34,7 @@ module Opc
|
|
34
34
|
# USERNAME PASSWORD or USERNAME --enable-external-auth
|
35
35
|
#
|
36
36
|
# note that you can't pass USERNAME PASSWORD --enable-external-auth
|
37
|
-
|
37
|
+
unless (@name_args.length == 2 && !config[:enable_external_auth]) || (@name_args.length == 1 && config[:enable_external_auth])
|
38
38
|
show_usage
|
39
39
|
ui.fatal("You must pass two arguments")
|
40
40
|
ui.fatal("Note that --enable-external-auth cannot be passed with a password")
|
@@ -52,7 +52,7 @@ module Opc
|
|
52
52
|
# changing anything before we PUT.
|
53
53
|
user = root_rest.get("users/#{user_name}")
|
54
54
|
|
55
|
-
user["password"] = password
|
55
|
+
user["password"] = password unless password.nil?
|
56
56
|
|
57
57
|
# if --enable-external-auth was passed, enable it, else disable it.
|
58
58
|
# there is never a situation where we would want to enable ldap
|
@@ -15,7 +15,7 @@
|
|
15
15
|
# See the License for the specific language governing permissions and
|
16
16
|
# limitations under the License.
|
17
17
|
#
|
18
|
-
|
18
|
+
require_relative "../mixin/root_rest"
|
19
19
|
|
20
20
|
module Opc
|
21
21
|
class OpcUserShow < Chef::Knife
|
@@ -23,8 +23,8 @@ module Opc
|
|
23
23
|
banner "knife opc user show USERNAME"
|
24
24
|
|
25
25
|
option :with_orgs,
|
26
|
-
|
27
|
-
|
26
|
+
long: "--with-orgs",
|
27
|
+
short: "-l"
|
28
28
|
|
29
29
|
include Chef::Mixin::RootRestv0
|
30
30
|
|
data/lib/chef/org.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "chef/json_compat"
|
2
2
|
require "chef/mixin/params_validate"
|
3
3
|
require "chef/server_api"
|
4
|
-
|
4
|
+
require_relative "org/group_operations"
|
5
5
|
|
6
6
|
class Chef
|
7
7
|
class Org
|
@@ -24,22 +24,22 @@ class Chef
|
|
24
24
|
|
25
25
|
def name(arg = nil)
|
26
26
|
set_or_return(:name, arg,
|
27
|
-
|
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
|
-
|
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
|
-
|
37
|
+
arg, kind_of: String)
|
38
38
|
end
|
39
39
|
|
40
40
|
def guid(arg = nil)
|
41
41
|
set_or_return(:guid,
|
42
|
-
|
42
|
+
arg, kind_of: String)
|
43
43
|
end
|
44
44
|
|
45
45
|
def to_hash
|
data/lib/knife-opc/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-opc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Danna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Knife Tools for Chef Server
|
14
14
|
email: steve@chef.io
|
@@ -53,8 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
requirements: []
|
56
|
-
|
57
|
-
rubygems_version: 2.7.6
|
56
|
+
rubygems_version: 3.0.3
|
58
57
|
signing_key:
|
59
58
|
specification_version: 4
|
60
59
|
summary: Knife Tools for Chef Server
|