fix user_enabled/tenant_enabled boolean TypeError

ERROR: Unable to create tenant 'service'
ERROR: Error was: can't convert true into String

Fixes bug 1184614

Change-Id: I28b751b30f9b2c90e7151b282ae62253383dca52
This commit is contained in:
Ionuț Arțăriși
2013-05-27 15:56:43 +02:00
parent 356ad8348c
commit c3fab87a24
2 changed files with 20 additions and 4 deletions

View File

@@ -35,10 +35,8 @@ end
private
def identity_command resource, cmd, args={}
keystonecmd = ['keystone'] << cmd
args.each { |key,val|
if val
keystonecmd << "--#{key}" << val
end
args.each { |key, val|
keystonecmd << "--#{key}" << val.to_s
}
Chef::Log.debug("Running identity command: #{keystonecmd}")
rc = shell_out(keystonecmd, :env => generate_creds(resource))

View File

@@ -184,4 +184,22 @@ describe Chef::Provider::Execute do
provider.run_action(:create_ec2_credentials)
@ec2_resource.should_not be_updated
end
describe "#identity_command" do
it "should handle false values and long descriptions" do
provider = Chef::Provider::OpenstackIdentityRegister.new(
@user_resource, @run_context)
provider.stub!(:shell_out).with(
["keystone", "user-create", "--enabled", "false",
"--description", "more than one word"],
{:env => {"OS_SERVICE_ENDPOINT" => nil, "OS_SERVICE_TOKEN" => nil}}
).and_return double("shell_out", :exitstatus => 0, :stdout => "good")
provider.send(
:identity_command, @user_resource, "user-create",
{"enabled" => false, "description" => "more than one word"}
).should eq "good"
end
end
end