diff --git a/libraries/api_keys.rb b/libraries/api_keys.rb index f77d092..53cc863 100644 --- a/libraries/api_keys.rb +++ b/libraries/api_keys.rb @@ -36,7 +36,12 @@ def create_admin_apikeys # bypass the section if CloudStack is not running. if @current_resource.admin_apikey or @current_resource.admin_secretkey # if keys attributes are empty search in Chef environment for other node having API-KEYS. - other_nodes = search(:node, "chef_environment:#{node.chef_environment} AND cloudstack_admin_api_key:* NOT name:#{node.name}") + if Chef::Config[:solo] + Chef::Log.warn('This recipe uses search. Chef Solo does not support search.') + other_nodes = [] + else + other_nodes = search(:node, "chef_environment:#{node.chef_environment} AND cloudstack_admin_api_key:* NOT name:#{node.name}") + end if ! other_nodes.empty? @current_resource.admin_apikey(other_nodes.first["cloudstack"]["admin"]["api_key"]) @current_resource.admin_secretkey(other_nodes.first["cloudstack"]["admin"]["secret_key"]) diff --git a/libraries/system_template.rb b/libraries/system_template.rb index 2e23075..79e6a98 100644 --- a/libraries/system_template.rb +++ b/libraries/system_template.rb @@ -34,13 +34,12 @@ def get_template_id # Create or mount secondary storage path def secondary_storage - unless ::File.exist?(@current_resource.nfs_path) - directory @current_resource.nfs_path do - owner "root" - group "root" - action :create - recursive true - end + directory @current_resource.nfs_path do + owner "root" + group "root" + action :create + recursive true + not_if { ::File.exist?(@current_resource.nfs_path)} end end @@ -55,4 +54,4 @@ def download_systemvm_template end end end -end \ No newline at end of file +end diff --git a/metadata.rb b/metadata.rb index aad8e9e..3898d96 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,6 +6,9 @@ long_description IO.read(File.join(File.dirname(__FILE__), 'README.md')) version '4.0.5' +source_url 'https://github.com/cloudops/cookbook_cloudstack' +issues_url 'https://github.com/cloudops/cookbook_cloudstack/issues' + depends "yum", "> 3.0" depends "apt", "> 2.0" depends "mysql", "> 6.0.0" diff --git a/providers/api_keys.rb b/providers/api_keys.rb index 63b8e4b..8ba503b 100644 --- a/providers/api_keys.rb +++ b/providers/api_keys.rb @@ -33,6 +33,8 @@ def whyrun_supported? true end +use_inline_resources + ######### # ACTIONS ######### diff --git a/providers/global_setting.rb b/providers/global_setting.rb index 376bc16..3acc55b 100644 --- a/providers/global_setting.rb +++ b/providers/global_setting.rb @@ -24,6 +24,8 @@ include Cloudstack::Helper include Cloudstack::GlobalSetting +use_inline_resources + ######### # ACTIONS ######### diff --git a/providers/setup_database.rb b/providers/setup_database.rb index 6433d56..4d1e60d 100644 --- a/providers/setup_database.rb +++ b/providers/setup_database.rb @@ -21,6 +21,8 @@ include Cloudstack::Helper include Cloudstack::Database +use_inline_resources + action :create do #load_current_resource #Chef::Log.info "creating cloudstack database" diff --git a/providers/setup_management.rb b/providers/setup_management.rb index f7d7805..a2c0b5b 100644 --- a/providers/setup_management.rb +++ b/providers/setup_management.rb @@ -19,6 +19,8 @@ # execute default cloudstack configuration script ############################################################################### +use_inline_resources + action :run do bash "cloudstack-setup-management" do @@ -26,4 +28,4 @@ not_if { ::File.exists?("/etc/cloudstack/management/tomcat6.conf") || ::File.exists?("/etc/cloudstack/management/server.xml")} end -end \ No newline at end of file +end diff --git a/providers/system_template.rb b/providers/system_template.rb index e5f1aff..c3b1ec5 100644 --- a/providers/system_template.rb +++ b/providers/system_template.rb @@ -22,6 +22,8 @@ include Cloudstack::Helper include Cloudstack::SystemTemplate +use_inline_resources + action :create do load_current_resource @@ -53,7 +55,10 @@ def load_current_resource else if db_exist?(@current_resource.db_host, @current_resource.db_user, @current_resource.db_password) if @current_resource.url.nil? - @current_resource.url(`mysql -h #{@current_resource.db_host} --user=#{@current_resource.db_user} --password=#{@current_resource.db_password} --skip-column-names -U cloud -e 'select max(url) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"#{@current_resource.hypervisor}\" and removed is null'`.chomp) + cmd = Mixlib::ShellOut.new("mysql -h #{@current_resource.db_host} --user=#{@current_resource.db_user} --password=#{@current_resource.db_password} --skip-column-names -U cloud -e 'select max(url) from cloud.vm_template where type = \"SYSTEM\" and hypervisor_type = \"#{@current_resource.hypervisor}\" and removed is null'") + cmd.run_command + cmd.error! + @current_resource.url(cmd.stdout.chomp) end template_id = get_template_id Chef::Log.debug "looking for template in #{@current_resource.nfs_path}/template/tmpl/1/#{template_id}" diff --git a/recipes/management_server.rb b/recipes/management_server.rb index b952c4e..9b2d022 100644 --- a/recipes/management_server.rb +++ b/recipes/management_server.rb @@ -29,11 +29,10 @@ end end -if platform?(%w{ubuntu debian}) - # tomcat6 package installation automatically start tomcat6 on port 8080. - service 'tomcat6' do - action [:stop, :disable] - end +# tomcat6 package installation automatically start tomcat6 on port 8080. +service 'tomcat6' do + action [:stop, :disable] + only_if { platform?(%w{ubuntu debian}) } end