From 9b575b60ec1e6ff9c18081e5336f7e14e977a4b9 Mon Sep 17 00:00:00 2001 From: Joshua Hoblitt Date: Sat, 2 May 2015 17:05:37 -0700 Subject: [PATCH] fix trailing whitespace --- .travis.yml | 1 - CHANGELOG.md | 3 +- HACKING.md | 1 - README.md | 16 +++--- bootstrap.sh | 1 - files/jenkins-slave.Debian | 36 ++++++------- files/puppet_helper.groovy | 54 ++++++++++---------- lib/puppet/jenkins.rb | 1 - manifests/config.pp | 1 - manifests/direct_download.pp | 6 +-- manifests/firewall.pp | 1 - manifests/init.pp | 4 +- manifests/params.pp | 2 - manifests/plugin.pp | 1 - manifests/repo.pp | 1 - manifests/repo/debian.pp | 3 -- manifests/service.pp | 1 - manifests/sysconfig.pp | 1 - spec/classes/jenkins_direct_download_spec.rb | 2 +- spec/classes/jenkins_proxy_spec.rb | 1 - spec/unit/facter/plugins_spec.rb | 1 - spec/unit/jenkins_plugins_spec.rb | 3 +- spec/unit/jenkins_spec.rb | 2 +- 23 files changed, 62 insertions(+), 81 deletions(-) diff --git a/.travis.yml b/.travis.yml index bc23de767..20bcc0a29 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,4 +35,3 @@ matrix: env: PUPPET_VERSION="~> 3.4.0" notifications: email: false - diff --git a/CHANGELOG.md b/CHANGELOG.md index 8e9188a8f..d5e5d4585 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 @@ -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 - diff --git a/HACKING.md b/HACKING.md index b31b54a5f..bad3b9748 100644 --- a/HACKING.md +++ b/HACKING.md @@ -76,4 +76,3 @@ Acceptance tests are setup using [Beaker](https://github.com/puppetlabs/beaker), To run the tests: * `bundle exec rspec spec/acceptance/` - diff --git a/README.md b/README.md index 80a7efd13..4a0604755 100644 --- a/README.md +++ b/README.md @@ -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 => 'jdoe@example.com', @@ -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', } -``` +``` diff --git a/bootstrap.sh b/bootstrap.sh index 6f6d3c6df..f2cfc7a0d 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -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 - diff --git a/files/jenkins-slave.Debian b/files/jenkins-slave.Debian index a0b9985ac..cb691bc88 100755 --- a/files/jenkins-slave.Debian +++ b/files/jenkins-slave.Debian @@ -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 @@ -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 @@ -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 } @@ -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 @@ -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 diff --git a/files/puppet_helper.groovy b/files/puppet_helper.groovy index f17040592..3569c968b 100644 --- a/files/puppet_helper.groovy +++ b/files/puppet_helper.groovy @@ -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. @@ -46,7 +46,7 @@ class Actions { hudson.security.ACL.SYSTEM, new SchemeRequirement("ssh") ) - + return CredentialsMatchers.firstOrNull( available_credentials, username_matcher @@ -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 ///////////////////////// @@ -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) { @@ -114,7 +114,7 @@ class Actions { if (tokenProperty != null) { token = tokenProperty.getApiToken() } - + def builder = new groovy.json.JsonBuilder() builder { id user_id @@ -123,10 +123,10 @@ class Actions { api_token token public_keys keys } - + out.println(builder) } - + ///////////////////////// // create credentials ///////////////////////// @@ -136,7 +136,7 @@ class Actions { Jenkins.instance.getExtensionList( 'com.cloudbees.plugins.credentials.SystemCredentialsProvider' )[0].getStore() - + def credentials if (private_key == "" ) { credentials = new UsernamePasswordCredentialsImpl( @@ -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, @@ -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 = @@ -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 //////////////////////// diff --git a/lib/puppet/jenkins.rb b/lib/puppet/jenkins.rb index 15d692c6f..0b3327c26 100644 --- a/lib/puppet/jenkins.rb +++ b/lib/puppet/jenkins.rb @@ -17,4 +17,3 @@ def self.plugins_dir end end end - diff --git a/manifests/config.pp b/manifests/config.pp index 39b2cb8e6..8de7bad57 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -18,4 +18,3 @@ create_resources( 'jenkins::sysconfig', $::jenkins::config_hash ) } - diff --git a/manifests/direct_download.pp b/manifests/direct_download.pp index 90f6e2f55..b0858dcf1 100644 --- a/manifests/direct_download.pp +++ b/manifests/direct_download.pp @@ -1,4 +1,4 @@ -# +# # Support for directly downloading a package file - for when no repository # is available # @@ -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' { @@ -32,7 +32,7 @@ before => Package[$::jenkins::package_name], } } - + package { $::jenkins::package_name: ensure => $::jenkins::version, provider => $::jenkins::package_provider, diff --git a/manifests/firewall.pp b/manifests/firewall.pp index 024e60e1f..895473f07 100644 --- a/manifests/firewall.pp +++ b/manifests/firewall.pp @@ -15,4 +15,3 @@ proto => 'tcp', } } - diff --git a/manifests/init.pp b/manifests/init.pp index a57cc3e2d..98c70bd31 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -27,7 +27,7 @@ # Optionally override the package name # # direct_download = 'http://...' -# Ignore repostory based package installation and download and install +# Ignore repostory based package installation and download and install # package directly. Leave as `false` (the default) to download using your # OS package manager # @@ -175,7 +175,7 @@ } } include $jenkins_package_class - + include jenkins::config include jenkins::plugins include jenkins::jobs diff --git a/manifests/params.pp b/manifests/params.pp index 68f6ceaa5..11330d69e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -31,5 +31,3 @@ } } } - - diff --git a/manifests/plugin.pp b/manifests/plugin.pp index fa20798a7..e58e51946 100644 --- a/manifests/plugin.pp +++ b/manifests/plugin.pp @@ -163,4 +163,3 @@ } } } - diff --git a/manifests/repo.pp b/manifests/repo.pp index 8ac8d32be..99ec151d2 100644 --- a/manifests/repo.pp +++ b/manifests/repo.pp @@ -40,4 +40,3 @@ } } } - diff --git a/manifests/repo/debian.pp b/manifests/repo/debian.pp index c7860ea23..9e9e47dd2 100644 --- a/manifests/repo/debian.pp +++ b/manifests/repo/debian.pp @@ -34,6 +34,3 @@ Apt::Source['jenkins'] -> anchor { 'jenkins::repo::debian::end': } } - - - diff --git a/manifests/service.pp b/manifests/service.pp index 7007faf71..e3c084691 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -14,4 +14,3 @@ } } - diff --git a/manifests/sysconfig.pp b/manifests/sysconfig.pp index 3c85c56c2..576cc2b17 100644 --- a/manifests/sysconfig.pp +++ b/manifests/sysconfig.pp @@ -17,4 +17,3 @@ } } - diff --git a/spec/classes/jenkins_direct_download_spec.rb b/spec/classes/jenkins_direct_download_spec.rb index 2f0771b57..68d798814 100644 --- a/spec/classes/jenkins_direct_download_spec.rb +++ b/spec/classes/jenkins_direct_download_spec.rb @@ -33,7 +33,7 @@ context 'unsupported provider fails' do let (:params) { { :package_provider => false, :direct_download => 'http://local.space/jenkins.rpm' } } - it do + it do expect { should compile }.to raise_error end end diff --git a/spec/classes/jenkins_proxy_spec.rb b/spec/classes/jenkins_proxy_spec.rb index c1d1c502e..60823454a 100644 --- a/spec/classes/jenkins_proxy_spec.rb +++ b/spec/classes/jenkins_proxy_spec.rb @@ -28,4 +28,3 @@ end end - diff --git a/spec/unit/facter/plugins_spec.rb b/spec/unit/facter/plugins_spec.rb index 4d8b72f78..73840fb29 100644 --- a/spec/unit/facter/plugins_spec.rb +++ b/spec/unit/facter/plugins_spec.rb @@ -72,4 +72,3 @@ end end end - diff --git a/spec/unit/jenkins_plugins_spec.rb b/spec/unit/jenkins_plugins_spec.rb index 65053859d..c33c754dd 100644 --- a/spec/unit/jenkins_plugins_spec.rb +++ b/spec/unit/jenkins_plugins_spec.rb @@ -87,7 +87,7 @@ Plugin-Version: 1.2 Hudson-Version: 1.456 Jenkins-Version: 1.456 -Plugin-Developers: +Plugin-Developers: ' end @@ -186,4 +186,3 @@ "wiki"=>"https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin"} end end - diff --git a/spec/unit/jenkins_spec.rb b/spec/unit/jenkins_spec.rb index 263c52892..c2d199447 100644 --- a/spec/unit/jenkins_spec.rb +++ b/spec/unit/jenkins_spec.rb @@ -20,7 +20,7 @@ File.should_receive(:expand_path).and_return(home) end - it { should eql home } + it { should eql home } end end end