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:
@@ -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
|
* Separate endpoints for vncserver_listen and vncserver_proxyclient_address
|
||||||
* Bump Chef gem to 11.16
|
* Bump Chef gem to 11.16
|
||||||
* Fix openstack_command with correct arguments order
|
* Fix openstack_command with correct arguments order
|
||||||
|
* Fix openstack_command with single argument type
|
||||||
|
|
||||||
## 10.1.0
|
## 10.1.0
|
||||||
* Adding identity admin bind host endpoint to allow flexibility and consistency
|
* 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>
|
# glance image-show <id|name>
|
||||||
openstackcmd = [cmd]
|
openstackcmd = [cmd]
|
||||||
args.each do |key, val|
|
args.each do |key, val|
|
||||||
openstackcmd << "--#{key}" << val.to_s
|
openstackcmd << "--#{key}"
|
||||||
|
openstackcmd << val.to_s unless val.to_s.empty?
|
||||||
end
|
end
|
||||||
openstackcmd = openstackcmd.concat(options.split)
|
openstackcmd = openstackcmd.concat(options.split)
|
||||||
Chef::Log.debug("Running openstack command: #{openstackcmd} with environment: #{env}")
|
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'
|
'OS_AUTH_URL' => 'http://127.0.0.1:35357/v2.0'
|
||||||
}
|
}
|
||||||
allow(subject).to receive(:shell_out).with(
|
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
|
env: env
|
||||||
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
).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')
|
expect(result).to eq('good')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user