hammer_cli_foreman 0.7.0 → 0.8.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.

Potentially problematic release.


This version of hammer_cli_foreman might be problematic. Click here for more details.

Files changed (65) hide show
  1. checksums.yaml +4 -4
  2. data/doc/release_notes.md +11 -0
  3. data/lib/hammer_cli_foreman.rb +4 -0
  4. data/lib/hammer_cli_foreman/associating_commands.rb +21 -0
  5. data/lib/hammer_cli_foreman/host.rb +0 -5
  6. data/lib/hammer_cli_foreman/id_resolver.rb +6 -2
  7. data/lib/hammer_cli_foreman/location.rb +1 -0
  8. data/lib/hammer_cli_foreman/organization.rb +2 -0
  9. data/lib/hammer_cli_foreman/realm.rb +53 -0
  10. data/lib/hammer_cli_foreman/smart_class_parameter.rb +3 -0
  11. data/lib/hammer_cli_foreman/smart_variable.rb +4 -1
  12. data/lib/hammer_cli_foreman/usergroup.rb +1 -3
  13. data/lib/hammer_cli_foreman/version.rb +1 -1
  14. data/locale/ca/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  15. data/locale/ca/hammer-cli-foreman.edit.po +376 -290
  16. data/locale/ca/hammer-cli-foreman.po +393 -192
  17. data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  18. data/locale/de/hammer-cli-foreman.edit.po +277 -179
  19. data/locale/de/hammer-cli-foreman.po +420 -219
  20. data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  21. data/locale/en/hammer-cli-foreman.edit.po +216 -144
  22. data/locale/en/hammer-cli-foreman.po +55 -1
  23. data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  24. data/locale/en_GB/hammer-cli-foreman.edit.po +339 -224
  25. data/locale/en_GB/hammer-cli-foreman.po +391 -190
  26. data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  27. data/locale/es/hammer-cli-foreman.edit.po +251 -158
  28. data/locale/es/hammer-cli-foreman.po +444 -242
  29. data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  30. data/locale/fr/hammer-cli-foreman.edit.po +252 -159
  31. data/locale/fr/hammer-cli-foreman.po +392 -191
  32. data/locale/hammer-cli-foreman.pot +253 -175
  33. data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  34. data/locale/it/hammer-cli-foreman.edit.po +281 -188
  35. data/locale/it/hammer-cli-foreman.po +391 -190
  36. data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  37. data/locale/ja/hammer-cli-foreman.edit.po +282 -189
  38. data/locale/ja/hammer-cli-foreman.po +457 -256
  39. data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  40. data/locale/ko/hammer-cli-foreman.edit.po +280 -187
  41. data/locale/ko/hammer-cli-foreman.po +458 -257
  42. data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  43. data/locale/pt_BR/hammer-cli-foreman.edit.po +255 -162
  44. data/locale/pt_BR/hammer-cli-foreman.po +455 -254
  45. data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  46. data/locale/ru/hammer-cli-foreman.edit.po +443 -337
  47. data/locale/ru/hammer-cli-foreman.po +412 -211
  48. data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  49. data/locale/zh_CN/hammer-cli-foreman.edit.po +278 -185
  50. data/locale/zh_CN/hammer-cli-foreman.po +465 -264
  51. data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
  52. data/locale/zh_TW/hammer-cli-foreman.edit.po +279 -186
  53. data/locale/zh_TW/hammer-cli-foreman.po +459 -258
  54. data/test/data/README.md +2 -2
  55. data/test/functional/hostgroup/create_test.rb +303 -0
  56. data/test/functional/hostgroup/update_test.rb +303 -0
  57. data/test/functional/smart_variable_test.rb +150 -0
  58. data/test/unit/host_test.rb +0 -4
  59. data/test/unit/location_test.rb +1 -0
  60. data/test/unit/organization_test.rb +1 -0
  61. data/test/unit/realm_test.rb +87 -0
  62. data/test/unit/smart_class_parameter_test.rb +7 -0
  63. data/test/unit/smart_variable_test.rb +1 -1
  64. data/test/unit/usergroup_test.rb +2 -0
  65. metadata +13 -4
