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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 58805e9e530880fd8b1d22a9bbf4e8ed7834f098c4e49102bcc919317b98f6c3
4
- data.tar.gz: '06922ce94fdf2739de01ebe96863c35972266021bf7da8c3547d090801373529'
3
+ metadata.gz: 13bca26f312d5e068e005be12728ee58921e90fc573fe757d27ea8c4b5b812f6
4
+ data.tar.gz: 0da54bfaa9b437f52dbbb203c570e6bbeda840ca5dd5d94d7d6947ead3a8a84f
5
5
  SHA512:
6
- metadata.gz: 1d3d50ab7c09aea6479cac9c842460dfe4d57a5f27136d5bd0ad11d4b401e19f309958c1138277186a4c54fa5b8f3c801118bbd4d9af8533d7c33a12249801d9
7
- data.tar.gz: ac88975c0690bed0daa32b7f2302efecf82e426b81b94564e7b13112b684787f12f577656c03a90f281d7867c9d41b9f54f33769e8fea69b9513f30a6d4efe58
6
+ metadata.gz: 53c7412d0e45a4bc29aac831cb3852e88c7440dae8784ef7056e8c0f92c59e864a18a569b1a6e1f7517295ada533e61059e19aee59721114a63d9c1d3471cff8
7
+ data.tar.gz: fc6a97ff8ef6205aa2f1c9693250a8373a29e3579f28bcfd90f627e09fafb101d20a8a4b03a9465168cc4ef0eb6fd87bdd45f4878703052f1de5a6a65ca828f3
@@ -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
- output(format_list_for_display(Chef::UserV1.list))
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
@@ -17,7 +17,7 @@
17
17
  class Chef
18
18
  class Knife
19
19
  KNIFE_ROOT = File.expand_path("../..", __dir__)
20
- VERSION = "18.8.65".freeze
20
+ VERSION = "18.8.68".freeze
21
21
  end
22
22
  end
23
23
 
@@ -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 including hidden users" do
53
- expect(knife.ui).to receive(:output).with(%w{user1 user2})
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.65
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-04 00:00:00.000000000 Z
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.6.2
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: []