def _decompress(self, archive, dest_dir):
cmd_str = ''
(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)
- 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)
- elif ext is 'zip':
+ elif ext == '.zip':
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)
else:
pass
j = ''' {
"AWS::CloudFormation::Init" : {
"config" : {
+ "sources": {
+ "/home/ec2-user/sample" : "https://s3.amazonaws.com/cloudformation-examples/CloudFormationRailsSample.zip"
+ },
"files" : {
"/tmp/_files_test_/epel.repo" : {
"source" : "https://raw.github.com/heat-api/heat/master/README.rst",
self.m.StubOutWithMock(os, 'chown')
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',
'wget -O /tmp/_files_test_/epel.repo \
https://raw.github.com/heat-api/heat/master/README.rst'],