@@ -0,0 +1,150 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+
3
+ describe 'smart-variable update' do
4
+ let(:cmd) { %w(smart-variable update) }
5
+
6
+ it 'allows to save new name' do
7
+ params = ['--id=1', '--new-variable=name2']
8
+
9
+ expected_result = success_result("Smart variable [name2] updated\n")
10
+
11
+ api_expects(:smart_variables, :update, 'Update the variable') do |par|
12
+ par['smart_variable']['variable'] == 'name2'
13
+ end.returns(
14
+ 'description' => '',
15
+ 'parameter_type' => 'string',
16
+ 'default_value' => '',
17
+ 'hidden_value?' => false,
18
+ 'hidden_value' => '*****',
19
+ 'validator_type' => '',
20
+ 'validator_rule' => nil,
21
+ 'override_value_order' => 'fqdn\nhostgroup\nos\ndomain',
22
+ 'merge_overrides' => false,
23
+ 'merge_default' => false,
24
+ 'avoid_duplicates' => false,
25
+ 'puppetclass_id' => 68,
26
+ 'puppetclass_name' => 'apache',
27
+ 'created_at' => '2016-08-16 07:48:29 UTC',
28
+ 'updated_at' => '2016-08-16 07:54:05 UTC',
29
+ 'variable' => 'name2',
30
+ 'id' => 1,
31
+ 'override_values_count' => 0,
32
+ 'override_values' => []
33
+ )
34
+
35
+ result = run_cmd(cmd + params)
36
+ assert_cmd(expected_result, result)
37
+ end
38
+ end
39
+
40
+ describe 'smart-variable info' do
41
+ let(:cmd) { %w(smart-variable info) }
42
+ let(:variable) do
43
+ {
44
+ 'description' => '',
45
+ 'parameter_type' => 'string',
46
+ 'default_value' => "1.2.3.4 aa.con\r\n1.2.3.5 bb.com",
47
+ 'hidden_value?' => false,
48
+ 'hidden_value' => '*****',
49
+ 'validator_type' => '',
50
+ 'validator_rule' => nil,
51
+ 'override_value_order' => "fqdn\nhostgroup\nos\ndomain",
52
+ 'merge_overrides' => false,
53
+ 'merge_default' => false,
54
+ 'avoid_duplicates' => false,
55
+ 'puppetclass_id' => 68,
56
+ 'puppetclass_name' => 'apache',
57
+ 'created_at' => '2016-08-01 13:05:24 UTC',
58
+ 'updated_at' => '2016-08-08 12:36:08 UTC',
59
+ 'variable' => 'abc',
60
+ 'id' => 1,
61
+ 'override_values_count' => 0
62
+ }
63
+ end
64
+
65
+ it 'searches by --variable parameter' do
66
+ params = ['--variable=abc']
67
+
68
+ api_expects(:smart_variables, :index, 'Search for variable') do |par|
69
+ par[:search] == %(key = "#{variable['variable']}")
70
+ end.returns(index_response([variable]))
71
+
72
+ api_expects(:smart_variables, :show, 'Variable details') do |par|
73
+ par['id'] == 1
74
+ end.returns(variable)
75
+
76
+ result = run_cmd(cmd + params)
77
+ assert_match(/abc/, result.out)
78
+ end
79
+
80
+ it 'searches by deprecated --name parameter' do
81
+ params = ['--name=abc']
82
+
83
+ api_expects(:smart_variables, :index, 'Search for variable') do |par|
84
+ par[:search] == %(key = "#{variable['variable']}")
85
+ end.returns(index_response([variable]))
86
+
87
+ api_expects(:smart_variables, :show, 'Variable details') do |par|
88
+ par['id'] == 1
89
+ end.returns(variable)
90
+
91
+ result = run_cmd(cmd + params)
92
+ assert_match(/abc/, result.out)
93
+ end
94
+ end
95
+
96
+ describe 'smart-variable delete' do
97
+ let(:cmd) { %w(smart-variable delete) }
98
+ let(:variable) do
99
+ {
100
+ 'description' => '',
101
+ 'parameter_type' => 'string',
102
+ 'default_value' => "1.2.3.4 aa.con\r\n1.2.3.5 bb.com",
103
+ 'hidden_value?' => false,
104
+ 'hidden_value' => '*****',
105
+ 'validator_type' => '',
106
+ 'validator_rule' => nil,
107
+ 'override_value_order' => "fqdn\nhostgroup\nos\ndomain",
108
+ 'merge_overrides' => false,
109
+ 'merge_default' => false,
110
+ 'avoid_duplicates' => false,
111
+ 'puppetclass_id' => 68,
112
+ 'puppetclass_name' => 'apache',
113
+ 'created_at' => '2016-08-01 13:05:24 UTC',
114
+ 'updated_at' => '2016-08-08 12:36:08 UTC',
115
+ 'variable' => 'abc',
116
+ 'id' => 1,
117
+ 'override_values_count' => 0
118
+ }
119
+ end
120
+
121
+ it 'deletes by --variable parameter' do
122
+ params = ['--variable=abc']
123
+
124
+ api_expects(:smart_variables, :index, 'Search for variable') do |par|
125
+ par[:search] == %(key = "#{variable['variable']}")
126
+ end.returns(index_response([variable]))
127
+
128
+ api_expects(:smart_variables, :destroy, 'Variable details') do |par|
129
+ par['id'] == 1
130
+ end.returns(variable)
131
+
132
+ result = run_cmd(cmd + params)
133
+ assert_match(/abc/, result.out)
134
+ end
135
+
136
+ it 'deletes by deprecated --name parameter' do
137
+ params = ['--name=abc']
138
+
139
+ api_expects(:smart_variables, :index, 'Search for variable') do |par|
140
+ par[:search] == %(key = "#{variable['variable']}")
141
+ end.returns(index_response([variable]))
142
+
143
+ api_expects(:smart_variables, :destroy, 'Variable details') do |par|
144
+ par['id'] == 1
145
+ end.returns(variable)
146
+
147
+ result = run_cmd(cmd + params)
148
+ assert_match(/abc/, result.out)
149
+ end
150
+ end
@@ -29,10 +29,6 @@ describe HammerCLIForeman::Host do
29
29
 
