From 7d3f4615bc3c3e7416a0d3ece898216c95e619ec Mon Sep 17 00:00:00 2001 From: Anastasia Kuznetsova Date: Tue, 10 May 2016 17:44:56 +0300 Subject: [PATCH] [Jenkins] Provide valid credentials for JJB in case of LDAP enabled Change-Id: I5151cf5f92fc82223448b8d783f086419f855f3a --- .../package/Resources/ConnectLDAP.template | 2 +- .../{ldap_init.pp => configure_ldap.pp} | 0 .../Resources/scripts/configure_ldap.sh | 9 ++++--- .../scripts/configure_ldap/manifests/init.pp | 27 ++++++++++++++----- 4 files changed, 26 insertions(+), 12 deletions(-) rename murano-apps/Jenkins/package/Resources/scripts/{ldap_init.pp => configure_ldap.pp} (100%) diff --git a/murano-apps/Jenkins/package/Resources/ConnectLDAP.template b/murano-apps/Jenkins/package/Resources/ConnectLDAP.template index cc96099..a4a493c 100644 --- a/murano-apps/Jenkins/package/Resources/ConnectLDAP.template +++ b/murano-apps/Jenkins/package/Resources/ConnectLDAP.template @@ -13,7 +13,7 @@ Scripts: Files: - 'configure_ldap/templates/config.erb' - 'configure_ldap/manifests/init.pp' - - 'ldap_init.pp' + - 'configure_ldap.pp' Options: captureStdout: true captureStderr: true \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/ldap_init.pp b/murano-apps/Jenkins/package/Resources/scripts/configure_ldap.pp similarity index 100% rename from murano-apps/Jenkins/package/Resources/scripts/ldap_init.pp rename to murano-apps/Jenkins/package/Resources/scripts/configure_ldap.pp diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_ldap.sh b/murano-apps/Jenkins/package/Resources/scripts/configure_ldap.sh index ef390a4..9e4c577 100644 --- a/murano-apps/Jenkins/package/Resources/scripts/configure_ldap.sh +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_ldap.sh @@ -1,10 +1,11 @@ #!/bin/bash -mkdir /etc/puppet/modules/configure_ldap -mkdir /etc/puppet/modules/configure_ldap/manifests/ -mkdir /etc/puppet/modules/configure_ldap/templates/ +# No error if already exists. +mkdir -p /etc/puppet/modules/configure_ldap +mkdir -p /etc/puppet/modules/configure_ldap/manifests/ +mkdir -p /etc/puppet/modules/configure_ldap/templates/ cp configure_ldap/manifests/init.pp /etc/puppet/modules/configure_ldap/manifests/ cp configure_ldap/templates/config.erb /etc/puppet/modules/configure_ldap/templates/ -puppet apply ldap_init.pp \ No newline at end of file +puppet apply configure_ldap.pp \ No newline at end of file diff --git a/murano-apps/Jenkins/package/Resources/scripts/configure_ldap/manifests/init.pp b/murano-apps/Jenkins/package/Resources/scripts/configure_ldap/manifests/init.pp index 1bf3fb4..d2c8c58 100644 --- a/murano-apps/Jenkins/package/Resources/scripts/configure_ldap/manifests/init.pp +++ b/murano-apps/Jenkins/package/Resources/scripts/configure_ldap/manifests/init.pp @@ -9,11 +9,24 @@ class configure_ldap ( enable => true, } file { '/var/lib/jenkins/config.xml': - notify => Service['jenkins'], - ensure => present, - owner => 'jenkins', - group => 'jenkins', - mode => '0644', - content => template('configure_ldap/config.erb'), - } + notify => Service['jenkins'], + ensure => present, + owner => 'jenkins', + group => 'jenkins', + mode => '0644', + content => template('configure_ldap/config.erb'), + } + file { '/etc/jenkins_jobs/jenkins_jobs.ini': + ensure => present, + }-> + file_line { 'Provide valid username to jjb config': + path => '/etc/jenkins_jobs/jenkins_jobs.ini', + line => "user=${admin_name}", + match => "^user=gerrig.*$", + }-> + file_line { 'Provide valid password to jjb config': + path => '/etc/jenkins_jobs/jenkins_jobs.ini', + line => "password=${admin_password}", + match => "^password=.*$", + } } \ No newline at end of file