mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Merge pull request #50906 from garethgreenaway/50892_archive_extracted_source_hash_case_sensitive
[2018.3] Ensure source_hash returned from get_source_sum is lowercase.
This commit is contained in:
commit
f4e6b88ae4
2 changed files with 15 additions and 0 deletions
|
@ -793,6 +793,7 @@ def get_source_sum(file_name='',
|
|||
ret = extract_hash(hash_fn, '', file_name, source, source_hash_name)
|
||||
if ret is None:
|
||||
_invalid_source_hash_format()
|
||||
ret['hsum'] = ret['hsum'].lower()
|
||||
return ret
|
||||
else:
|
||||
# The source_hash is a hash expression
|
||||
|
@ -836,6 +837,7 @@ def get_source_sum(file_name='',
|
|||
)
|
||||
)
|
||||
|
||||
ret['hsum'] = ret['hsum'].lower()
|
||||
return ret
|
||||
|
||||
|
||||
|
|
|
@ -31,6 +31,7 @@ ARCHIVE_LOCAL_TAR_SOURCE = 'file://{0}'.format(os.path.join(FILES, 'file', 'base
|
|||
UNTAR_FILE = os.path.join(ARCHIVE_DIR, 'custom/README')
|
||||
ARCHIVE_TAR_HASH = 'md5=7643861ac07c30fe7d2310e9f25ca514'
|
||||
ARCHIVE_TAR_BAD_HASH = 'md5=d41d8cd98f00b204e9800998ecf8427e'
|
||||
ARCHIVE_TAR_HASH_UPPER = 'md5=7643861AC07C30FE7D2310E9F25CA514'
|
||||
|
||||
|
||||
class ArchiveTest(ModuleCase, SaltReturnAssertsMixin):
|
||||
|
@ -232,6 +233,18 @@ class ArchiveTest(ModuleCase, SaltReturnAssertsMixin):
|
|||
|
||||
self.assertSaltFalseReturn(ret)
|
||||
|
||||
def test_local_archive_extracted_with_uppercase_source_hash(self):
|
||||
'''
|
||||
test archive.extracted with local file and bad hash
|
||||
'''
|
||||
ret = self.run_state('archive.extracted', name=ARCHIVE_DIR,
|
||||
source=ARCHIVE_LOCAL_TAR_SOURCE, archive_format='tar',
|
||||
source_hash=ARCHIVE_TAR_HASH_UPPER)
|
||||
|
||||
self.assertSaltTrueReturn(ret)
|
||||
|
||||
self._check_extracted(UNTAR_FILE)
|
||||
|
||||
def test_archive_extracted_with_non_base_saltenv(self):
|
||||
'''
|
||||
test archive.extracted with a saltenv other than `base`
|
||||
|
|
Loading…
Add table
Reference in a new issue