30
30
  let(:cmd) { HammerCLIForeman::Host::InfoCommand.new("", ctx) }
31
31
 
32
- before :each do
33
- cmd.stubs(:get_parameters).returns([])
34
- end
35
-
36
32
  context "parameters" do
37
33
  it_should_accept "id", ["--id=1"]
38
34
  it_should_accept "name", ["--name=host"]
@@ -25,6 +25,7 @@ describe HammerCLIForeman::Location do
25
25
  let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
26
26
 
27
27
  it_should_print_n_records
28
+ it_should_print_column "Description"
28
29
  it_should_print_column "Name"
29
30
  it_should_print_column "Id"
30
31
  end
@@ -26,6 +26,7 @@ describe HammerCLIForeman::Organization do
26
26
  let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
27
27
 
28
28
  it_should_print_n_records
29
+ it_should_print_column "Description"
29
30
  it_should_print_column "Name"
30
31
  it_should_print_column "Id"
31
32
  end
@@ -0,0 +1,87 @@
1
+ require File.join(File.dirname(__FILE__), 'test_helper')
2
+ require File.join(File.dirname(__FILE__), 'apipie_resource_mock')
3
+
4
+ require 'hammer_cli_foreman/realm'
5
+
6
+ describe HammerCLIForeman::Realm do
7
+
8
+ include CommandTestHelper
9
+
10
+ context "ListCommand" do
11
+
12
+ let(:cmd) { HammerCLIForeman::Realm::ListCommand.new("", ctx) }
13
+
14
+ context "parameters" do
15
+ it_should_accept "no arguments"
16
+ it_should_accept_search_params
17
+ end
18
+
19
+ context "output" do
20
+ let(:expected_record_count) { count_records(cmd.resource.call(:index)) }
21
+
22
+ it_should_print_n_records
23
+ it_should_print_columns ["Id", "Name"]
24
+ end
25
+
26
+ end
27
+
28
+
29
+ context "InfoCommand" do
30
+
31
+ let(:cmd) { HammerCLIForeman::Realm::InfoCommand.new("", ctx) }
32
+
33
+ context "parameters" do
34
+ it_should_accept "id", ["--id=1"]
35
+ it_should_accept "name", ["--name=arch"]
36
+ # it_should_fail_with "no arguments" # TODO: temporarily disabled, parameters are checked in the id resolver
37
+ end
38
+
39
+ context "output" do
40
+ with_params ["--id=1"] do
41
+ it_should_print_n_records 1
42
+ it_should_print_columns ["Id", "Name", "Created at", "Updated at"]
43
+ it_should_print_columns ["Realm proxy id", "Realm type"]
44
+ end
45
+ end
46
+
47
+ end
48
+
49
+ context "CreateCommand" do
50
+
51
+ let(:cmd) { HammerCLIForeman::Realm::CreateCommand.new("", ctx) }
52
+
53
+ context "parameters" do
54
+ it_should_accept "name, type, proxy", ["--name=realm", "--realm-type=FreeIPA", "--realm-proxy-id=1"]
55
+ end
56
+
57
+ end
58
+
59
+
60
+ context "DeleteCommand" do
61
+
62
+ let(:cmd) { HammerCLIForeman::Realm::DeleteCommand.new("", ctx) }
63
+
64
+ context "parameters" do
65
+ it_should_accept "name", ["--name=realm"]
66
+ it_should_accept "id", ["--id=1"]
67
+ # it_should_fail_with "name or id missing", [] # TODO: temporarily disabled, parameters are checked in the id resolver
68
+ end
69
+
70
+ end
71
+
72
+
73
+ context "UpdateCommand" do
74
+
75
+ let(:cmd) { HammerCLIForeman::Realm::UpdateCommand.new("", ctx) }
76
+
77
+ context "parameters" do
78
+ it_should_accept "name", ["--name=realm", "--new-name=realm2"]
79
+ it_should_accept "id", ["--id=1", "--new-name=realm2"]
80
+ # it_should_fail_with "no params", []
81
+ # it_should_fail_with "name or id missing", ["--new-name=arch2", "--description=full_realm_name"]
82
+ # TODO: temporarily disabled, parameters are checked in the id resolver
83
+ end
84
+
85
+ end
86
+
87
+ end
@@ -54,6 +54,13 @@ describe HammerCLIForeman::SmartClassParameter do
54
54
  # it_should_fail_with "no arguments"
