Remove stalled container.yaml and contet_sets.yml files from target/image
@@ -18,16 +18,23 @@ class OSBSGenerator(Generator):
self._wipe = True
super(OSBSGenerator, self).__init__(descriptor_path, target, builder, overrides, params)
+ # wipe old contianer and content_set config files
+ self._content_set_f = os.path.join(self.target, 'image', 'content_sets.yml')
+ if os.path.exists(self._content_set_f):
+ os.remove(self._content_set_f)
+ self._container_f = os.path.join(self.target, 'image', 'container.yaml')
+ if os.path.exists(self._container_f):
+ os.remove(self._container_f)
+
def _prepare_repository_odcs_pulp(self, repo):
self._prepare_content_set_yaml(repo['odcs']['pulp'])
self._prepate_odcs_container_yaml()
def _prepare_content_set_yaml(self, repo_name):
- content_set_f = os.path.join(self.target, 'image', 'content_sets.yml')
content_set = {}
- if os.path.exists(content_set_f):
- with open(content_set_f, 'r') as _file:
+ if os.path.exists(self._content_set_f):
+ with open(self._content_set_f, 'r') as _file:
content_set = yaml.safe_load(_file)
cur_repos = content_set.get('x86_64', [])
@@ -52,27 +59,26 @@ class OSBSGenerator(Generator):
content_set['ppc64le'] = ppc_repos
- if not os.path.exists(os.path.dirname(content_set_f)):
- os.makedirs(os.path.dirname(content_set_f))
+ if not os.path.exists(os.path.dirname(self._content_set_f)):
+ os.makedirs(os.path.dirname(self._content_set_f))
- with open(content_set_f, 'w') as _file:
- yaml.dump(content_set, _file)
+ with open(self._content_set_f, 'w') as _file:
+ yaml.dump(content_set, _file, default_flow_style=False)
# check the cotnianter.yaml and pulp true
return False
def _prepate_odcs_container_yaml(self):
- container_f = os.path.join(self.target, 'image', 'container.yaml')
container = {}
- if os.path.exists(container_f):
- with open(container_f, 'r') as _file:
+ if os.path.exists(self._container_f):
+ with open(self._container_f, 'r') as _file:
container = yaml.safe_load(_file)
container['compose'] = {'pulp_repos': True}
- with open(container_f, 'w') as _file:
- yaml.dump(container, _file)
+ with open(self._container_f, 'w') as _file:
+ yaml.dump(container, _file, default_flow_style=False)
def _prepare_repository_rpm(self, repo):
# no special handling is needed here, everything is in template
