def setUp(self):
super(HookApplyConfigTest, self).setUp()
self.hook_path = self.relative_path(
__file__,
'..',
'heat-config-apply-config/install.d/hook-apply-config.py')
self.metadata_dir = self.useFixture(fixtures.TempDir())
self.templates_dir = self.useFixture(fixtures.TempDir())
tmp_dir = tempfile.NamedTemporaryFile(mode='w', delete=False).name
os.unlink(tmp_dir)
self.tmp_file = os.path.basename(tmp_dir)
self.out_dir = self.templates_dir.join('tmp')
self.metadata = self.metadata_dir.join(self.tmp_file)
self.env = os.environ.copy()
self.env.update({
'OS_CONFIG_FILES': self.metadata,
'OS_CONFIG_APPLIER_TEMPLATES': self.templates_dir.join(),
})
# our fake metadata file
with open(self.metadata, "w+") as md:
md.write(json.dumps({'foo': 'bar'}))
# This is our fake template root we use to verify os-apply-config
# works as expected
os.mkdir(self.out_dir)
with open(os.path.join(self.out_dir, self.tmp_file), "w+") as template:
template.write("foo={{foo}}")
评论列表
文章目录