hammer_cli_foreman_puppet 0.0.5 → 0.0.7
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/hammer_cli_foreman_puppet/command_extensions/host.rb +21 -0
- data/lib/hammer_cli_foreman_puppet/command_extensions/hostgroup.rb +21 -0
- data/lib/hammer_cli_foreman_puppet/host.rb +5 -0
- data/lib/hammer_cli_foreman_puppet/hostgroup.rb +5 -0
- data/lib/hammer_cli_foreman_puppet/version.rb +1 -1
- data/locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/cs_CZ/hammer-cli-foreman-puppet.edit.po +383 -0
- data/locale/cs_CZ/hammer-cli-foreman-puppet.po +282 -0
- data/locale/de/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/de/hammer-cli-foreman-puppet.edit.po +396 -0
- data/locale/de/hammer-cli-foreman-puppet.po +293 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/en/hammer-cli-foreman-puppet.edit.po +362 -0
- data/locale/en/hammer-cli-foreman-puppet.po +276 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/es/hammer-cli-foreman-puppet.edit.po +389 -0
- data/locale/es/hammer-cli-foreman-puppet.po +287 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/fr/hammer-cli-foreman-puppet.edit.po +387 -0
- data/locale/fr/hammer-cli-foreman-puppet.po +285 -0
- data/locale/hammer-cli-foreman-puppet.pot +386 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/ja/hammer-cli-foreman-puppet.edit.po +386 -0
- data/locale/ja/hammer-cli-foreman-puppet.po +283 -0
- data/locale/ka/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/ka/hammer-cli-foreman-puppet.edit.po +383 -0
- data/locale/ka/hammer-cli-foreman-puppet.po +280 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/pt_BR/hammer-cli-foreman-puppet.edit.po +389 -0
- data/locale/pt_BR/hammer-cli-foreman-puppet.po +288 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman-puppet.mo +0 -0
- data/locale/zh_CN/hammer-cli-foreman-puppet.edit.po +385 -0
- data/locale/zh_CN/hammer-cli-foreman-puppet.po +283 -0
- data/test/data/3.3/foreman_api.json +1 -0
- data/test/functional/host/create_test.rb +35 -4
- data/test/functional/host/update_test.rb +33 -4
- data/test/functional/hostgroup/create_test.rb +34 -5
- data/test/functional/hostgroup/update_test.rb +33 -4
- data/test/test_helper.rb +1 -1
- data/test/unit/config_group_test.rb +2 -10
- metadata +47 -14
| @@ -25,7 +25,7 @@ module HammerCLIForemanPuppet | |
| 25 25 | 
             
                      p[:search] == 'name = "env1"'
         | 
| 26 26 | 
             
                    end.returns(index_response([{ 'id' => 1 }]))
         | 
| 27 27 | 
             
                    api_expects(:hosts, :create) do |p|
         | 
| 28 | 
            -
                      p['host']['environment_id'] == 1 &&
         | 
| 28 | 
            +
                      p['host']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 29 29 | 
             
                        p['host']['name'] == 'hst1'
         | 
| 30 30 | 
             
                    end
         | 
| 31 31 | 
             
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| @@ -59,7 +59,7 @@ module HammerCLIForemanPuppet | |
| 59 59 | 
             
                  it 'allows puppet class ids' do
         | 
| 60 60 | 
             
                    params = %w[--puppet-class-ids=1,2]
         | 
| 61 61 | 
             
                    api_expects(:hosts, :create) do |p|
         | 
| 62 | 
            -
                      p['host']['puppetclass_ids'] == %w[1 2] &&
         | 
| 62 | 
            +
                      p['host']['puppet_attributes']['puppetclass_ids'] == %w[1 2] &&
         | 
| 63 63 | 
             
                        p['host']['name'] == 'hst1'
         | 
| 64 64 | 
             
                    end
         | 
| 65 65 | 
             
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| @@ -81,7 +81,7 @@ module HammerCLIForemanPuppet | |
| 81 81 | 
             
                      {'id' => 2, 'name' => 'pc2'}
         | 
| 82 82 | 
             
                    ]))
         | 
| 83 83 | 
             
                    api_expects(:hosts, :create) do |p|
         | 