55
55
  # TODO: temporarily disabled, parameters are checked in the id resolver
56
56
  end
57
+
58
+ context "output" do
59
+ with_params ["--id=1"] do
60
+ it_should_print_n_records 1
61
+ it_should_print_columns ["Description", "Type", "Use puppet default", "Required"]
62
+ end
63
+ end
57
64
  end
58
65
 
59
66
 
@@ -28,7 +28,7 @@ describe HammerCLIForeman::SmartVariable do
28
28
 
29
29
  it_should_print_n_records
30
30
  it_should_print_column "Id"
31
- it_should_print_column "Name"
31
+ it_should_print_column "Variable"
32
32
  it_should_print_column "Default Value"
33
33
  it_should_print_column "Type"
34
34
  it_should_print_column "Class Id"
@@ -20,6 +20,7 @@ describe HammerCLIForeman::Usergroup do
20
20
  context "output" do
21
21
  it_should_print_column "Id"
22
22
  it_should_print_column "Name"
23
+ it_should_print_column "Admin"
23
24
  end
24
25
 
25
26
  end
@@ -37,6 +38,7 @@ describe HammerCLIForeman::Usergroup do
37
38
  with_params ["--id=1"] do
38
39
  it_should_print_column "Id"
39
40
  it_should_print_column "Name"
