Skip to content

Commit

Permalink
fix trailing whitespace
Browse files Browse the repository at this point in the history
  • Loading branch information
jhoblitt committed May 3, 2015
1 parent 2e8325a commit 9b575b6
Show file tree
Hide file tree
Showing 23 changed files with 62 additions and 81 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,3 @@ matrix:
env: PUPPET_VERSION="~> 3.4.0"
notifications:
email: false

3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This is a manually kept file, and may not entirely reflect reality
* [#150](https://github.com/jenkinsci/puppet-jenkins/pull/150) - Add ensure parameter to jenkins::slave
* [#151](https://github.com/jenkinsci/puppet-jenkins/issues/151) - Unsupported OSFamily RedHat on node
* [#152](https://github.com/jenkinsci/puppet-jenkins/issues/152) - Jenkins-slave on Centos: killproc and checkpid commands not found
* [#153](https://github.com/jenkinsci/puppet-jenkins/pull/153) - Fixes to Jenkins slave init and class
* [#153](https://github.com/jenkinsci/puppet-jenkins/pull/153) - Fixes to Jenkins slave init and class
* [#154](https://github.com/jenkinsci/puppet-jenkins/issues/154) - slave_mode doesn't apply on debian distros.
* [#155](https://github.com/jenkinsci/puppet-jenkins/pull/155) - Add defined check for plugin_parent_dir resource
* [#157](https://github.com/jenkinsci/puppet-jenkins/pull/157) - Add missing slave mode to Debian defaults file
Expand Down Expand Up @@ -74,4 +74,3 @@ This is a manually kept file, and may not entirely reflect reality
package installed to make Debian slave installs functional
* [#126](https://github.com/jenkinsci/puppet-jenkins/issues/126) - Facter
exception bug fixed

1 change: 0 additions & 1 deletion HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,3 @@ Acceptance tests are setup using [Beaker](https://github.com/puppetlabs/beaker),
To run the tests:

* `bundle exec rspec spec/acceptance/`

16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,21 +181,21 @@ security policy are configured in the correct order. For example:
PUPPET_HELPER='<%= jenkins_libdir %>/puppet_helper.groovy'
HELPER="java -jar $JENKINS_CLI -s http://127.0.0.1:8080 groovy $PUPPET_HELPER"
DONEFILE='<%= jenkins_libdir %>/jenkins-bootstrap.done'

ADMIN_PUBKEY="$(cat ${ADMIN_SSH_KEY}.pub)"

# Create the admin user, passing no credentials
$HELPER create_or_update_user "$ADMIN_USER" "$ADMIN_EMAIL" "$ADMIN_PASSWORD" "$ADMIN_FULLNAME" "$ADMIN_PUBKEY"
# Enable security. After this, credentials will be required.
$HELPER set_security full_control

touch $DONEFILE

#### Users

Email and password are required.

Create a `johndoe` user account whose full name is "Managed by Puppet":
Create a `johndoe` user account whose full name is "Managed by Puppet":
```puppet
jenkins::user { 'johndoe':
email => '[email protected]',
Expand Down Expand Up @@ -270,13 +270,13 @@ class { 'jenkins':
```

### Installing from a hosted RPM
Sometimes you don't have an RPM repository available and are not allowed to
directly install from repositories on the Internet. In this case, you can
still install Jenkins with this module by hosting the jenkins RPM file
Sometimes you don't have an RPM repository available and are not allowed to
directly install from repositories on the Internet. In this case, you can
still install Jenkins with this module by hosting the jenkins RPM file
somewhere accessible (http server, S3 bucket, etc.) and tell

```
class { 'jenkins':
direct_download => 'http://myserver/rpms/jenkins-x.xxx-1-1.rpm',
}
```
```
1 change: 0 additions & 1 deletion bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,3 @@ ln -s $PWD /etc/puppet/modules/jenkins

echo ">> Provision for ${platform}"
puppet apply --verbose --modulepath=/etc/puppet/modules tests/${platform}.pp

36 changes: 18 additions & 18 deletions files/jenkins-slave.Debian
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/$NAME ] && . /etc/default/$NAME

DAEMON=/usr/bin/daemon
DAEMON_ARGS="--name=$NAME --inherit --output=$JENKINS_SLAVE_LOG --pidfile=$PIDFILE"
DAEMON_ARGS="--name=$NAME --inherit --output=$JENKINS_SLAVE_LOG --pidfile=$PIDFILE"

SU=/bin/su

Expand Down Expand Up @@ -73,13 +73,13 @@ do_start()
# 2 if daemon could not be started
$DAEMON $DAEMON_ARGS --running && return 1

# If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the
# If the var MAXOPENFILES is enabled in /etc/default/jenkins then set the max open files to the
# proper value
if [ -n "$MAXOPENFILES" ]; then
[ "$VERBOSE" != no ] && echo Setting up max open files limit to $MAXOPENFILES
ulimit -n $MAXOPENFILES
fi

# --user in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,
# so we let su do so for us now
$SU -l $JENKINS_SLAVE_USER --shell=/bin/bash -c "$DAEMON $DAEMON_ARGS -- $JAVA $JAVA_ARGS -jar $JENKINS_SLAVE_JAR $JENKINS_SLAVE_ARGS" || return 2
Expand All @@ -89,16 +89,16 @@ do_start()
#
# Verify that all jenkins processes have been shutdown
# and if not, then do killall for them
#
get_running()
#
get_running()
{
return `ps -U $JENKINS_SLAVE_USER --no-headers -f | egrep -e '(java|daemon)' | grep -c . `
}

force_stop()
force_stop()
{
get_running
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
killall -u $JENKINS_SLAVE_USER java daemon || return 3
fi
}
Expand All @@ -120,9 +120,9 @@ do_stop()
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
get_daemon_status
get_daemon_status
case "$?" in
0)
0)
$DAEMON $DAEMON_ARGS --stop || return 2
# wait for the process to really terminate
for n in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20; do
Expand Down Expand Up @@ -184,30 +184,30 @@ case "$1" in
;;
status)
get_daemon_status
case "$?" in
0)
case "$?" in
0)
echo "$DESC is running with the pid `cat $PIDFILE`"
rc=0
;;
*)
*)
get_running
procs=$?
if [ $procs -eq 0 ]; then
if [ $procs -eq 0 ]; then
echo -n "$DESC is not running"
if [ -f $PIDFILE ]; then
if [ -f $PIDFILE ]; then
echo ", but the pidfile ($PIDFILE) still exists"
rc=1
else
else
echo
rc=3
fi
else

else
echo "$procs instances of jenkins are running at the moment"
echo "but the pidfile $PIDFILE is missing"
rc=0
fi

exit $rc
;;
esac
Expand Down
54 changes: 27 additions & 27 deletions files/puppet_helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
// Copyright 2011 Fletcher Nichol
// Copyright 2013-2014 Chef Software, Inc.
// Copyright 2014 RetailMeNot, Inc.
//
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//
// http://www.apache.org/licenses/LICENSE-2.0
//
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -46,7 +46,7 @@ class Actions {
hudson.security.ACL.SYSTEM,
new SchemeRequirement("ssh")
)

return CredentialsMatchers.firstOrNull(
available_credentials,
username_matcher
Expand All @@ -59,21 +59,21 @@ class Actions {
void create_or_update_user(String user_name, String email, String password="", String full_name="", String public_keys="") {
def user = hudson.model.User.get(user_name)
user.setFullName(full_name)

def email_param = new hudson.tasks.Mailer.UserProperty(email)
user.addProperty(email_param)

def pw_param = hudson.security.HudsonPrivateSecurityRealm.Details.fromPlainPassword(password)
user.addProperty(pw_param)

if ( public_keys != "" ) {
def keys_param = new org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl(public_keys)
user.addProperty(keys_param)
}

user.save()
}

/////////////////////////
// delete user
/////////////////////////
Expand All @@ -83,26 +83,26 @@ class Actions {
user.delete()
}
}

/////////////////////////
// current user
/////////////////////////
void user_info(String user_name) {
def user = hudson.model.User.get(user_name, false)

if(user == null) {
return null
}

def user_id = user.getId()
def name = user.getFullName()

def email_address = null
def emailProperty = user.getProperty(hudson.tasks.Mailer.UserProperty)
if(emailProperty != null) {
email_address = emailProperty.getAddress()
}

def keys = null
def keysProperty = user.getProperty(org.jenkinsci.main.modules.cli.auth.ssh.UserPropertyImpl)
if(keysProperty != null) {
Expand All @@ -114,7 +114,7 @@ class Actions {
if (tokenProperty != null) {
token = tokenProperty.getApiToken()
}

def builder = new groovy.json.JsonBuilder()
builder {
id user_id
Expand All @@ -123,10 +123,10 @@ class Actions {
api_token token
public_keys keys
}

out.println(builder)
}

/////////////////////////
// create credentials
/////////////////////////
Expand All @@ -136,7 +136,7 @@ class Actions {
Jenkins.instance.getExtensionList(
'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)[0].getStore()

def credentials
if (private_key == "" ) {
credentials = new UsernamePasswordCredentialsImpl(
Expand All @@ -162,10 +162,10 @@ class Actions {
description
)
}

// Create or update the credentials in the Jenkins instance
def existing_credentials = credentials_for_username(username)

if(existing_credentials != null) {
credentials_store.updateCredentials(
global_domain,
Expand All @@ -176,13 +176,13 @@ class Actions {
credentials_store.addCredentials(global_domain, credentials)
}
}

//////////////////////////
// delete credentials
//////////////////////////
void delete_credentials(String username) {
def existing_credentials = credentials_for_username(username)

if(existing_credentials != null) {
def global_domain = com.cloudbees.plugins.credentials.domains.Domain.global()
def credentials_store =
Expand All @@ -195,34 +195,34 @@ class Actions {
)
}
}

////////////////////////
// current credentials
////////////////////////
void credential_info(String username) {
def credentials = credentials_for_username(username)

if(credentials == null) {
return null
}

def current_credentials = [
id:credentials.id,
description:credentials.description,
username:credentials.username
]

if ( credentials.hasProperty('password') ) {
current_credentials['password'] = credentials.password.plainText
} else {
current_credentials['private_key'] = credentials.privateKey
current_credentials['passphrase'] = credentials.passphrase.plainText
}

def builder = new groovy.json.JsonBuilder(current_credentials)
out.println(builder)
}

////////////////////////
// set_security
////////////////////////
Expand Down
1 change: 0 additions & 1 deletion lib/puppet/jenkins.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,3 @@ def self.plugins_dir
end
end
end

1 change: 0 additions & 1 deletion manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,3 @@

create_resources( 'jenkins::sysconfig', $::jenkins::config_hash )
}

6 changes: 3 additions & 3 deletions manifests/direct_download.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#
#
# Support for directly downloading a package file - for when no repository
# is available
#
Expand All @@ -21,7 +21,7 @@
# equivalent to basename() - get the filename
$package_file = regsubst($::jenkins::direct_download, '(.*?)([^/]+)$', '\2')
$local_file = "${::jenkins::package_cache_dir}/${package_file}"

validate_absolute_path($local_file)

if $::jenkins::version != 'absent' {
Expand All @@ -32,7 +32,7 @@
before => Package[$::jenkins::package_name],
}
}

package { $::jenkins::package_name:
ensure => $::jenkins::version,
provider => $::jenkins::package_provider,
Expand Down
1 change: 0 additions & 1 deletion manifests/firewall.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@
proto => 'tcp',
}
}

Loading

0 comments on commit 9b575b6

Please sign in to comment.