| 84 | 
            -
                      p['host']['puppetclass_ids'] == [1,2] &&
         | 
| 84 | 
            +
                      p['host']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
         | 
| 85 85 | 
             
                        p['host']['name'] == 'hst1'
         | 
| 86 86 | 
             
                    end
         | 
| 87 87 | 
             
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| @@ -130,7 +130,7 @@ module HammerCLIForemanPuppet | |
| 130 130 |  | 
| 131 131 | 
             
                    api_expects(:hosts, :create) do |p|
         | 
| 132 132 | 
             
                      p['host']['name'] == 'hst1' &&
         | 
| 133 | 
            -
                        p['host']['puppetclass_ids'] == ids
         | 
| 133 | 
            +
                        p['host']['puppet_attributes']['puppetclass_ids'] == ids
         | 
| 134 134 | 
             
                    end
         | 
| 135 135 | 
             
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| 136 136 | 
             
                  end
         | 
| @@ -159,6 +159,37 @@ module HammerCLIForemanPuppet | |
| 159 159 | 
             
                    end
         | 
| 160 160 | 
             
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| 161 161 | 
             
                  end
         | 
| 162 | 
            +
             | 
| 163 | 
            +
                  it 'allows config group ids' do
         | 
| 164 | 
            +
                    params = %w[--config-group-ids=1,2]
         | 
| 165 | 
            +
                    api_expects(:hosts, :create) do |p|
         | 
| 166 | 
            +
                      p['host']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
         | 
| 167 | 
            +
                        p['host']['name'] == 'hst1'
         | 
| 168 | 
            +
                    end
         | 
| 169 | 
            +
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| 170 | 
            +
                  end
         | 
| 171 | 
            +
             | 
| 172 | 
            +
                  it 'allows config group names' do
         | 
| 173 | 
            +
                    params = %w[--config-groups=cg1,cg2]
         | 
| 174 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 175 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 176 | 
            +
                    end.returns(index_response([
         | 
| 177 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 178 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 179 | 
            +
                    ]))
         | 
| 180 | 
            +
                    # FIXME: Called twice because of config_group_ids being mentioned twice in the docs
         | 
| 181 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 182 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 183 | 
            +
                    end.returns(index_response([
         | 
| 184 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 185 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 186 | 
            +
                    ]))
         | 
| 187 | 
            +
                    api_expects(:hosts, :create) do |p|
         | 
| 188 | 
            +
                      p['host']['puppet_attributes']['config_group_ids'] == [1, 2] &&
         | 
| 189 | 
            +
                        p['host']['name'] == 'hst1'
         | 
| 190 | 
            +
                    end
         | 
| 191 | 
            +
                    run_cmd(cmd + minimal_params_without_hostgroup + params)
         | 
| 192 | 
            +
                  end
         | 
| 162 193 | 
             
                end
         | 
| 163 194 | 
             
              end
         | 
| 164 195 | 
             
            end
         | 
| @@ -5,7 +5,7 @@ module HammerCLIForemanPuppet | |
| 5 5 | 
             
                describe UpdateCommand do
         | 
| 6 6 | 
             
                  it 'allows environment id' do
         | 
| 7 7 | 
             
                    api_expects(:hosts, :update) do |p|
         | 
| 8 | 
            -
                      p['host']['environment_id'] == 1 &&
         | 
| 8 | 
            +
                      p['host']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 9 9 | 
             
                        p['id'] == '1'
         | 
| 10 10 | 
             
                    end
         | 
| 11 11 | 
             
                    run_cmd(%w(host update --id 1 --puppet-environment-id 1))
         | 
| @@ -20,7 +20,7 @@ module HammerCLIForemanPuppet | |
| 20 20 | 
             
                      p[:search] = "name = \"env1\""
         | 
| 21 21 | 
             
                    end.returns(index_response([{'id' => 1}]))
         | 
| 22 22 | 
             
                    api_expects(:hosts, :update) do |p|
         | 
| 23 | 
            -
                      p['host']['environment_id'] == 1 &&
         | 
| 23 | 
            +
                      p['host']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 24 24 | 
             
                        p['id'] == '1'
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 | 
             
                    run_cmd(%w(host update --id 1 --puppet-environment env1))
         | 
