Style and lint fixes to support newer ChefDK
Change-Id: I0a3872cd3a21c31b5e3a7b6190f911280e9ed909 Depends-On: I6ce4587caa3ae68ddbd3ef1a521aaf46f4840b2c
This commit is contained in:
parent
96ed4cf461
commit
a08aecef1d
|
@ -13,8 +13,8 @@ Requirements
|
|||
============
|
||||
|
||||
- Chef 12 or higher
|
||||
- chefdk 0.9.0 for testing (also includes berkshelf for cookbook dependency
|
||||
resolution)
|
||||
- chefdk 0.9.0 or later for testing (also includes berkshelf for cookbook
|
||||
dependency resolution)
|
||||
|
||||
Platform
|
||||
========
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
name 'openstack-image'
|
||||
maintainer 'openstack-chef'
|
||||
maintainer_email 'openstack-dev@lists.openstack.org'
|
||||
issues_url 'https://launchpad.net/openstack-chef' if respond_to?(:issues_url)
|
||||
source_url 'https://github.com/openstack/cookbook-openstack-image' if respond_to?(:source_url)
|
||||
license 'Apache 2.0'
|
||||
description 'Installs and configures the Glance Image Registry and Delivery Service'
|
||||
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
include ::Openstack
|
||||
|
||||
use_inline_resources
|
||||
|
||||
action :upload do
|
||||
@user = new_resource.identity_user
|
||||
@pass = new_resource.identity_pass
|
||||
|
@ -50,7 +52,7 @@ def _determine_type(url)
|
|||
when '.qcow2', '.img'
|
||||
return 'qcow'
|
||||
else
|
||||
fail ArgumentError, "File extension not supported for #{url}, supported extensions are: .gz, .tgz for ami and .qcow2 and .img for qcow"
|
||||
raise ArgumentError, "File extension not supported for #{url}, supported extensions are: .gz, .tgz for ami and .qcow2 and .img for qcow"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -38,8 +38,7 @@ end
|
|||
db_user = node['openstack']['db']['image']['username']
|
||||
db_pass = get_password 'db', 'glance'
|
||||
node.default['openstack']['image_registry']['conf_secrets']
|
||||
.[]('database')['connection'] =
|
||||
db_uri('image', db_user, db_pass)
|
||||
.[]('database')['connection'] = db_uri('image', db_user, db_pass)
|
||||
|
||||
if node['openstack']['image_registry']['conf']['DEFAULT']['rpc_backend'] == 'rabbit'
|
||||
user = node['openstack']['mq']['image']['rabbit']['userid']
|
||||
|
@ -55,8 +54,7 @@ registry_bind = node['openstack']['bind_service']['all']['image_registry']
|
|||
registry_bind_address = bind_address registry_bind
|
||||
|
||||
node.default['openstack']['image_registry']['conf_secrets']
|
||||
.[]('keystone_authtoken')['password'] =
|
||||
get_password 'service', 'openstack-image'
|
||||
.[]('keystone_authtoken')['password'] = get_password 'service', 'openstack-image'
|
||||
|
||||
auth_url = auth_uri_transform identity_endpoint.to_s, node['openstack']['api']['auth']['version']
|
||||
glance_user = node['openstack']['image']['user']
|
||||
|
|
|
@ -27,7 +27,7 @@ def initialize(*args)
|
|||
@action = :upload
|
||||
end
|
||||
|
||||
BOOLEAN = [TrueClass, FalseClass]
|
||||
BOOLEAN = [TrueClass, FalseClass].freeze
|
||||
|
||||
attribute :image_url, kind_of: String
|
||||
attribute :image_type, kind_of: String, default: 'unknown', equal_to: %w(unknown ami qcow vhd vmdk vdi iso raw)
|
||||
|
|
|
@ -53,12 +53,12 @@ describe 'openstack-image::image_upload' do
|
|||
it "uploads the #{image_type} image" do
|
||||
node.set['openstack']['image']['upload_images'] = ["#{image_type}_imageName"]
|
||||
node.set['openstack']['image']['upload_image']["#{image_type}_imageName"] = "image_file.#{image_type}"
|
||||
node.set['openstack']['image']['upload_image_type']["#{image_type}_imageName"] = "#{image_type}"
|
||||
node.set['openstack']['image']['upload_image_type']["#{image_type}_imageName"] = image_type
|
||||
stub_command("glance --insecure --os-username admin --os-password admin-pass --os-tenant-name admin --os-image-url http://127.0.0.1:9292 --os-auth-url http://127.0.0.1:5000/v2.0 image-list | grep #{image_type}_imageName").and_return(false)
|
||||
expect(chef_run).to upload_openstack_image_image("Image setup for #{image_type}_imageName").with(
|
||||
image_url: "image_file.#{image_type}",
|
||||
image_name: "#{image_type}_imageName",
|
||||
image_type: "#{image_type}",
|
||||
image_type: image_type,
|
||||
image_public: true
|
||||
)
|
||||
end
|
||||
|
|
|
@ -11,12 +11,12 @@ REDHAT_OPTS = {
|
|||
platform: 'redhat',
|
||||
version: '7.1',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
}.freeze
|
||||
UBUNTU_OPTS = {
|
||||
platform: 'ubuntu',
|
||||
version: '14.04',
|
||||
log_level: LOG_LEVEL
|
||||
}
|
||||
}.freeze
|
||||
|
||||
# Helper methods
|
||||
module Helpers
|
||||
|
|
Loading…
Reference in New Issue