Fixed the interpretation of the file extension.
My initial lack of understanding of "is" and "==". Signed-off-by: Angus Salkeld <asalkeld@redhat.com>
This commit is contained in:
parent
235112febe
commit
18eb501eb0
@ -575,13 +575,13 @@ class SourcesHandler(object):
|
|||||||
def _decompress(self, archive, dest_dir):
|
def _decompress(self, archive, dest_dir):
|
||||||
cmd_str = ''
|
cmd_str = ''
|
||||||
(r, ext) = os.path.splitext(archive)
|
(r, ext) = os.path.splitext(archive)
|
||||||
if ext is 'tar.gz' or ext is 'tgz':
|
if ext == '.tar.gz' or ext == '.tgz':
|
||||||
cmd_str = 'tar -C %s -xzf %s' % (dest_dir, archive)
|
cmd_str = 'tar -C %s -xzf %s' % (dest_dir, archive)
|
||||||
elif ext is 'tar.bz2' or ext is 'tbz2':
|
elif ext == '.tar.bz2' or ext == '.tbz2':
|
||||||
cmd_str = 'tar -C %s -xjf %s' % (dest_dir, archive)
|
cmd_str = 'tar -C %s -xjf %s' % (dest_dir, archive)
|
||||||
elif ext is 'zip':
|
elif ext == '.zip':
|
||||||
cmd_str = 'unzip -d %s %s' % (dest_dir, archive)
|
cmd_str = 'unzip -d %s %s' % (dest_dir, archive)
|
||||||
elif ext is 'tar':
|
elif ext == '.tar':
|
||||||
cmd_str = 'tar -C %s -xf %s' % (dest_dir, archive)
|
cmd_str = 'tar -C %s -xf %s' % (dest_dir, archive)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
@ -140,6 +140,9 @@ class MetadataTest(unittest.TestCase):
|
|||||||
j = ''' {
|
j = ''' {
|
||||||
"AWS::CloudFormation::Init" : {
|
"AWS::CloudFormation::Init" : {
|
||||||
"config" : {
|
"config" : {
|
||||||
|
"sources": {
|
||||||
|
"/home/ec2-user/sample" : "https://s3.amazonaws.com/cloudformation-examples/CloudFormationRailsSample.zip"
|
||||||
|
},
|
||||||
"files" : {
|
"files" : {
|
||||||
"/tmp/_files_test_/epel.repo" : {
|
"/tmp/_files_test_/epel.repo" : {
|
||||||
"source" : "https://raw.github.com/heat-api/heat/master/README.rst",
|
"source" : "https://raw.github.com/heat-api/heat/master/README.rst",
|
||||||
@ -175,6 +178,17 @@ class MetadataTest(unittest.TestCase):
|
|||||||
self.m.StubOutWithMock(os, 'chown')
|
self.m.StubOutWithMock(os, 'chown')
|
||||||
self.m.StubOutWithMock(os, 'chmod')
|
self.m.StubOutWithMock(os, 'chmod')
|
||||||
|
|
||||||
|
subprocess.Popen(['su', 'root', '-c',
|
||||||
|
'wget -O /tmp/CloudFormationRailsSample.zip \
|
||||||
|
https://s3.amazonaws.com/cloudformation-examples/CloudFormationRailsSample.zip'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE).AndReturn(PopenMock())
|
||||||
|
|
||||||
|
subprocess.Popen(['su', 'root', '-c',
|
||||||
|
'unzip -d /home/ec2-user/sample /tmp/CloudFormationRailsSample.zip'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE).AndReturn(PopenMock())
|
||||||
|
|
||||||
subprocess.Popen(['su', 'root', '-c',
|
subprocess.Popen(['su', 'root', '-c',
|
||||||
'wget -O /tmp/_files_test_/epel.repo \
|
'wget -O /tmp/_files_test_/epel.repo \
|
||||||
https://raw.github.com/heat-api/heat/master/README.rst'],
|
https://raw.github.com/heat-api/heat/master/README.rst'],
|
||||||
|
Loading…
Reference in New Issue
Block a user