| @@ -47,7 +47,7 @@ module HammerCLIForemanPuppet | |
| 47 47 |  | 
| 48 48 | 
             
                  it 'allows puppet class ids' do
         | 
| 49 49 | 
             
                    api_expects(:hosts, :update) do |p|
         | 
| 50 | 
            -
                      p['host']['puppetclass_ids'] == ['1','2'] &&
         | 
| 50 | 
            +
                      p['host']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
         | 
| 51 51 | 
             
                        p['id'] == '1'
         | 
| 52 52 | 
             
                    end
         | 
| 53 53 | 
             
                    run_cmd(%w(host update --id 1 --puppet-class-ids 1,2))
         | 
| @@ -68,7 +68,7 @@ module HammerCLIForemanPuppet | |
| 68 68 | 
             
                      {'id' => 2, 'name' => 'pc2'}
         | 
| 69 69 | 
             
                    ]))
         | 
| 70 70 | 
             
                    api_expects(:hosts, :update) do |p|
         | 
| 71 | 
            -
                      p['host']['puppetclass_ids'] == [1,2] &&
         | 
| 71 | 
            +
                      p['host']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
         | 
| 72 72 | 
             
                        p['id'] == '1'
         | 
| 73 73 | 
             
                    end
         | 
| 74 74 | 
             
                    run_cmd(%w(host update --id 1 --puppet-classes pc1,pc2))
         | 
| @@ -92,6 +92,35 @@ module HammerCLIForemanPuppet | |
| 92 92 | 
             
                    end
         | 
| 93 93 | 
             
                    run_cmd(%w(host update --id 1 --puppet-proxy sp1))
         | 
| 94 94 | 
             
                  end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                  it 'allows config group ids' do
         | 
| 97 | 
            +
                    api_expects(:hosts, :update) do |p|
         | 
| 98 | 
            +
                      p['host']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
         | 
| 99 | 
            +
                        p['id'] == '1'
         | 
| 100 | 
            +
                    end
         | 
| 101 | 
            +
                    run_cmd(%w[host update --id 1 --config-group-ids=1,2])
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  it 'allows config group names' do
         | 
| 105 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 106 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 107 | 
            +
                    end.returns(index_response([
         | 
| 108 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 109 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 110 | 
            +
                    ]))
         | 
| 111 | 
            +
                    # FIXME: Called twice because of config_group_ids being mentioned twice in the docs
         | 
| 112 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 113 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 114 | 
            +
                    end.returns(index_response([
         | 
| 115 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 116 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 117 | 
            +
                    ]))
         | 
| 118 | 
            +
                    api_expects(:hosts, :update) do |p|
         | 
| 119 | 
            +
                      p['host']['puppet_attributes']['config_group_ids'] == [1, 2] &&
         | 
| 120 | 
            +
                        p['id'] == '1'
         | 
| 121 | 
            +
                    end
         | 
| 122 | 
            +
                    run_cmd(%w[host update --id 1 --config-groups=cg1,cg2])
         | 
| 123 | 
            +
                  end
         | 
| 95 124 | 
             
                end
         | 
| 96 125 | 
             
              end
         | 
| 97 126 | 
             
            end
         | 
| @@ -5,7 +5,7 @@ module HammerCLIForemanPuppet | |
| 5 5 | 
             
                describe CreateCommand do
         | 
| 6 6 | 
             
                  it 'allows puppet environment id' do
         | 
| 7 7 | 
             
                    api_expects(:hostgroups, :create) do |p|
         | 
| 8 | 
            -
                      p['hostgroup']['environment_id'] == 1 &&
         | 
| 8 | 
            +
                      p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 9 9 | 
             
                        p['hostgroup']['name'] == 'hg1'
         | 
| 10 10 | 
             
                    end
         | 
| 11 11 | 
             
                    run_cmd(%w[hostgroup create --name hg1 --puppet-environment-id 1])
         | 
| @@ -20,7 +20,7 @@ module HammerCLIForemanPuppet | |
| 20 20 | 
             
                      p[:search] == 'name = "env1"'
         | 
| 21 21 | 
             
                    end.returns(index_response([{ 'id' => 1 }]))
         | 
| 22 22 | 
             
                    api_expects(:hostgroups, :create) do |p|
         | 
