add windows path and add custom tar

This commit is contained in:
Ch3LL 2016-07-22 17:51:41 -06:00
parent c5035118bf
commit 617f5680e4
3 changed files with 16 additions and 4 deletions

View file

@ -175,7 +175,7 @@ def extracted(name,
.. versionadded:: 2016.3.0
skip_verify:False
skip_verify:False
If ``True``, hash verification of remote file sources (``http://``,
``https://``, ``ftp://``) will be skipped, and the ``source_hash``
argument will be ignored.

Binary file not shown.

View file

@ -16,7 +16,17 @@ import integration
import salt.utils
STATE_DIR = os.path.join(integration.FILES, 'file', 'base')
ARCHIVE_DIR = '/tmp/archive/'
if salt.utils.is_windows():
ARCHIVE_DIR = os.path.join("c:/", "tmp")
else:
ARCHIVE_DIR = '/tmp/archive/'
#local tar file
LOCAL_ARCHIVE_TAR_SOURCE = 'salt://custom.tar.gz'
LOCAL_UNTAR_FILE = os.path.join(ARCHIVE_DIR, 'custom', 'README')
#external sources. Only external sources verify source_hash.
#Therefore need to keep to verify source_hash test
ARCHIVE_TAR_SOURCE = 'https://github.com/downloads/Graylog2/'\
'graylog2-server/graylog2-server-0.9.6p1.tar.gz'
UNTAR_FILE = ARCHIVE_DIR + 'graylog2-server-0.9.6p1/README'
@ -47,15 +57,17 @@ class ArchiveTest(integration.ModuleCase,
test archive.extracted with skip_verify
'''
ret = self.run_state('archive.extracted', name=ARCHIVE_DIR,
source=ARCHIVE_TAR_SOURCE, archive_format='tar',
source=LOCAL_ARCHIVE_TAR_SOURCE, archive_format='tar',
skip_verify=True)
self.assertSaltTrueReturn(ret)
self._check_ext_remove(ARCHIVE_DIR, UNTAR_FILE)
self._check_ext_remove(ARCHIVE_DIR, LOCAL_UNTAR_FILE)
def test_archive_extracted_with_source_hash(self):
'''
test archive.extracted without skip_verify
only external resources work to check to
ensure source_hash is verified correctly
'''
ret = self.run_state('archive.extracted', name=ARCHIVE_DIR,
source=ARCHIVE_TAR_SOURCE, archive_format='tar',