Fix copying file before checking it exists in hot package.

Hot Package does shutil.copy before checking that the file
exists, which causes an IOError to be thrown.

Change-Id: I11bbb468f53253107ff84e5c8e0d340d6102c4bf
Closes-Bug: #1628688
This commit is contained in:
Felipe Monteiro 2016-09-28 17:45:37 -04:00
parent a8800d9b14
commit d8ab7d8897

View File

@ -77,11 +77,12 @@ class HotPackage(package_base.PackageBase):
def _translate_class(self):
template_file = os.path.join(self._source_directory, 'template.yaml')
shutil.copy(template_file, self.get_resource(self.full_name))
if not os.path.isfile(template_file):
raise exceptions.PackageClassLoadError(
self.full_name, 'File with class definition not found')
shutil.copy(template_file, self.get_resource(self.full_name))
with open(template_file) as stream:
hot = yaml.safe_load(stream)
if 'resources' not in hot: