Skip to content

Commit

Permalink
Recipe typo and updated_by_last_action fix-up
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric G. Wolfe committed May 29, 2012
1 parent dde35c2 commit 37e2764
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 15 deletions.
4 changes: 3 additions & 1 deletion providers/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,14 @@ def action_run
action :create
path node['jenkins']['node']['home']
end
new_resource.updated_by_last_action(true)

cli_jar = ::File.join(home, "jenkins-cli.jar")
remote_file cli_jar do
source "#{url}/jnlpJars/jenkins-cli.jar"
not_if { ::File.exists?(cli_jar) }
end
new_resource.updated_by_last_action(true)

java_home = node['jenkins']['java_home'] || (node.has_key?(:java) ? node['java']['jdk_dir'] : nil)
if java_home == nil
Expand All @@ -49,6 +51,6 @@ def action_run
jenkins_execute command do
cwd home
block { |stdout| new_resource.block.call(stdout) } if new_resource.block
new_resource.updated_by_last_action(true)
end
new_resource.updated_by_last_action(true)
end
3 changes: 1 addition & 2 deletions providers/execute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,11 @@ def action_run
status, stdout, stderr = output_of_command(args[:command], args)
if status.exitstatus == 0
new_resource.block.call(stdout) if new_resource.block
new_resource.updated_by_last_action(true)
Chef::Log.info("Ran #{new_resource} successfully")
else
command_output = "JENKINS STDOUT: #{stdout}"
command_output << "JENKINS STDERR: #{stderr}"
handle_command_failures(status, command_output, args)
new_resource.updated_by_last_action(true)
end
new_resource.updated_by_last_action(true)
end
18 changes: 7 additions & 11 deletions recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@
node.set_unless['jenkins']['server']['pubkey'] = sshkey.ssh_public_key

# Save public_key to node, unless it is already set.
unless Chef::Config['solo']
ruby_block "save node data" do
block do
node.save
end
action :create
ruby_block "save node data" do
block do
node.save unless Chef::Config['solo']
end
action :create
end

# Save private key, unless pkey file exists
Expand Down Expand Up @@ -142,7 +140,7 @@
end

loop do
url = URI.parse("#{node.jenkins.server.url}/job/test/config.xml")
url = URI.parse("#{node['jenkins']['server']['url']}/job/test/config.xml")
res = Chef::REST::RESTRequest.new(:GET, url, nil).call
break if res.kind_of?(Net::HTTPSuccess) or res.kind_of?(Net::HTTPNotFound)
Chef::Log.debug "service[jenkins] not responding OK to GET / #{res.inspect}"
Expand Down Expand Up @@ -187,10 +185,8 @@

# Front Jenkins with an HTTP server
case node['jenkins']['http_proxy']['variant']
when "nginx"
include_recipe "jenkins::proxy_nginx"
when "apache2"
include_recipe "jenkins::proxy_apache2"
when "nginx", "apache2"
include_recipe "jenkins::proxy_#{node['jenkins']['http_proxy']['variant']}"
end

if node['jenkins']['iptables_allow'] == "enable"
Expand Down
4 changes: 3 additions & 1 deletion recipes/node_ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
if host == node['fqdn']
host = URI.parse(node['jenkins']['server']['url']).host
end
unless Chef::Config[:solo]
if Chef::Config['solo']
Chef::Log.warn("This recipe uses search. Chef Solo does not support search.")
else
jenkins_node = search(:node, "fqdn:#{host}").first
node.set['jenkins']['server']['pubkey'] = jenkins_node['jenkins']['server']['pubkey']
end
Expand Down

0 comments on commit 37e2764

Please sign in to comment.