Re-add the ability to set username on zuul-executor
Sometimes we need to log in to a nodepool node using a username of something other than zuul. This used to be possible by setting that [launcher] username= property. Re-enable it with the [executor] default_username= property. default_username is used instead of simply username as it is likely in future this information will be able to be supplied by nodepool or other in a node or image specific way. At which time that information will be used in priority to the default specified in zuul. Change-Id: Icf657b4f0bbe34e182307b9eea0cd64a8d813464
This commit is contained in:
parent
93db6a8c75
commit
f12b1d317a
|
@ -18,6 +18,9 @@ git_dir=/var/lib/zuul/git
|
|||
;git_user_name=zuul
|
||||
zuul_url=http://zuul.example.com/p
|
||||
|
||||
[executor]
|
||||
default_username=zuul
|
||||
|
||||
[webapp]
|
||||
listen_address=0.0.0.0
|
||||
port=8001
|
||||
|
|
|
@ -239,6 +239,12 @@ class ExecutorServer(object):
|
|||
else:
|
||||
self.merge_root = '/var/lib/zuul/executor-git'
|
||||
|
||||
if self.config.has_option('executor', 'default_username'):
|
||||
self.default_username = self.config.get('executor',
|
||||
'default_username')
|
||||
else:
|
||||
self.default_username = 'zuul'
|
||||
|
||||
if self.config.has_option('merger', 'git_user_email'):
|
||||
self.merge_email = self.config.get('merger', 'git_user_email')
|
||||
else:
|
||||
|
@ -672,6 +678,7 @@ class AnsibleJob(object):
|
|||
ip = node.get('interface_ip')
|
||||
host_vars = dict(
|
||||
ansible_host=ip,
|
||||
ansible_user=self.executor_server.default_username,
|
||||
nodepool_az=node.get('az'),
|
||||
nodepool_provider=node.get('provider'),
|
||||
nodepool_region=node.get('region'))
|
||||
|
|
Loading…
Reference in New Issue