diff options
Diffstat (limited to 'vnfsdk_pkgtools/packager/manifest.py')
-rw-r--r-- | vnfsdk_pkgtools/packager/manifest.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/vnfsdk_pkgtools/packager/manifest.py b/vnfsdk_pkgtools/packager/manifest.py index a2d9d70..d819a70 100644 --- a/vnfsdk_pkgtools/packager/manifest.py +++ b/vnfsdk_pkgtools/packager/manifest.py @@ -15,6 +15,7 @@ from collections import namedtuple import os +import tempfile import udatetime @@ -158,7 +159,13 @@ class Manifest(object): ret += "Hash: %s\n" % digest[1] return ret - def update_to_file(self): + def update_to_file(self, temporary=False): content = self.return_as_string() - with open(os.path.join(self.root, self.path), 'w') as fp: + if temporary: + abs_path = tempfile.mktemp() + else: + abs_path = os.path.abspath(os.path.join(self.root, self.path)) + + with open(abs_path, 'w') as fp: fp.write(content) + return abs_path |