| 23 | 
            -
                      p['hostgroup']['environment_id'] == 1 &&
         | 
| 23 | 
            +
                      p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 24 24 | 
             
                        p['hostgroup']['name'] == 'hg1'
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 | 
             
                    run_cmd(%w[hostgroup create --name hg1 --puppet-environment env1])
         | 
| @@ -49,7 +49,7 @@ module HammerCLIForemanPuppet | |
| 49 49 |  | 
| 50 50 | 
             
                  it 'allows puppet class ids' do
         | 
| 51 51 | 
             
                    api_expects(:hostgroups, :create) do |p|
         | 
| 52 | 
            -
                      p['hostgroup']['puppetclass_ids'] == ['1','2'] &&
         | 
| 52 | 
            +
                      p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
         | 
| 53 53 | 
             
                        p['hostgroup']['name'] == 'hg1'
         | 
| 54 54 | 
             
                    end
         | 
| 55 55 | 
             
                    run_cmd(%w(hostgroup create --name hg1 --puppet-class-ids 1,2))
         | 
| @@ -70,7 +70,7 @@ module HammerCLIForemanPuppet | |
| 70 70 | 
             
                      {'id' => 2, 'name' => 'pc2'}
         | 
| 71 71 | 
             
                    ]))
         | 
| 72 72 | 
             
                    api_expects(:hostgroups, :create) do |p|
         | 
| 73 | 
            -
                      p['hostgroup']['puppetclass_ids'] == [1,2] &&
         | 
| 73 | 
            +
                      p['hostgroup']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
         | 
| 74 74 | 
             
                        p['hostgroup']['name'] == 'hg1'
         | 
| 75 75 | 
             
                    end
         | 
| 76 76 | 
             
                    run_cmd(%w(hostgroup create --name hg1 --puppet-classes pc1,pc2))
         | 
| @@ -118,7 +118,7 @@ module HammerCLIForemanPuppet | |
| 118 118 |  | 
| 119 119 | 
             
                    api_expects(:hostgroups, :create) do |p|
         | 
| 120 120 | 
             
                      p['hostgroup']['name'] == 'hg1' &&
         | 
| 121 | 
            -
                        p['hostgroup']['puppetclass_ids'] == ids
         | 
| 121 | 
            +
                        p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ids
         | 
| 122 122 | 
             
                    end
         | 
| 123 123 |  | 
| 124 124 | 
             
                    run_cmd(%w[hostgroup create --name hg1 --puppet-classes] << names.join(',').tr('"', ''))
         | 
| @@ -144,6 +144,35 @@ module HammerCLIForemanPuppet | |
| 144 144 | 
             
                    end
         | 
| 145 145 | 
             
                    run_cmd(%w(hostgroup create --name hg1 --puppet-proxy sp1))
         | 
| 146 146 | 
             
                  end
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                  it 'allows config group ids' do
         | 
| 149 | 
            +
                    api_expects(:hostgroups, :create) do |p|
         | 
| 150 | 
            +
                      p['hostgroup']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
         | 
| 151 | 
            +
                        p['hostgroup']['name'] == 'hg1'
         | 
| 152 | 
            +
                    end
         | 
| 153 | 
            +
                    run_cmd(%w[hostgroup create --name hg1 --config-group-ids 1,2])
         | 
| 154 | 
            +
                  end
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                  it 'allows config group names' do
         | 
| 157 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 158 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 159 | 
            +
                    end.returns(index_response([
         | 
| 160 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 161 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 162 | 
            +
                    ]))
         | 
| 163 | 
            +
                    # FIXME: Called twice because of config_group_ids being mentioned twice in the docs
         | 
| 164 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 165 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 166 | 
            +
                    end.returns(index_response([
         | 
| 167 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 168 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 169 | 
            +
                    ]))
         | 
| 170 | 
            +
                    api_expects(:hostgroups, :create) do |p|
         | 
| 171 | 
            +
                      p['hostgroup']['puppet_attributes']['config_group_ids'] == [1, 2] &&
         | 
| 172 | 
            +
                        p['hostgroup']['name'] == 'hg1'
         | 
| 173 | 
            +
                    end
         | 
| 174 | 
            +
                    run_cmd(%w[hostgroup create --name hg1 --config-groups cg1,cg2])
         | 
