Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrections to the node_info.groovy script #15

Closed
wants to merge 4 commits into from
Closed
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
5 changes: 4 additions & 1 deletion files/default/node_info.groovy
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/*
#
# Cookbook Name:: jenkins
# Based on hudson
Expand All @@ -20,8 +21,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
*/

import jenkins.slaves.*
import hudson.slaves.*
import hudson.model.*
import jenkins.model.*

def toJSON(node) {
Expand Down
9 changes: 5 additions & 4 deletions libraries/manage_node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def jenkins_node_manage(args)
password = %Q("#{args[:password]}")
end

launcher = %Q(new_ssh_launcher(["#{args[:host]}", #{args[:port]}, "#{args[:username]}", #{password},
"#{args[:private_key]}", "#{args[:jvm_options]}"] as Object[]))
launcher = %Q(new_ssh_launcher(["#{args[:host]}", #{args[:port]}, "#{args[:username]}", #{password},
"#{args[:private_key]}", "#{args[:jvm_options].gsub('\\', '/') }"] as Object[]))
end

remote_fs = args[:remote_fs].gsub('\\', '\\\\\\') # C:\jenkins -> C:\\jenkins
Expand All @@ -112,15 +112,16 @@ def jenkins_node_manage(args)

return <<EOF
import jenkins.model.*
import jenkins.slaves.*
import hudson.model.*
import hudson.slaves.*

app = Jenkins.instance
env = #{env}
props = []

def new_ssh_launcher(args) {
Jenkins.instance.pluginManager.getPlugin("ssh-slaves").classLoader.
loadClass("jenkins.plugins.sshslaves.SSHLauncher").
loadClass("hudson.plugins.sshslaves.SSHLauncher").
getConstructor([String, int, String, String, String, String] as Class[]).newInstance(args)
}

Expand Down
1 change: 1 addition & 0 deletions providers/node.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def action_create
end

cookbook_file "#{node[:jenkins][:node][:home]}/node_info.groovy" do
cookbook "jenkins"
source "node_info.groovy"
end

Expand Down