Skip to content

Commit

Permalink
add parameter to jenkins::credentials to allow UUID to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
madAndroid committed Feb 6, 2015
1 parent f069b53 commit d773cb9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
11 changes: 7 additions & 4 deletions files/puppet_helper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -130,18 +130,21 @@ class Actions {
/////////////////////////
// create credentials
/////////////////////////
void create_or_update_credentials(String username, String password, String description="", String private_key="") {
void create_or_update_credentials(String username, String password, String id="", String description="", String private_key="") {
def global_domain = Domain.global()
def credentials_store =
Jenkins.instance.getExtensionList(
'com.cloudbees.plugins.credentials.SystemCredentialsProvider'
)[0].getStore()

def credentials
if (id == "") {
id = null
}
if (private_key == "" ) {
credentials = new UsernamePasswordCredentialsImpl(
CredentialsScope.GLOBAL,
null,
id,
description,
username,
password
Expand All @@ -155,7 +158,7 @@ class Actions {
}
credentials = new BasicSSHUserPrivateKey(
CredentialsScope.GLOBAL,
null,
id,
username,
key_source,
password,
Expand Down
3 changes: 3 additions & 0 deletions manifests/credentials.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$description = 'Managed by Puppet',
$private_key_or_path = '',
$ensure = 'present',
$uuid = '',
){
validate_string($ensure)

Expand All @@ -31,12 +32,14 @@
validate_string($password)
validate_string($description)
validate_string($private_key_or_path)
validate_string($uuid)
exec { "create-jenkins-credentials-${title}":
command => join([
$::jenkins::cli_helper::helper_cmd,
'create_or_update_credentials',
$title,
"'${password}'",
"'${uuid}'",
"'${description}'",
"'${private_key_or_path}'",
], ' '),
Expand Down

0 comments on commit d773cb9

Please sign in to comment.