Fix glance_image for local images
When trying to upload an image from the local file system, the resource provider was failing. Fixing it to use the --file option for the glance client instead of going through stdin. Change-Id: Ic6bade025d28e2eb33f86c2d4421b65d06e8274c
This commit is contained in:
parent
fced3226c2
commit
90bf62341d
@ -43,12 +43,10 @@ Puppet::Type.type(:glance_image).provide(
|
||||
end
|
||||
|
||||
def create
|
||||
stdin = nil
|
||||
if resource[:source]
|
||||
# copy_from cannot handle file://
|
||||
if resource[:source] =~ /^\// # local file
|
||||
location = "< #{resource[:source]}"
|
||||
stdin = true
|
||||
location = "--file=#{resource[:source]}"
|
||||
else
|
||||
location = "--copy-from=#{resource[:source]}"
|
||||
end
|
||||
@ -59,11 +57,7 @@ Puppet::Type.type(:glance_image).provide(
|
||||
else
|
||||
raise(Puppet::Error, "Must specify either source or location")
|
||||
end
|
||||
if stdin
|
||||
result = auth_glance_stdin('image-create', "--name=#{resource[:name]}", "--is-public=#{resource[:is_public]}", "--container-format=#{resource[:container_format]}", "--disk-format=#{resource[:disk_format]}", location)
|
||||
else
|
||||
results = auth_glance('image-create', "--name=#{resource[:name]}", "--is-public=#{resource[:is_public]}", "--container-format=#{resource[:container_format]}", "--disk-format=#{resource[:disk_format]}", location)
|
||||
end
|
||||
results = auth_glance('image-create', "--name=#{resource[:name]}", "--is-public=#{resource[:is_public]}", "--container-format=#{resource[:container_format]}", "--disk-format=#{resource[:disk_format]}", location)
|
||||
|
||||
id = nil
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user