| 175 | 
            +
                  end
         | 
| 147 176 | 
             
                end
         | 
| 148 177 | 
             
              end
         | 
| 149 178 | 
             
            end
         | 
| @@ -5,7 +5,7 @@ module HammerCLIForemanPuppet | |
| 5 5 | 
             
                describe UpdateCommand do
         | 
| 6 6 | 
             
                  it 'allows environment id' do
         | 
| 7 7 | 
             
                    api_expects(:hostgroups, :update) do |p|
         | 
| 8 | 
            -
                      p['hostgroup']['environment_id'] == 1 &&
         | 
| 8 | 
            +
                      p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 9 9 | 
             
                        p['id'] == '1'
         | 
| 10 10 | 
             
                    end
         | 
| 11 11 | 
             
                    run_cmd(%w(hostgroup update --id 1 --puppet-environment-id 1))
         | 
| @@ -20,7 +20,7 @@ module HammerCLIForemanPuppet | |
| 20 20 | 
             
                      p[:search] = "name = \"env1\""
         | 
| 21 21 | 
             
                    end.returns(index_response([{'id' => 1}]))
         | 
| 22 22 | 
             
                    api_expects(:hostgroups, :update) do |p|
         | 
| 23 | 
            -
                      p['hostgroup']['environment_id'] == 1 &&
         | 
| 23 | 
            +
                      p['hostgroup']['puppet_attributes']['environment_id'] == 1 &&
         | 
| 24 24 | 
             
                        p['id'] == '1'
         | 
| 25 25 | 
             
                    end
         | 
| 26 26 | 
             
                    run_cmd(%w(hostgroup update --id 1 --puppet-environment env1))
         | 
| @@ -47,7 +47,7 @@ module HammerCLIForemanPuppet | |
| 47 47 |  | 
| 48 48 | 
             
                  it 'allows puppet class ids' do
         | 
| 49 49 | 
             
                    api_expects(:hostgroups, :update) do |p|
         | 
| 50 | 
            -
                      p['hostgroup']['puppetclass_ids'] == ['1','2'] &&
         | 
| 50 | 
            +
                      p['hostgroup']['puppet_attributes']['puppetclass_ids'] == ['1','2'] &&
         | 
| 51 51 | 
             
                        p['id'] == '1'
         | 
| 52 52 | 
             
                    end
         | 
| 53 53 | 
             
                    run_cmd(%w(hostgroup update --id 1 --puppet-class-ids 1,2))
         | 
| @@ -68,7 +68,7 @@ module HammerCLIForemanPuppet | |
| 68 68 | 
             
                      {'id' => 2, 'name' => 'pc2'}
         | 
| 69 69 | 
             
                    ]))
         | 
| 70 70 | 
             
                    api_expects(:hostgroups, :update) do |p|
         | 
| 71 | 
            -
                      p['hostgroup']['puppetclass_ids'] == [1,2] &&
         | 
| 71 | 
            +
                      p['hostgroup']['puppet_attributes']['puppetclass_ids'] == [1,2] &&
         | 
| 72 72 | 
             
                        p['id'] == '1'
         | 
| 73 73 | 
             
                    end
         | 
| 74 74 | 
             
                    run_cmd(%w(hostgroup update --id 1 --puppet-classes pc1,pc2))
         | 
| @@ -92,6 +92,35 @@ module HammerCLIForemanPuppet | |
| 92 92 | 
             
                    end
         | 
| 93 93 | 
             
                    run_cmd(%w(hostgroup update --id 1 --puppet-proxy sp1))
         | 
| 94 94 | 
             
                  end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                  it 'allows config group ids' do
         | 
| 97 | 
            +
                    api_expects(:hostgroups, :update) do |p|
         | 
| 98 | 
            +
                      p['hostgroup']['puppet_attributes']['config_group_ids'] == %w[1 2] &&
         | 
| 99 | 
            +
                        p['id'] == '1'
         | 
| 100 | 
            +
                    end
         | 
| 101 | 
            +
                    run_cmd(%w[hostgroup update --id 1 --config-group-ids 1,2])
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  it 'allows config group names' do
         | 
| 105 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 106 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 107 | 
            +
                    end.returns(index_response([
         | 
| 108 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 109 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 110 | 
            +
                    ]))
         | 