41
+ it_should_print_column "Admin"
40
42
  it_should_print_column "Users"
41
43
  it_should_print_column "User groups"
42
44
  it_should_print_column "Roles"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-14 00:00:00.000000000 Z
12
+ date: 2016-09-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 0.7.0
20
+ version: 0.8.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 0.7.0
27
+ version: 0.8.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: apipie-bindings
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -101,6 +101,7 @@ files:
101
101
  - lib/hammer_cli_foreman/parameter.rb
102
102
  - lib/hammer_cli_foreman/partition_table.rb
103
103
  - lib/hammer_cli_foreman/puppet_class.rb
104
+ - lib/hammer_cli_foreman/realm.rb
104
105
  - lib/hammer_cli_foreman/references.rb
105
106
  - lib/hammer_cli_foreman/report.rb
106
107
  - lib/hammer_cli_foreman/resource_supported_test.rb
@@ -176,9 +177,12 @@ files:
176
177
  - test/data/README.md
177
178
  - test/functional/commands/list_test.rb
178
179
  - test/functional/host_test.rb
180
+ - test/functional/hostgroup/create_test.rb
181
+ - test/functional/hostgroup/update_test.rb
179
182
  - test/functional/location_test.rb
180
183
  - test/functional/organization_test.rb
181
184
  - test/functional/smart_class_parameter_test.rb
185
+ - test/functional/smart_variable_test.rb
182
186
  - test/functional/template_test.rb
183
187
  - test/functional/test_helper.rb
184
188
  - test/reports/TEST-HammerCLIForeman-Architecture-CreateCommand-parameters.xml
@@ -457,6 +461,7 @@ files:
457
461
  - test/unit/param_filters_test.rb
458
462
  - test/unit/partition_table_test.rb
459
463
  - test/unit/puppet_class_test.rb
464
+ - test/unit/realm_test.rb
460
465
  - test/unit/report_test.rb
461
466
  - test/unit/role_test.rb
462
467
  - test/unit/smart_class_parameter_test.rb
@@ -735,10 +740,13 @@ test_files:
735
740
  - test/reports/TEST-HammerCLIForeman-PartitionTable-ListCommand-output.xml
736
741
  - test/reports/TEST-HammerCLIForeman-Hostgroup-UpdateCommand-parameters.xml
737
742
  - test/functional/host_test.rb
743
+ - test/functional/smart_variable_test.rb
738
744
  - test/functional/organization_test.rb
739
745
  - test/functional/location_test.rb
740
746
  - test/functional/template_test.rb
741
747
  - test/functional/smart_class_parameter_test.rb
748
+ - test/functional/hostgroup/create_test.rb
749
+ - test/functional/hostgroup/update_test.rb
742
750
  - test/functional/commands/list_test.rb
743
751
  - test/functional/test_helper.rb
744
752
  - test/unit/image_test.rb
@@ -754,6 +762,7 @@ test_files:
754
762
  - test/unit/smart_proxy_test.rb
755
763
  - test/unit/subnet_test.rb
756
764
  - test/unit/location_test.rb
765
+ - test/unit/realm_test.rb
757
766
  - test/unit/dependency_resolver_test.rb
758
767
  - test/unit/helpers/command.rb
759
768
  - test/unit/helpers/resource_disabled.rb