mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
parent
02c1bfaa3e
commit
b6e259c21e
1 changed files with 37 additions and 0 deletions
|
@ -276,6 +276,43 @@ class CallTest(integration.ShellCase, integration.ShellCaseCommonTestsMixIn):
|
|||
if os.path.isdir(config_dir):
|
||||
shutil.rmtree(config_dir)
|
||||
|
||||
def test_issue_14979_output_file_permissions(self):
|
||||
output_file = os.path.join(integration.TMP, 'issue-14979')
|
||||
current_umask = os.umask(0077)
|
||||
try:
|
||||
# Let's create an initial output file with some data
|
||||
self.run_script(
|
||||
'salt-call',
|
||||
'-c {0} --output-file={1} -g'.format(
|
||||
self.get_config_dir(),
|
||||
output_file
|
||||
),
|
||||
catch_stderr=True,
|
||||
with_retcode=True
|
||||
)
|
||||
stat1 = os.stat(output_file)
|
||||
|
||||
# Let's change umask
|
||||
os.umask(0777)
|
||||
|
||||
self.run_script(
|
||||
'salt-call',
|
||||
'-c {0} --output-file={1} -g'.format(
|
||||
self.get_config_dir(),
|
||||
output_file
|
||||
),
|
||||
catch_stderr=True,
|
||||
with_retcode=True
|
||||
)
|
||||
stat2 = os.stat(output_file)
|
||||
self.assertEqual(stat1.st_mode, stat2.st_mode)
|
||||
self.assertEqual(stat1.st_ctime, stat2.st_ctime)
|
||||
finally:
|
||||
if os.path.exists(output_file):
|
||||
os.unlink(output_file)
|
||||
# Restore umask
|
||||
os.umask(current_umask)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
|
|
Loading…
Add table
Reference in a new issue