From 0b767a2b1883388ac7be287a07558ecd3444b952 Mon Sep 17 00:00:00 2001 From: Tetiana Lashchova Date: Tue, 31 May 2016 18:19:03 +0300 Subject: [PATCH] Support resources-dir for hot-packages Change-Id: Ic9613f22664952cecdcbcdae97a51909876b9239 Closes-Bug: #1587526 --- muranoclient/tests/unit/test_package_creator.py | 4 +++- muranoclient/v1/package_creator/hot_package.py | 7 +++++++ .../notes/resources-dir-for-hot-c557c1472bbc79fa.yaml | 5 +++++ 3 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 releasenotes/notes/resources-dir-for-hot-c557c1472bbc79fa.yaml diff --git a/muranoclient/tests/unit/test_package_creator.py b/muranoclient/tests/unit/test_package_creator.py index 01655b51..52271357 100644 --- a/muranoclient/tests/unit/test_package_creator.py +++ b/muranoclient/tests/unit/test_package_creator.py @@ -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) diff --git a/muranoclient/v1/package_creator/hot_package.py b/muranoclient/v1/package_creator/hot_package.py index 45e8350c..21e3551d 100644 --- a/muranoclient/v1/package_creator/hot_package.py +++ b/muranoclient/v1/package_creator/hot_package.py @@ -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) diff --git a/releasenotes/notes/resources-dir-for-hot-c557c1472bbc79fa.yaml b/releasenotes/notes/resources-dir-for-hot-c557c1472bbc79fa.yaml new file mode 100644 index 00000000..00c21b9d --- /dev/null +++ b/releasenotes/notes/resources-dir-for-hot-c557c1472bbc79fa.yaml @@ -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.