[Nodepool] Calls of setHieraValue replaced to putHieraData

Better style, faster, prevent printing ssh private key  to
deployment log

Change-Id: I85b691ed1abbf45f703a24f66cd0f82e46361802
This commit is contained in:
Alexey Khivin 2016-06-29 17:58:14 +03:00
parent 4cc23637de
commit 1fbf5627e1

View File

@ -64,9 +64,6 @@ Methods:
- $.jenkins.configureGearmanPlugin($.detectPrimaryIP($.zuul.instance))
- $._environment.reporter.report($this, 'Gearman plugin is configured.')
- $credentialsId: $.jenkins.configureCredentials()
- $.instance.setHieraValue('jenkins_credentials_id', $credentialsId)
- $._environment.reporter.report($this, 'Waiting while Zuul is being deployed...')
- $.zuul.deploy()
- $._environment.reporter.report($this, 'Loading configuration data for nodepool...')
@ -84,31 +81,11 @@ Methods:
createConfiguration:
Body:
- $jenkinsKey: $.jenkins.instance.getHieraValue('jenkins_ssh_private_key_contents')
- $.instance.setHieraValue(
'nodepool_ssh_private_key',
$jenkinsKey
)
- $jenkinsPubKey: $.jenkins.instance.getHieraValue('jenkins_ssh_pubkey_contents')
# Extract only the key itself without 'ssh-rsa' and 'username@fqdn'.
- $jenkinsPubKey: $jenkinsPubKey.split(' ')[1]
- $.instance.setHieraValue('nodepool_ssh_pubkey', $jenkinsPubKey)
- $.instance.setHieraValue('nodepool_mysql_password', 'nodepool')
- $.instance.setHieraValue('nodepool_mysql_root_password', 'root')
- $.instance.setHieraValue('jenkins_api_user', $.jenkins.ldap.ldapRootUser)
- $.instance.setHieraValue('zuul_host', $.detectPrimaryIP($.zuul.instance))
- $.instance.setHieraValue('os_auth_url', $.authUrl)
- $.instance.setHieraValue('os_tenant_name', $.tenant)
- $.instance.setHieraValue('os_username', $.username)
- $.instance.setHieraValue('os_password', $.password)
- $jenkinsHost: $.detectPrimaryIP($.jenkins.instance)
- $.instance.setHieraValue('jenkins_host', $jenkinsHost)
- $netInfo: $._environment.defaultNetworks.environment.describe()
- $.instance.setHieraValue('nodepool_network_uuid', $netInfo.netId)
# Command to retrieve Jenkins API Token.
- $linux: new(conf:Linux)
@ -119,7 +96,25 @@ Methods:
"%JENKINS_HOST%": $jenkinsHost
- $script: $resource.string('get_api_token.sh').replace($replacements)
- $apiKey: $linux.runCommand($.instance.agent, $script).stdout
- $.instance.setHieraValue('jenkins_api_key', $apiKey)
- $credentialsId: $.jenkins.configureCredentials()
- $config:
jenkins_api_key: $apiKey
jenkins_api_user: $.jenkins.ldap.ldapRootUser
jenkins_credentials_id: $credentialsId
jenkins_host: $jenkinsHost
nodepool_mysql_password: 'nodepool'
nodepool_mysql_root_password: 'root'
nodepool_network_uuid: $netInfo.netId
nodepool_ssh_private_key: $jenkinsKey
nodepool_ssh_pubkey: $jenkinsPubKey
os_auth_url: $.authUrl
os_password: $.password
os_tenant_name: $.tenant
os_username: $.username
zuul_host: $.detectPrimaryIP($.zuul.instance)
- $.instance.putHieraData($config)
detectPrimaryIP:
Arguments: