Create the roster even when not running ssh

This commit is contained in:
Daniel A. Wozniak 2019-04-10 17:44:54 +00:00 committed by Pedro Algarvio
parent 11c02a0be3
commit 111c63a4dc
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -390,6 +390,7 @@ class TestDaemon(object):
' * {LIGHT_YELLOW}Starting syndic salt-master ... {ENDC}'.format(**self.colors)
)
sys.stdout.flush()
self.prep_syndic()
self.smaster_process = start_daemon(
daemon_name='salt-smaster',
daemon_id=self.syndic_master_opts['id'],
@ -521,6 +522,15 @@ class TestDaemon(object):
start_tcp_daemons = start_zeromq_daemons
def prep_syndic(self):
'''
Create a roster file for salt's syndic
'''
roster_path = os.path.join(FILES, 'conf/_ssh/roster')
syndic_roster_path = os.path.join(FILES, 'conf/_ssh/syndic_roster')
shutil.copy(roster_path, RUNTIME_VARS.TMP_CONF_DIR)
shutil.copy(syndic_roster_path, os.path.join(RUNTIME_VARS.TMP_SYNDIC_MASTER_CONF_DIR, 'roster'))
def prep_ssh(self):
'''
Generate keys and start an ssh daemon on an alternate port
@ -672,14 +682,8 @@ class TestDaemon(object):
print('sshd had errors on startup: {0}'.format(salt.utils.stringutils.to_str(sshd_err)))
else:
os.environ['SSH_DAEMON_RUNNING'] = 'True'
roster_path = os.path.join(FILES, 'conf/_ssh/roster')
syndic_roster_path = os.path.join(FILES, 'conf/_ssh/syndic_roster')
shutil.copy(roster_path, RUNTIME_VARS.TMP_CONF_DIR)
shutil.copy(syndic_roster_path, os.path.join(RUNTIME_VARS.TMP_SYNDIC_MASTER_CONF_DIR, 'roster'))
with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'roster'), 'a') as roster:
roster.write(' user: {0}\n'.format(RUNTIME_VARS.RUNNING_TESTS_USER))
roster.write(' priv: {0}/{1}'.format(RUNTIME_VARS.TMP_CONF_DIR, 'key_test'))
with salt.utils.files.fopen(os.path.join(RUNTIME_VARS.TMP_SYNDIC_MASTER_CONF_DIR, 'roster'), 'a') as roster:
self.prep_syndic()
with salt.utils.fopen(os.path.join(RUNTIME_VARS.TMP_CONF_DIR, 'roster'), 'a') as roster:
roster.write(' user: {0}\n'.format(RUNTIME_VARS.RUNNING_TESTS_USER))
roster.write(' priv: {0}/{1}'.format(RUNTIME_VARS.TMP_CONF_DIR, 'key_test'))
sys.stdout.write(