Fix the argument order for openstack client
If there are --xxx argument placed for openstack clients such as nova, glance, keystone etc, these arguments need to be placed before the actual command line. Otherwise, the client will raise unrecognized arguments exception which will make the command execution fail. Change-Id: I1568f9332accffdfa3a34d8bbd842f707b1a340e Closes-Bug: #1388147
This commit is contained in:
@@ -4,8 +4,8 @@ This file is used to list changes made in each version of cookbook-openstack-com
|
||||
|
||||
## 10.2.0
|
||||
* Separate endpoints for vncserver_listen and vncserver_proxyclient_address
|
||||
|
||||
* Bump Chef gem to 11.16
|
||||
* Fix openstack_command with correct arguments order
|
||||
|
||||
## 10.1.0
|
||||
* Adding identity admin bind host endpoint to allow flexibility and consistency
|
||||
|
@@ -54,10 +54,11 @@ module ::Openstack # rubocop:disable Documentation
|
||||
# array into [cmd]. This is done to accomdate cmd + options like:
|
||||
# keystone user-list
|
||||
# glance image-show <id|name>
|
||||
openstackcmd = [cmd].concat(options.split)
|
||||
openstackcmd = [cmd]
|
||||
args.each do |key, val|
|
||||
openstackcmd << "--#{key}" << val.to_s
|
||||
end
|
||||
openstackcmd = openstackcmd.concat(options.split)
|
||||
Chef::Log.debug("Running openstack command: #{openstackcmd} with environment: #{env}")
|
||||
result = shell_out(openstackcmd, env: env)
|
||||
fail "#{result.stderr} (#{result.exitstatus})" if result.exitstatus != 0
|
||||
|
@@ -57,7 +57,7 @@ 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 user-list --key1 value1 --key2 value2),
|
||||
%w(keystone --key1 value1 --key2 value2 user-list),
|
||||
env: env
|
||||
).and_return double('shell_out', exitstatus: 0, stdout: 'good', stderr: '')
|
||||
|
||||
|
Reference in New Issue
Block a user