Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion libraries/api_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand Down
15 changes: 7 additions & 8 deletions libraries/system_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -55,4 +54,4 @@ def download_systemvm_template
end
end
end
end
end
3 changes: 3 additions & 0 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 2 additions & 0 deletions providers/api_keys.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def whyrun_supported?
true
end

use_inline_resources

#########
# ACTIONS
#########
Expand Down
2 changes: 2 additions & 0 deletions providers/global_setting.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
include Cloudstack::Helper
include Cloudstack::GlobalSetting

use_inline_resources

#########
# ACTIONS
#########
Expand Down
2 changes: 2 additions & 0 deletions providers/setup_database.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion providers/setup_management.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@
# execute default cloudstack configuration script
###############################################################################

use_inline_resources

action :run do

bash "cloudstack-setup-management" do
code "/usr/bin/cloudstack-setup-management"
not_if { ::File.exists?("/etc/cloudstack/management/tomcat6.conf") || ::File.exists?("/etc/cloudstack/management/server.xml")}
end

end
end
7 changes: 6 additions & 1 deletion providers/system_template.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
include Cloudstack::Helper
include Cloudstack::SystemTemplate

use_inline_resources

action :create do
load_current_resource

Expand Down Expand Up @@ -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}"
Expand Down
9 changes: 4 additions & 5 deletions recipes/management_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down