Skip to content

Commit

Permalink
offline the slave after it's been set up
Browse files Browse the repository at this point in the history
RHOSINFRA-2945
  • Loading branch information
wznoinsk committed Jan 30, 2020
1 parent ac0068b commit 3b790e6
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion devnest/lib/jenkins.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,30 @@ def create_update_node_from_xml(self, xml_path, directory=False):
baseurl = '%s/computer/%s' % (self.jenkins.baseurl, slave_name)

config_str = ElementTree.tostring(slave_xml.getroot())
offlineMessage = 'devnest_making_slave_offline_after_setup'

LOG.info('Node config: %s using file: %s' % (slave_name, s_xml_path))

try:
self.jenkins.requester.post_and_confirm_status("%s/config.xml"
% baseurl,
data=config_str)

LOG.info("Take the slave offline after it's been set up")
self.jenkins.requester.post_and_confirm_status("%s/doDisconnect"
% baseurl, data={'offlineMessage': offlineMessage})

except JenkinsAPIException:
LOG.debug('Node %s not found, adding new' % slave_name)
self.jenkins.create_node(slave_name, labels='provisioning_node')
self.jenkins.create_node(slave_name, labels='devnest_creating_a_new_slave')
self.jenkins.requester.post_and_confirm_status("%s/config.xml"
% baseurl,
data=config_str)

LOG.info("Take the slave offline after it's been set up")
self.jenkins.requester.post_and_confirm_status("%s/doDisconnect"
% baseurl, data={'offlineMessage': offlineMessage})

LOG.info('Node %s updated' % slave_name)

def get_jenkins_username(self):
Expand Down

0 comments on commit 3b790e6

Please sign in to comment.