Support resources-dir for hot-packages

Change-Id: Ic9613f22664952cecdcbcdae97a51909876b9239
Closes-Bug: #1587526
This commit is contained in:
Tetiana Lashchova 2016-05-31 18:19:03 +03:00
parent 5eb90b3fa7
commit 0b767a2b18
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

@ -82,6 +82,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.