summaryrefslogtreecommitdiff
path: root/obsapi/repoflags.py
diff options
context:
space:
mode:
Diffstat (limited to 'obsapi/repoflags.py')
-rw-r--r--obsapi/repoflags.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/obsapi/repoflags.py b/obsapi/repoflags.py
index 062f0e3..61ddbbe 100644
--- a/obsapi/repoflags.py
+++ b/obsapi/repoflags.py
@@ -54,10 +54,14 @@ class RepoFlags():
self.root = element
return
- # If flag_type is not set, set it to the root element tag
- flag_type = self.root.tag
- if flag_type in valid_flag_types:
+ # element matching flag_type not found in xml, create new element
+ self.root = etree.Element(self.flag_type)
return
+ else:
+ # If flag_type is not set, set it to the root element tag
+ flag_type = self.root.tag
+ if flag_type in valid_flag_types:
+ return
# if root element is not a valid repo flag type, search for the
# first element that is a valid flag type and use it.