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

Master / Slave terminology change #1109

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
8 changes: 4 additions & 4 deletions NATIVE_TYPES_AND_PROVIDERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ the module.**
* [`jenkins_job`](#jenkins_job)
* [`jenkins_num_executors`](#jenkins_num_executors)
* [`jenkins_security_realm`](#jenkins_security_realm)
* [`jenkins_slaveagent_port`](#jenkins_slaveagent_port)
* [`jenkins_agent_port`](#jenkins_agent_port)
* [`jenkins_user`](#jenkins_user)
3. [TODO](#todo)

Expand Down Expand Up @@ -109,7 +109,7 @@ puppet resource --modulepath=/tmp/vagrant-puppet/modules-998ea1817cb4dea9c136a57
```

All providers presently require `java`, the jenkins CLI jar, and the jenkins
master service to be running. Most require the presence of
controller service to be running. Most require the presence of
`puppet_helper.groovy`. The following puppet code snippet will prepare a node
sufficiently for all providers to function.

Expand Down Expand Up @@ -492,10 +492,10 @@ jenkins_security_realm { 'hudson.security.PAMSecurityRealm':
}
```

### `jenkins_slaveagent_port`
### `jenkins_agent_port`

```
jenkins_slaveagent_port { 44444: # name is coerced to Integer
jenkins_agent_port { 44444: # name is coerced to Integer
ensure => 'present', # present is the only allowed value
}
```
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,24 @@ parameters will have no effect on the plugin retrieval URL.
Dependencies are not automatically installed. You need to manually determine the plugin dependencies and include those as well. The Jenkins wiki is a good place to do this. For example: The Git plugin page is at https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin.

### Slaves
You can automatically add slaves to jenkins, and have them auto register themselves. Most options are actually optional, as nodes will auto-discover the master, and connect.
You can automatically add agents to jenkins, and have them auto register themselves. Most options are actually optional, as nodes will auto-discover the controller, and connect.

Full documentation for the slave code is in jenkins::slave.
Full documentation for the agent code is in jenkins::agent.

It requires the swarm plugin on the master & the class jenkins::slave on the slaves, as below:
It requires the swarm plugin on the controller & the class jenkins::agent on the agents, as below:

```puppet
node /jenkins-slave.*/ {
class { 'jenkins::slave':
masterurl => 'http://jenkins-master1.domain.com:8080',
node /jenkins-agent.*/ {
class { 'jenkins::agent':
controllerurl => 'http://jenkins-controller1.domain.com:8080',
ui_user => 'adminuser',
ui_pass => 'adminpass',
}
}

node /jenkins-master.*/ {
node /jenkins-controller.*/ {
include jenkins
include jenkins::master
include jenkins::controller
}
```

Expand Down
8 changes: 4 additions & 4 deletions files/puppet_helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -1003,24 +1003,24 @@ class Actions {
}

////////////////////////
// get_slaveagent_port
// get_agent_port
////////////////////////
/*
* Print the port number of the slave agent
*/
void get_slaveagent_port() {
void get_agent_port() {
def j = Jenkins.getInstance()
def n = j.getSlaveAgentPort()
out.println(n)
}

////////////////////////
// set_slaveagent_port
// set_agent_port
////////////////////////
/*
* Set the portnumber of the slave agent
*/
void set_slaveagent_port(String n) {
void set_agent_port(String n) {
def j = Jenkins.getInstance()
j.setSlaveAgentPort(n.toInteger())
j.save()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
require File.join(File.dirname(__FILE__), '../../..', 'puppet/x/jenkins/util')
require File.join(File.dirname(__FILE__), '../../..', 'puppet/x/jenkins/provider/cli')

Puppet::Type.type(:jenkins_slaveagent_port).provide(:cli, parent: Puppet::X::Jenkins::Provider::Cli) do
Puppet::Type.type(:jenkins_agent_port).provide(:cli, parent: Puppet::X::Jenkins::Provider::Cli) do
mk_resource_methods

def self.instances(catalog = nil)
n = get_slaveagent_port(catalog)
n = get_agent_port(catalog)

# there can be only one value
Puppet.debug("#{sname} instances: #{n}")
Expand All @@ -18,20 +18,20 @@ def self.instances(catalog = nil)
def flush
case self.ensure
when :present
set_slaveagent_port
set_agent_port
else
raise Puppet::Error, "invalid :ensure value: #{self.ensure}"
end
end

private

def self.get_slaveagent_port(catalog = nil)
clihelper(['get_slaveagent_port'], catalog: catalog).to_i
def self.get_agent_port(catalog = nil)
clihelper(['get_agent_port'], catalog: catalog).to_i
end
private_class_method :get_slaveagent_port
private_class_method :get_agent_port

def set_slaveagent_port
clihelper(['set_slaveagent_port', name])
def set_agent_port
clihelper(['set_agent_port', name])
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

require_relative '../../puppet/x/jenkins/type/cli'

Puppet::X::Jenkins::Type::Cli.newtype(:jenkins_slaveagent_port) do
@doc = "Manage Jenkins' slave agent listening port"
Puppet::X::Jenkins::Type::Cli.newtype(:jenkins_agent_port) do
@doc = "Manage Jenkins' agent listening port"

# the cli jar does not have an interface for plugin removal so the only
# allowed ensure value is :present
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/x/jenkins/type/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Puppet::X::Jenkins::Type::Cli
def self.newtype(*args, &block)
type = Puppet::Type.newtype(*args, &block)

# The jenkins master needs to be avaiable in order to interact with it via
# The jenkins controller needs to be avaiable in order to interact with it via
# the cli jar.
type.autorequire(:service) do
['jenkins']
Expand Down
Loading
Loading