Merge "Support resources-dir for hot-packages"

This commit is contained in:
Jenkins 2016-07-05 14:21:09 +00:00 committed by Gerrit Code Review
commit cc74a6658b
3 changed files with 15 additions and 1 deletions

View File

@ -101,10 +101,12 @@ class PackageCreatorTest(base.TestAdditionalAsserts):
args.full_name = 'test.full.name.TestName'
args.tags = 'test, tag, Heat'
args.description = 'Test description'
args.resources_dir = RESOURCES_DIR
args.logo = LOGO
package_dir = hot_package.prepare_package(args)
prepared_files = ['manifest.yaml', 'logo.png', 'template.yaml']
prepared_files = ['manifest.yaml', 'logo.png',
'template.yaml', 'Resources']
self.assertEqual(sorted(prepared_files),
sorted(os.listdir(package_dir)))
shutil.rmtree(package_dir)

View File

@ -81,6 +81,13 @@ def prepare_package(args):
manifest_file = os.path.join(temp_dir, 'manifest.yaml')
template_file = os.path.join(temp_dir, 'template.yaml')
if args.resources_dir:
if not os.path.isdir(args.resources_dir):
raise exceptions.CommandError(
"'--resources-dir' parameter should be a directory")
resource_directory = os.path.join(temp_dir, 'Resources')
shutil.copytree(args.resources_dir, resource_directory)
logo_file = os.path.join(temp_dir, 'logo.png')
if not args.logo:
shutil.copyfile(muranoclient.get_resource('heat_logo.png'), logo_file)

View File

@ -0,0 +1,5 @@
---
fixes:
- Add an ability to use arguments --resources-dir and --template for the
command package-create simultaneously. It allows to create HOT-packages
with Resources folder.