mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix test autosign_file permissions
This commit is contained in:
parent
5a3fc53f59
commit
c7ee766984
2 changed files with 18 additions and 4 deletions
|
@ -835,6 +835,8 @@ class TestDaemon(object):
|
|||
opts_dict['ext_pillar'].append(
|
||||
{'cmd_yaml': 'cat {0}'.format(os.path.join(FILES, 'ext.yaml'))})
|
||||
|
||||
# all read, only owner write
|
||||
autosign_file_permissions = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR
|
||||
for opts_dict in (master_opts, syndic_master_opts):
|
||||
# We need to copy the extension modules into the new master root_dir or
|
||||
# it will be prefixed by it
|
||||
|
@ -849,10 +851,12 @@ class TestDaemon(object):
|
|||
opts_dict['extension_modules'] = os.path.join(opts_dict['root_dir'], 'extension_modules')
|
||||
|
||||
# Copy the autosign_file to the new master root_dir
|
||||
new_autosign_file_path = os.path.join(opts_dict['root_dir'], 'autosign_file')
|
||||
shutil.copyfile(
|
||||
os.path.join(INTEGRATION_TEST_DIR, 'files', 'autosign_file'),
|
||||
os.path.join(opts_dict['root_dir'], 'autosign_file')
|
||||
new_autosign_file_path
|
||||
)
|
||||
os.chmod(new_autosign_file_path, autosign_file_permissions)
|
||||
|
||||
# Point the config values to the correct temporary paths
|
||||
for name in ('hosts', 'aliases'):
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
from __future__ import absolute_import
|
||||
import os
|
||||
import shutil
|
||||
import stat
|
||||
|
||||
# Import Salt Testing libs
|
||||
from tests.support.case import ShellCase
|
||||
|
@ -15,6 +16,11 @@ from tests.support.paths import TMP, INTEGRATION_TEST_DIR
|
|||
import salt.utils.files
|
||||
|
||||
|
||||
# all read, only owner write
|
||||
autosign_file_permissions = stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IWUSR
|
||||
autosign_file_path = os.path.join(TMP, 'rootdir', 'autosign_file')
|
||||
|
||||
|
||||
class AutosignGrainsTest(ShellCase):
|
||||
'''
|
||||
Test autosigning minions based on grain values.
|
||||
|
@ -23,15 +29,17 @@ class AutosignGrainsTest(ShellCase):
|
|||
def setUp(self):
|
||||
shutil.copyfile(
|
||||
os.path.join(INTEGRATION_TEST_DIR, 'files', 'autosign_grains', 'autosign_file'),
|
||||
os.path.join(TMP, 'rootdir', 'autosign_file')
|
||||
autosign_file_path
|
||||
)
|
||||
os.chmod(autosign_file_path, autosign_file_permissions)
|
||||
|
||||
self.run_key('-d minion -y')
|
||||
self.run_call('test.ping') # get minon to try to authenticate itself again
|
||||
|
||||
if 'minion' in self.run_key('-l acc'):
|
||||
self.skipTest('Could not deauthorize minion')
|
||||
if 'minion' not in self.run_key('-l un'):
|
||||
self.skipTest('minion did not try to authenticate itself')
|
||||
self.skipTest('minion did not try to reauthenticate itself')
|
||||
|
||||
self.autosign_grains_dir = os.path.join(self.master_opts['autosign_grains_dir'])
|
||||
if not os.path.isdir(self.autosign_grains_dir):
|
||||
|
@ -40,8 +48,10 @@ class AutosignGrainsTest(ShellCase):
|
|||
def tearDown(self):
|
||||
shutil.copyfile(
|
||||
os.path.join(INTEGRATION_TEST_DIR, 'files', 'autosign_file'),
|
||||
os.path.join(TMP, 'rootdir', 'autosign_file')
|
||||
autosign_file_path
|
||||
)
|
||||
os.chmod(autosign_file_path, autosign_file_permissions)
|
||||
|
||||
self.run_call('test.ping') # get minon to try to authenticate itself again
|
||||
self.run_key('-a minion -y')
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue