hammer_cli_foreman 3.16.0 → 3.17.0
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/doc/release_notes.md +7 -0
- data/lib/hammer_cli_foreman/filter.rb +8 -66
- data/lib/hammer_cli_foreman/report_template.rb +1 -0
- data/lib/hammer_cli_foreman/template.rb +1 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ka/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/test/functional/filter_test.rb +3 -124
- data/test/unit/filter_test.rb +0 -10
- metadata +7 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 19aecc76c45aea21d165a63bf62ce10fec9774e4d552fd34e176dae195dcaf23
|
|
4
|
+
data.tar.gz: 18d5e71e31373b5b4ac1d744712f9a77b8a263e9eb612690f94b63f49eb5d0dd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ecd60a4cadea52d36350b5dc32a42a5741dab3bb2d99bc5568754879b55b2521c3f9da136490dfbde9d7ea745349ecdc2693dd2b0f50db7605f2ca460be29cd7
|
|
7
|
+
data.tar.gz: ae9865919068552dcafdf72d1d8da6a35f2b3d999c7d88251849e75c83bb54d9dba9e7982a5f91d5be735545e1f6d5928a224e999f6a2da6ef92ab81b263b035
|
data/doc/release_notes.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
Release notes
|
|
2
2
|
=============
|
|
3
|
+
### 3.17.0 (2025-11-11)
|
|
4
|
+
* Add packit commit trigger job
|
|
5
|
+
* Remove options related to filter overrides ([PR #645](https://github.com/theforeman/hammer-cli-foreman/pull/645)), [#38805](http://projects.theforeman.org/issues/38805)
|
|
6
|
+
* Add github actions workflow for releases
|
|
7
|
+
* Expose cloned from id in template info command
|
|
8
|
+
* Bump to 3.17.0-develop
|
|
9
|
+
|
|
3
10
|
### 3.16.0 (2025-08-13)
|
|
4
11
|
* Ldap group membership ([PR #641](https://github.com/theforeman/hammer-cli-foreman/pull/641)), [#38611](http://projects.theforeman.org/issues/38611)
|
|
5
12
|
* Remove ovirt ([PR #639](https://github.com/theforeman/hammer-cli-foreman/pull/639)), [#38294](http://projects.theforeman.org/issues/38294)
|
|
@@ -9,8 +9,6 @@ module HammerCLIForeman
|
|
|
9
9
|
field :id, _("Id")
|
|
10
10
|
field :resource_type, _("Resource type")
|
|
11
11
|
field :search, _("Search")
|
|
12
|
-
field :unlimited?, _("Unlimited?"), Fields::Boolean
|
|
13
|
-
field :override?, _("Override?"), Fields::Boolean
|
|
14
12
|
field :role, _("Role"), Fields::Reference
|
|
15
13
|
field :permissions, _("Permissions"), Fields::List
|
|
16
14
|
end
|
|
@@ -27,8 +25,15 @@ module HammerCLIForeman
|
|
|
27
25
|
|
|
28
26
|
class InfoCommand < HammerCLIForeman::InfoCommand
|
|
29
27
|
output ListCommand.output_definition do
|
|
30
|
-
HammerCLIForeman::References.taxonomies(self)
|
|
31
28
|
HammerCLIForeman::References.timestamps(self)
|
|
29
|
+
from :role do
|
|
30
|
+
collection :locations, _("Locations"), numbered: false, hide_blank: true do
|
|
31
|
+
custom_field Fields::Reference, name_key: :title
|
|
32
|
+
end
|
|
33
|
+
collection :organizations, _("Organizations"), numbered: false, hide_blank: true do
|
|
34
|
+
custom_field Fields::Reference, name_key: :title
|
|
35
|
+
end
|
|
36
|
+
end
|
|
32
37
|
end
|
|
33
38
|
|
|
34
39
|
def extend_data(filter)
|
|
@@ -42,81 +47,18 @@ module HammerCLIForeman
|
|
|
42
47
|
end
|
|
43
48
|
|
|
44
49
|
|
|
45
|
-
module TaxonomyCheck
|
|
46
|
-
|
|
47
|
-
def self.included(base)
|
|
48
|
-
def taxonomy_options?
|
|
49
|
-
opt_names = ['location_ids', 'organization_ids']
|
|
50
|
-
opt_names += resolver.searchables(:locations).map { |s| 'location_' + s.plural_name }
|
|
51
|
-
opt_names += resolver.searchables(:organizations).map { |s| 'organization_' + s.plural_name }
|
|
52
|
-
opt_names.any? { |opt| send(HammerCLI.option_accessor_name(opt)) }
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
def signal_override_usage_error
|
|
56
|
-
signal_usage_error _('Organizations and locations can be set only for overriding filters.')
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
base.extend_help do |base_h|
|
|
60
|
-
base_h.section(_('Overriding organizations and locations')) do |section_h|
|
|
61
|
-
override_condition = "--override=true"
|
|
62
|
-
org_opts = '--organization[s|-ids]'
|
|
63
|
-
loc_opts = '--location[s|-ids]'
|
|
64
|
-
|
|
65
|
-
section_h.text(_("Filters inherit organizations and locations from its role by default. This behavior can be changed by setting %{condition}.%{wsp}" +
|
|
66
|
-
"Therefore options %{org_opts} and %{loc_opts} are applicable only when the override flag is set.") % {
|
|
67
|
-
:wsp => "\n",
|
|
68
|
-
:org_opts => org_opts,
|
|
69
|
-
:loc_opts => loc_opts,
|
|
70
|
-
:condition => override_condition
|
|
71
|
-
})
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
|
|
78
50
|
class CreateCommand < HammerCLIForeman::CreateCommand
|
|
79
|
-
include TaxonomyCheck
|
|
80
|
-
|
|
81
51
|
success_message _("Permission filter for [%<resource_type_label>s] created.")
|
|
82
52
|
failure_message _("Could not create the permission filter")
|
|
83
53
|
|
|
84
|
-
def validate_options
|
|
85
|
-
signal_override_usage_error if !option_override && taxonomy_options?
|
|
86
|
-
end
|
|
87
|
-
|
|
88
54
|
build_options
|
|
89
55
|
end
|
|
90
56
|
|
|
91
57
|
|
|
92
58
|
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
|
93
|
-
include TaxonomyCheck
|
|
94
|
-
|
|
95
59
|
success_message _("Permission filter for [%<resource_type_label>s] updated.")
|
|
96
60
|
failure_message _("Could not update the permission filter")
|
|
97
61
|
|
|
98
|
-
def request_params
|
|
99
|
-
params = super
|
|
100
|
-
unless override?
|
|
101
|
-
# Clear taxonomies in case the filter is switching override from true to false
|
|
102
|
-
params['filter']['location_ids'] = [] if !@filter || !@filter['locations'].empty?
|
|
103
|
-
params['filter']['organization_ids'] = [] if !@filter || !@filter['organizations'].empty?
|
|
104
|
-
end
|
|
105
|
-
params
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def validate_options
|
|
109
|
-
signal_override_usage_error if !override? && taxonomy_options?
|
|
110
|
-
end
|
|
111
|
-
|
|
112
|
-
def override?
|
|
113
|
-
if option_override.nil?
|
|
114
|
-
filter['override?']
|
|
115
|
-
else
|
|
116
|
-
option_override
|
|
117
|
-
end
|
|
118
|
-
end
|
|
119
|
-
|
|
120
62
|
def filter
|
|
121
63
|
@filter ||= HammerCLIForeman.foreman_resource!(:filters).action(:show).call({ :id => get_identifier }, request_headers, request_options)
|
|
122
64
|
end
|
|
@@ -16,6 +16,7 @@ module HammerCLIForeman
|
|
|
16
16
|
output ListCommand.output_definition do
|
|
17
17
|
field :description, _('Description'), Fields::Text
|
|
18
18
|
field :locked, _("Locked"), Fields::Boolean
|
|
19
|
+
field :cloned_from_id, _("Cloned from id"), nil, :hide_blank => true
|
|
19
20
|
field :default, _("Default"), Fields::Boolean
|
|
20
21
|
HammerCLIForeman::References.timestamps(self)
|
|
21
22
|
HammerCLIForeman::References.taxonomies(self)
|
|
@@ -42,6 +42,7 @@ module HammerCLIForeman
|
|
|
42
42
|
output ListCommand.output_definition do
|
|
43
43
|
field :description, _('Description'), Fields::Text
|
|
44
44
|
field :locked, _("Locked"), Fields::Boolean
|
|
45
|
+
field :cloned_from_id, _("Cloned from id"), nil, :hide_blank => true
|
|
45
46
|
HammerCLIForeman::References.operating_systems(self)
|
|
46
47
|
HammerCLIForeman::References.taxonomies(self)
|
|
47
48
|
collection :template_combinations, 'Template Combinations' do
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -4,10 +4,9 @@ require File.join(File.dirname(__FILE__), 'test_helper')
|
|
|
4
4
|
|
|
5
5
|
describe 'filter' do
|
|
6
6
|
def api_expects_filter_info(options)
|
|
7
|
-
override = !!options[:override]
|
|
8
7
|
api_expects(:filters, :show, 'Get filter info').with_params(
|
|
9
8
|
id: '1'
|
|
10
|
-
).returns(@filter
|
|
9
|
+
).returns(@filter)
|
|
11
10
|
end
|
|
12
11
|
|
|
13
12
|
def taxonomy_usage_error(action, cmd)
|
|
@@ -27,15 +26,6 @@ describe 'filter' do
|
|
|
27
26
|
@cmd = %w[filter create]
|
|
28
27
|
end
|
|
29
28
|
|
|
30
|
-
it 'prints error when taxonomies are used for a not-overriding filter' do
|
|
31
|
-
params = ['--organization-ids=1,2', '--location-ids=3,4', '--override=false']
|
|
32
|
-
|
|
33
|
-
api_expects_no_call
|
|
34
|
-
|
|
35
|
-
result = run_cmd(@cmd + params)
|
|
36
|
-
assert_cmd(taxonomy_usage_error('create', @cmd), result)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
29
|
it 'should create a filter' do
|
|
40
30
|
params = ['--role-id=1', '--permission-ids=[1]']
|
|
41
31
|
|
|
@@ -67,8 +57,8 @@ describe 'filter' do
|
|
|
67
57
|
api_expects(:filters, :index, 'List filters').returns(@filters)
|
|
68
58
|
|
|
69
59
|
output = IndexMatcher.new([
|
|
70
|
-
['ID', 'RESOURCE TYPE', 'SEARCH', '
|
|
71
|
-
['1', 'Architecture', 'none', '
|
|
60
|
+
['ID', 'RESOURCE TYPE', 'SEARCH', 'ROLE', 'PERMISSIONS'],
|
|
61
|
+
['1', 'Architecture', 'none', 'Manager', 'view_architectures']
|
|
72
62
|
])
|
|
73
63
|
expected_result = success_result(output)
|
|
74
64
|
|
|
@@ -100,115 +90,4 @@ describe 'filter' do
|
|
|
100
90
|
assert_cmd(success_result("Permission filter deleted.\n"), result)
|
|
101
91
|
end
|
|
102
92
|
end
|
|
103
|
-
|
|
104
|
-
describe 'update' do
|
|
105
|
-
before do
|
|
106
|
-
@cmd = %w[filter update]
|
|
107
|
-
@filter = {
|
|
108
|
-
'search' => nil,
|
|
109
|
-
'resource_type_label' => 'User',
|
|
110
|
-
'resource_type' => 'User',
|
|
111
|
-
'unlimited?' => false,
|
|
112
|
-
'created_at' => '2017-07-18 14:34:09 UTC',
|
|
113
|
-
'updated_at' => '2017-07-18 14:34:09 UTC',
|
|
114
|
-
'override?' => true,
|
|
115
|
-
'id' => 404,
|
|
116
|
-
'role' => {
|
|
117
|
-
'name' => 'Some Role',
|
|
118
|
-
'id' => 28,
|
|
119
|
-
'description' => "Description\nof the new\nrole",
|
|
120
|
-
'origin' => nil
|
|
121
|
-
},
|
|
122
|
-
'permissions' => [{
|
|
123
|
-
'name' => 'view_users',
|
|
124
|
-
'id' => 164,
|
|
125
|
-
'resource_type' => 'User'
|
|
126
|
-
}],
|
|
127
|
-
'locations' => [{
|
|
128
|
-
'id' => 28,
|
|
129
|
-
'name' => 'location74',
|
|
130
|
-
'title' => 'location74',
|
|
131
|
-
'description' => nil
|
|
132
|
-
}],
|
|
133
|
-
'organizations' => [{
|
|
134
|
-
'id' => 27,
|
|
135
|
-
'name' => 'organization74',
|
|
136
|
-
'title' => 'organization74',
|
|
137
|
-
'description' => nil
|
|
138
|
-
}]
|
|
139
|
-
}
|
|
140
|
-
end
|
|
141
|
-
|
|
142
|
-
it 'resets taxonomies when a filter is not-overriding' do
|
|
143
|
-
params = ['--id=1']
|
|
144
|
-
|
|
145
|
-
api_expects_filter_info(override: false)
|
|
146
|
-
api_expects(:filters, :update, 'Update the filter').with_params(
|
|
147
|
-
'filter' => {
|
|
148
|
-
'organization_ids' => [],
|
|
149
|
-
'location_ids' => []
|
|
150
|
-
}
|
|
151
|
-
).returns(@filter)
|
|
152
|
-
|
|
153
|
-
assert_update_success(run_cmd(@cmd + params))
|
|
154
|
-
end
|
|
155
|
-
|
|
156
|
-
it 'resets taxonomies when switching a filter to not-overriding' do
|
|
157
|
-
params = ['--id=1', '--override=false']
|
|
158
|
-
|
|
159
|
-
api_expects(:filters, :update, 'Update the filter').with_params(
|
|
160
|
-
'filter' => {
|
|
161
|
-
'organization_ids' => [],
|
|
162
|
-
'location_ids' => []
|
|
163
|
-
}
|
|
164
|
-
).returns(@filter)
|
|
165
|
-
|
|
166
|
-
assert_update_success(run_cmd(@cmd + params))
|
|
167
|
-
end
|
|
168
|
-
|
|
169
|
-
it 'can add taxonomies when a filter is overriding' do
|
|
170
|
-
params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4']
|
|
171
|
-
|
|
172
|
-
api_expects_filter_info(override: true)
|
|
173
|
-
api_expects(:filters, :update, 'Update the filter').with_params(
|
|
174
|
-
'filter' => {
|
|
175
|
-
'organization_ids' => %w[1 2],
|
|
176
|
-
'location_ids' => %w[3 4]
|
|
177
|
-
}
|
|
178
|
-
).returns(@filter)
|
|
179
|
-
|
|
180
|
-
assert_update_success(run_cmd(@cmd + params))
|
|
181
|
-
end
|
|
182
|
-
|
|
183
|
-
it 'can add taxonomies when switching a filter to overriding' do
|
|
184
|
-
params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4', '--override=true']
|
|
185
|
-
|
|
186
|
-
api_expects(:filters, :update, 'Update the filter').with_params(
|
|
187
|
-
'filter' => {
|
|
188
|
-
'organization_ids' => %w[1 2],
|
|
189
|
-
'location_ids' => %w[3 4]
|
|
190
|
-
}
|
|
191
|
-
).returns(@filter)
|
|
192
|
-
|
|
193
|
-
assert_update_success(run_cmd(@cmd + params))
|
|
194
|
-
end
|
|
195
|
-
|
|
196
|
-
it 'prints error when taxonomies are used on not-overriding' do
|
|
197
|
-
params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4']
|
|
198
|
-
|
|
199
|
-
api_expects_filter_info(override: false)
|
|
200
|
-
|
|
201
|
-
result = run_cmd(@cmd + params)
|
|
202
|
-
assert_cmd(taxonomy_usage_error('update', @cmd), result)
|
|
203
|
-
end
|
|
204
|
-
|
|
205
|
-
it 'prints error when taxonomies are used when switching a filter to not-overriding' do
|
|
206
|
-
params = ['--id=1', '--organization-ids=1,2', '--location-ids=3,4', '--override=false']
|
|
207
|
-
|
|
208
|
-
api_expects_no_call
|
|
209
|
-
|
|
210
|
-
result = run_cmd(@cmd + params)
|
|
211
|
-
assert_cmd(taxonomy_usage_error('update', @cmd), result)
|
|
212
|
-
end
|
|
213
|
-
end
|
|
214
93
|
end
|
data/test/unit/filter_test.rb
CHANGED
|
@@ -60,11 +60,6 @@ describe HammerCLIForeman::Filter do
|
|
|
60
60
|
describe "CreateCommand" do
|
|
61
61
|
let(:cmd) { HammerCLIForeman::Filter::CreateCommand.new("", ctx) }
|
|
62
62
|
|
|
63
|
-
before do
|
|
64
|
-
# FIXME: remove stubbing option_override once tests are switched to apidoc 1.14+
|
|
65
|
-
cmd.stubs(:option_override).returns(false)
|
|
66
|
-
end
|
|
67
|
-
|
|
68
63
|
describe "parameters" do
|
|
69
64
|
it_should_accept "role id and permission ids", ["--role-id=1", "--permission-ids=1,2"]
|
|
70
65
|
it_should_accept "role name and permission ids", ["--role=role", "--permission-ids=1,2"]
|
|
@@ -85,11 +80,6 @@ describe HammerCLIForeman::Filter do
|
|
|
85
80
|
describe "UpdateCommand" do
|
|
86
81
|
let(:cmd) { HammerCLIForeman::Filter::UpdateCommand.new("", ctx) }
|
|
87
82
|
|
|
88
|
-
before do
|
|
89
|
-
# FIXME: remove stubbing option_override once tests are switched to apidoc 1.14+
|
|
90
|
-
cmd.stubs(:option_override).returns(false)
|
|
91
|
-
end
|
|
92
|
-
|
|
93
83
|
describe "parameters" do
|
|
94
84
|
it_should_accept "id, role id and permission ids", ["--id=1", "--role-id=1", "--permission-ids=1,2"]
|
|
95
85
|
it_should_accept "id, role name and permission ids", ["--id=1", "--role=role", "--permission-ids=1,2"]
|
metadata
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hammer_cli_foreman
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.
|
|
4
|
+
version: 3.17.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tomáš Strachota
|
|
8
8
|
- Martin Bačovský
|
|
9
|
+
autorequire:
|
|
9
10
|
bindir: bin
|
|
10
11
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
+
date: 2025-11-11 00:00:00.000000000 Z
|
|
12
13
|
dependencies:
|
|
13
14
|
- !ruby/object:Gem::Dependency
|
|
14
15
|
name: hammer_cli
|
|
@@ -79,7 +80,6 @@ email: tstracho@redhat.com
|
|
|
79
80
|
executables: []
|
|
80
81
|
extensions: []
|
|
81
82
|
extra_rdoc_files:
|
|
82
|
-
- README.md
|
|
83
83
|
- doc/configuration.md
|
|
84
84
|
- doc/developer_docs.md
|
|
85
85
|
- doc/host_create.md
|
|
@@ -89,6 +89,7 @@ extra_rdoc_files:
|
|
|
89
89
|
- doc/release_notes.md
|
|
90
90
|
- doc/testing.md
|
|
91
91
|
- doc/using_hammer_cli_foreman_command.md
|
|
92
|
+
- README.md
|
|
92
93
|
files:
|
|
93
94
|
- LICENSE
|
|
94
95
|
- README.md
|
|
@@ -340,6 +341,7 @@ homepage: https://github.com/theforeman/hammer-cli-foreman
|
|
|
340
341
|
licenses:
|
|
341
342
|
- GPL-3.0-or-later
|
|
342
343
|
metadata: {}
|
|
344
|
+
post_install_message:
|
|
343
345
|
rdoc_options: []
|
|
344
346
|
require_paths:
|
|
345
347
|
- lib
|
|
@@ -354,7 +356,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
354
356
|
- !ruby/object:Gem::Version
|
|
355
357
|
version: '0'
|
|
356
358
|
requirements: []
|
|
357
|
-
rubygems_version: 3.
|
|
359
|
+
rubygems_version: 3.2.33
|
|
360
|
+
signing_key:
|
|
358
361
|
specification_version: 4
|
|
359
362
|
summary: Foreman commands for Hammer
|
|
360
363
|
test_files:
|