| 111 | 
            +
                    # FIXME: Called twice because of config_group_ids being mentioned twice in the docs
         | 
| 112 | 
            +
                    api_expects(:config_groups, :index) do |p|
         | 
| 113 | 
            +
                      p[:search] = 'name = "cg1" or name = "cg2"'
         | 
| 114 | 
            +
                    end.returns(index_response([
         | 
| 115 | 
            +
                      {'id' => 1, 'name' => 'cg1'},
         | 
| 116 | 
            +
                      {'id' => 2, 'name' => 'cg2'}
         | 
| 117 | 
            +
                    ]))
         | 
| 118 | 
            +
                    api_expects(:hostgroups, :update) do |p|
         | 
| 119 | 
            +
                      p['hostgroup']['puppet_attributes']['config_group_ids'] == [1, 2] &&
         | 
| 120 | 
            +
                        p['id'] == '1'
         | 
| 121 | 
            +
                    end
         | 
| 122 | 
            +
                    run_cmd(%w[hostgroup update --id 1 --config-groups cg1,cg2])
         | 
| 123 | 
            +
                  end
         | 
| 95 124 | 
             
                end
         | 
| 96 125 | 
             
              end
         | 
| 97 126 | 
             
            end
         | 
    
        data/test/test_helper.rb
    CHANGED
    
    | @@ -17,7 +17,7 @@ require "mocha/minitest" | |
| 17 17 | 
             
            require 'hammer_cli'
         | 
| 18 18 | 
             
            require 'hammer_cli/testing/command_assertions'
         | 
| 19 19 | 
             
            require 'hammer_cli_foreman/testing/api_expectations'
         | 
| 20 | 
            -
            FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3. | 
| 20 | 
            +
            FOREMAN_VERSION = Gem::Version.new(ENV['TEST_API_VERSION'] || '3.3')
         | 
| 21 21 |  | 
| 22 22 | 
             
            include HammerCLI::Testing::CommandAssertions
         | 
| 23 23 | 
             
            include HammerCLIForeman::Testing::APIExpectations
         | 
| @@ -16,8 +16,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do | |
| 16 16 | 
             
                context "parameters" do
         | 
| 17 17 | 
             
                  it_should_accept "no arguments"
         | 
| 18 18 | 
             
                  it_should_accept_search_params
         | 
| 19 | 
            -
                  it_should_accept 'organization', ['--organization-id=1']
         | 
| 20 | 
            -
                  it_should_accept 'location', ['--location-id=1']
         | 
| 21 19 | 
             
                end
         | 
| 22 20 |  | 
| 23 21 | 
             
                context "output" do
         | 
| @@ -33,8 +31,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do | |
| 33 31 | 
             
                context "parameters" do
         | 
| 34 32 | 
             
                  it_should_accept "id", ["--id=1"]
         | 
| 35 33 | 
             
                  it_should_accept "name", ["--name=group_x"]
         | 
| 36 | 
            -
                  it_should_accept 'organization', %w[--id=1 --organization-id=1]
         | 
| 37 | 
            -
                  it_should_accept 'location', %w[--id=1 --location-id=1]
         | 
| 38 34 | 
             
                end
         | 
| 39 35 |  | 
| 40 36 | 
             
                context "output" do
         | 
| @@ -51,8 +47,8 @@ describe HammerCLIForemanPuppet::ConfigGroup do | |
| 51 47 | 
             
                let(:cmd) { HammerCLIForemanPuppet::ConfigGroup::CreateCommand.new("", ctx) }
         | 
| 52 48 |  | 
| 53 49 | 
             
                context "parameters" do
         | 
| 54 | 
            -
                  it_should_accept 'name, puppetclass ids | 
