knife 18.8.65 → 18.8.68
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/user_list.rb +15 -1
- data/lib/chef/knife/version.rb +1 -1
- data/spec/unit/knife/user_list_spec.rb +34 -2
- metadata +6 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 13bca26f312d5e068e005be12728ee58921e90fc573fe757d27ea8c4b5b812f6
|
|
4
|
+
data.tar.gz: 0da54bfaa9b437f52dbbb203c570e6bbeda840ca5dd5d94d7d6947ead3a8a84f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 53c7412d0e45a4bc29aac831cb3852e88c7440dae8784ef7056e8c0f92c59e864a18a569b1a6e1f7517295ada533e61059e19aee59721114a63d9c1d3471cff8
|
|
7
|
+
data.tar.gz: fc6a97ff8ef6205aa2f1c9693250a8373a29e3579f28bcfd90f627e09fafb101d20a8a4b03a9465168cc4ef0eb6fd87bdd45f4878703052f1de5a6a65ca828f3
|
data/lib/chef/knife/user_list.rb
CHANGED
|
@@ -34,8 +34,22 @@ class Chef
|
|
|
34
34
|
long: "--with-uri",
|
|
35
35
|
description: "Show corresponding URIs."
|
|
36
36
|
|
|
37
|
+
option :all_users,
|
|
38
|
+
short: "-a",
|
|
39
|
+
long: "--all-users",
|
|
40
|
+
description: "Show all user details."
|
|
37
41
|
def run
|
|
38
|
-
|
|
42
|
+
users = Chef::UserV1.list(config[:all_users])
|
|
43
|
+
if config[:all_users]
|
|
44
|
+
# When showing all user details, convert UserV1 objects to hashes for display
|
|
45
|
+
detailed_users = {}
|
|
46
|
+
users.each do |name, user|
|
|
47
|
+
detailed_users[name] = user.to_h
|
|
48
|
+
end
|
|
49
|
+
output(detailed_users)
|
|
50
|
+
else
|
|
51
|
+
output(format_list_for_display(users))
|
|
52
|
+
end
|
|
39
53
|
end
|
|
40
54
|
|
|
41
55
|
end
|
data/lib/chef/knife/version.rb
CHANGED
|
@@ -34,6 +34,8 @@ describe Chef::Knife::UserList do
|
|
|
34
34
|
@rest = double("Chef::ServerAPI")
|
|
35
35
|
allow(Chef::ServerAPI).to receive(:new).and_return(@rest)
|
|
36
36
|
allow(@rest).to receive(:get).with("users").and_return(users)
|
|
37
|
+
allow(Chef::UserV1).to receive(:list).with(nil).and_return(users)
|
|
38
|
+
|
|
37
39
|
end
|
|
38
40
|
|
|
39
41
|
describe "with no arguments" do
|
|
@@ -45,12 +47,42 @@ describe Chef::Knife::UserList do
|
|
|
45
47
|
end
|
|
46
48
|
|
|
47
49
|
describe "with all_users argument" do
|
|
50
|
+
let(:user1_object) do
|
|
51
|
+
u = Chef::UserV1.new
|
|
52
|
+
u.username "user1"
|
|
53
|
+
u.email "user1@example.com"
|
|
54
|
+
u.display_name "User One"
|
|
55
|
+
u
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
let(:user2_object) do
|
|
59
|
+
u = Chef::UserV1.new
|
|
60
|
+
u.username "user2"
|
|
61
|
+
u.email "user2@example.com"
|
|
62
|
+
u.display_name "User Two"
|
|
63
|
+
u
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
let(:inflated_users) do
|
|
67
|
+
{
|
|
68
|
+
"user1" => user1_object,
|
|
69
|
+
"user2" => user2_object,
|
|
70
|
+
}
|
|
71
|
+
end
|
|
48
72
|
before do
|
|
49
73
|
knife.config[:all_users] = true
|
|
74
|
+
allow(Chef::UserV1).to receive(:list).with(true).and_return(inflated_users)
|
|
75
|
+
|
|
50
76
|
end
|
|
51
77
|
|
|
52
|
-
it "lists all users
|
|
53
|
-
expect(knife.ui).to receive(:output)
|
|
78
|
+
it "lists all users with full details" do
|
|
79
|
+
expect(knife.ui).to receive(:output) do |arg|
|
|
80
|
+
expect(arg).to be_a(Hash)
|
|
81
|
+
expect(arg.keys).to contain_exactly("user1", "user2")
|
|
82
|
+
expect(arg["user1"]["username"]).to eq("user1")
|
|
83
|
+
expect(arg["user1"]["email"]).to eq("user1@example.com")
|
|
84
|
+
expect(arg["user2"]["username"]).to eq("user2")
|
|
85
|
+
end
|
|
54
86
|
knife.run
|
|
55
87
|
end
|
|
56
88
|
end
|
metadata
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: knife
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 18.8.
|
|
4
|
+
version: 18.8.68
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Adam Jacob
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date: 2025-12-
|
|
11
|
+
date: 2025-12-10 00:00:00.000000000 Z
|
|
11
12
|
dependencies:
|
|
12
13
|
- !ruby/object:Gem::Dependency
|
|
13
14
|
name: chef-config
|
|
@@ -1176,6 +1177,7 @@ metadata:
|
|
|
1176
1177
|
homepage_uri: https://www.chef.io
|
|
1177
1178
|
mailing_list_uri: https://discourse.chef.io/
|
|
1178
1179
|
source_code_uri: https://github.com/chef/chef/
|
|
1180
|
+
post_install_message:
|
|
1179
1181
|
rdoc_options: []
|
|
1180
1182
|
require_paths:
|
|
1181
1183
|
- lib
|
|
@@ -1190,7 +1192,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
1190
1192
|
- !ruby/object:Gem::Version
|
|
1191
1193
|
version: '0'
|
|
1192
1194
|
requirements: []
|
|
1193
|
-
rubygems_version: 3.
|
|
1195
|
+
rubygems_version: 3.3.27
|
|
1196
|
+
signing_key:
|
|
1194
1197
|
specification_version: 4
|
|
1195
1198
|
summary: The knife CLI for Chef Infra.
|
|
1196
1199
|
test_files: []
|