Add '--xxx' only argument type for client cli
Beside the command type "<client> --key=<value> <command>", there is other type of command type "<client> --key <command>" for example "keystone --insecure tenant-list". Add this command argument type into consideration. Change-Id: I6bb97279ef380eb71ac581f8cd99623ab7d1519e
This commit is contained in:
parent
0655583c91
commit
554a50e07d
@ -6,6 +6,7 @@ This file is used to list changes made in each version of cookbook-openstack-com
|
||||
* Separate endpoints for vncserver_listen and vncserver_proxyclient_address
|
||||
* Bump Chef gem to 11.16
|
||||
* Fix openstack_command with correct arguments order
|
||||
* Fix openstack_command with single argument type
|
||||
|
||||
## 10.1.0
|
||||
* Adding identity admin bind host endpoint to allow flexibility and consistency
|
||||
|
@ -56,7 +56,8 @@ module ::Openstack # rubocop:disable Documentation
|
||||
# glance image-show <id|name>
|
||||
openstackcmd = [cmd]
|
||||
args.each do |key, val|
|
||||
openstackcmd << "--#{key}" << val.to_s
|
||||
openstackcmd << "--#{key}"
|
||||
openstackcmd << val.to_s unless val.to_s.empty?
|
||||
end
|
||||
openstackcmd = openstackcmd.concat(options.split)
|
||||
Chef::Log.debug("Running openstack command: #{openstackcmd} with environment: #{env}")
|
||||
|
@ -57,11 +57,11 @@ describe 'openstack-common::default' do
|
||||
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||
}
|
||||
allow(subject).to receive(:shell_out).with(
|
||||
%w(keystone --key1 value1 --key2 value2 user-list),
|
||||
%w(keystone --key1 value1 --key2 value2 --key3 user-list),
|
||||
env: env
|
||||
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
||||
|
||||
result = subject.openstack_command('keystone', 'user-list', env, 'key1' => 'value1', 'key2' => 'value2')
|
||||
result = subject.openstack_command('keystone', 'user-list', env, 'key1' => 'value1', 'key2' => 'value2', 'key3' => '')
|
||||
expect(result).to eq('good')
|
||||
end
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user