| 55 | 
            -
                                   %w[--name=first_group --puppet-class-ids=1,2 | 
| 50 | 
            +
                  it_should_accept 'name, puppetclass ids',
         | 
| 51 | 
            +
                                   %w[--name=first_group --puppet-class-ids=1,2]
         | 
| 56 52 | 
             
                end
         | 
| 57 53 | 
             
              end
         | 
| 58 54 |  | 
| @@ -62,8 +58,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do | |
| 62 58 | 
             
                context "parameters" do
         | 
| 63 59 | 
             
                  it_should_accept "name", ["--name=group_x"]
         | 
| 64 60 | 
             
                  it_should_accept "id", ["--id=1"]
         | 
| 65 | 
            -
                  it_should_accept 'organization', %w[--id=1 --organization-id=1]
         | 
| 66 | 
            -
                  it_should_accept 'location', %w[--id=1 --location-id=1]
         | 
| 67 61 | 
             
                end
         | 
| 68 62 | 
             
              end
         | 
| 69 63 |  | 
| @@ -74,8 +68,6 @@ describe HammerCLIForemanPuppet::ConfigGroup do | |
| 74 68 | 
             
                context "parameters" do
         | 
| 75 69 | 
             
                  it_should_accept "name", ["--name=group_x"]
         | 
| 76 70 | 
             
                  it_should_accept "id", ["--id=1"]
         | 
| 77 | 
            -
                  it_should_accept 'organization', %w[--id=1 --organization-id=1]
         | 
| 78 | 
            -
                  it_should_accept 'location', %w[--id=1 --location-id=1]
         | 
| 79 71 | 
             
                end
         | 
| 80 72 | 
             
              end
         | 
| 81 73 | 
             
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: hammer_cli_foreman_puppet
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.7
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Amir Fefer
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2024-01-07 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: hammer_cli_foreman
         | 
| @@ -68,8 +68,37 @@ files: | |
| 68 68 | 
             
            - lib/hammer_cli_foreman_puppet/smart_class_parameter.rb
         | 
| 69 69 | 
             
            - lib/hammer_cli_foreman_puppet/smart_proxy.rb
         | 
| 70 70 | 
             
            - lib/hammer_cli_foreman_puppet/version.rb
         | 
| 71 | 
            +
            - locale/cs_CZ/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 72 | 
            +
            - locale/cs_CZ/hammer-cli-foreman-puppet.edit.po
         | 
| 73 | 
            +
            - locale/cs_CZ/hammer-cli-foreman-puppet.po
         | 
| 74 | 
            +
            - locale/de/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 75 | 
            +
            - locale/de/hammer-cli-foreman-puppet.edit.po
         | 
| 76 | 
            +
            - locale/de/hammer-cli-foreman-puppet.po
         | 
| 77 | 
            +
            - locale/en/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 78 | 
            +
            - locale/en/hammer-cli-foreman-puppet.edit.po
         | 
| 79 | 
            +
            - locale/en/hammer-cli-foreman-puppet.po
         | 
| 80 | 
            +
            - locale/es/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 81 | 
            +
            - locale/es/hammer-cli-foreman-puppet.edit.po
         | 
| 82 | 
            +
            - locale/es/hammer-cli-foreman-puppet.po
         | 
| 83 | 
            +
            - locale/fr/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 84 | 
            +
            - locale/fr/hammer-cli-foreman-puppet.edit.po
         | 
| 85 | 
            +
            - locale/fr/hammer-cli-foreman-puppet.po
         | 
| 86 | 
            +
            - locale/hammer-cli-foreman-puppet.pot
         | 
| 87 | 
            +
            - locale/ja/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 88 | 
            +
            - locale/ja/hammer-cli-foreman-puppet.edit.po
         | 
| 89 | 
            +
            - locale/ja/hammer-cli-foreman-puppet.po
         | 
| 90 | 
            +
            - locale/ka/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 91 | 
            +
            - locale/ka/hammer-cli-foreman-puppet.edit.po
         | 
| 92 | 
            +
            - locale/ka/hammer-cli-foreman-puppet.po
         | 
| 93 | 
            +
            - locale/pt_BR/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 94 | 
            +
            - locale/pt_BR/hammer-cli-foreman-puppet.edit.po
         | 
| 95 | 
            +
            - locale/pt_BR/hammer-cli-foreman-puppet.po
         | 
| 96 | 
            +
            - locale/zh_CN/LC_MESSAGES/hammer-cli-foreman-puppet.mo
         | 
| 97 | 
            +
            - locale/zh_CN/hammer-cli-foreman-puppet.edit.po
         | 
| 98 | 
            +
            - locale/zh_CN/hammer-cli-foreman-puppet.po
         | 
| 71 99 | 
             
            - test/data/2.1/foreman_api.json
         | 
| 72 100 | 
             
            - test/data/3.0/foreman_api.json
         | 
| 101 | 
            +
            - test/data/3.3/foreman_api.json
         | 
| 73 102 | 
             
            - test/data/README.md
         | 
| 74 103 | 
             
            - test/functional/config_group_test.rb
         | 
| 75 104 | 
             
            - test/functional/host/create_test.rb
         | 
| @@ -103,23 +132,37 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 103 132 | 
             
              requirements:
         | 
| 104 133 | 
             
              - - ">="
         | 
| 105 134 | 
             
                - !ruby/object:Gem::Version
         | 
| 106 | 
            -
                  version: ' | 
| 135 | 
            +
                  version: '2.7'
         | 
| 136 | 
            +
              - - "<"
         | 
| 137 | 
            +
                - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                  version: '4'
         | 
| 107 139 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 108 140 | 
             
              requirements:
         | 
| 109 141 | 
             
              - - ">="
         | 
| 110 142 | 
             
                - !ruby/object:Gem::Version
         | 
| 111 143 | 
             
                  version: '0'
         | 
| 112 144 | 
             
            requirements: []
         | 
| 113 | 
            -
            rubygems_version: 3. | 
| 145 | 
            +
            rubygems_version: 3.2.33
         | 
| 114 146 | 
             
            signing_key: 
         | 
| 115 147 | 
             
            specification_version: 4
         | 
| 116 148 | 
             
            summary: Foreman Puppet plugin for Hammer CLI
         | 
| 117 149 | 
             
            test_files:
         | 
| 118 150 | 
             
            - test/data/2.1/foreman_api.json
         | 
| 119 151 | 
             
            - test/data/3.0/foreman_api.json
         | 
| 152 | 
            +
            - test/data/3.3/foreman_api.json
         | 
| 120 153 | 
             
            - test/data/README.md
         | 
| 154 | 
            +
            - test/functional/config_group_test.rb
         | 
| 155 | 
            +
            - test/functional/host/create_test.rb
         | 
| 156 | 
            +
            - test/functional/host/update_test.rb
         | 
| 157 | 
            +
            - test/functional/hostgroup/create_test.rb
         | 
| 158 | 
            +
            - test/functional/hostgroup/update_test.rb
         | 
| 159 | 
            +
            - test/functional/proxy_test.rb
         | 
| 160 | 
            +
            - test/functional/smart_class_parameter_test.rb
         | 
| 161 | 
            +
            - test/functional/template_test.rb
         | 
| 162 | 
            +
            - test/functional/test_helper.rb
         | 
| 121 163 | 
             
            - test/test_helper.rb
         | 
| 122 164 | 
             
            - test/unit/apipie_resource_mock.rb
         | 
| 165 | 
            +
            - test/unit/config_group_test.rb
         | 
| 123 166 | 
             
            - test/unit/helpers/command.rb
         | 
| 124 167 | 
             
            - test/unit/helpers/fake_searchables.rb
         | 
| 125 168 | 
             
            - test/unit/helpers/resource_disabled.rb
         | 
| @@ -128,13 +171,3 @@ test_files: | |
| 128 171 | 
             
            - test/unit/smart_class_parameter_test.rb
         | 
| 129 172 | 
             
            - test/unit/test_helper.rb
         | 
| 130 173 | 
             
            - test/unit/test_output_adapter.rb
         | 
| 131 | 
            -
            - test/unit/config_group_test.rb
         | 
| 132 | 
            -
            - test/functional/config_group_test.rb
         | 
| 133 | 
            -
            - test/functional/host/create_test.rb
         | 
| 134 | 
            -
            - test/functional/host/update_test.rb
         | 
| 135 | 
            -
            - test/functional/hostgroup/create_test.rb
         | 
| 136 | 
            -
            - test/functional/hostgroup/update_test.rb
         | 
| 137 | 
            -
            - test/functional/proxy_test.rb
         | 
| 138 | 
            -
            - test/functional/smart_class_parameter_test.rb
         | 
| 139 | 
            -
            - test/functional/test_helper.rb
         | 
| 140 | 
            -
            - test/functional/template_test.rb
         |