Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
osc-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpcdf
obs
osc-plugins
Commits
e4626e29
Commit
e4626e29
authored
7 years ago
by
Lorenz Huedepohl
Browse files
Options
Downloads
Patches
Plain Diff
Specialed Exception class for unset attribute
parent
1af833c9
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
mpcdf_common.py
+5
-1
5 additions, 1 deletion
mpcdf_common.py
mpcdf_sync_projects.py
+3
-1
3 additions, 1 deletion
mpcdf_sync_projects.py
with
8 additions
and
2 deletions
mpcdf_common.py
+
5
−
1
View file @
e4626e29
...
...
@@ -33,6 +33,10 @@ def project_meta(api_url, project):
return
ElementTree
.
fromstringlist
(
osc
.
core
.
show_project_meta
(
api_url
,
project
))
class
UnsetAttributeException
(
Exception
):
pass
def
get_attribute
(
api_url
,
project
,
package
,
attribute
,
with_project
=
False
):
attribute_meta
=
osc
.
core
.
show_attribute_meta
(
api_url
,
project
,
package
,
None
,
attribute
,
False
,
with_project
)
if
attribute_meta
is
None
:
...
...
@@ -43,7 +47,7 @@ def get_attribute(api_url, project, package, attribute, with_project=False):
if
attribute
is
not
None
:
return
root
else
:
raise
Exception
(
"
Attribute not set
"
)
raise
UnsetAttribute
Exception
(
"
Attribute not set
"
)
def
get_attribute_values
(
api_url
,
project
,
package
,
attribute
,
with_project
=
False
):
...
...
This diff is collapsed.
Click to expand it.
mpcdf_sync_projects.py
+
3
−
1
View file @
e4626e29
...
...
@@ -76,7 +76,9 @@ def do_mpcdf_sync_projects(self, subcmd, opts, *args):
for
attribute
in
package_attributes
:
try
:
attr
=
mpcdf_common
.
get_attribute
(
api_url
,
from_project
,
orig_package
,
attribute
)
except
Exception
:
except
mpcdf_common
.
UnsetAttributeException
:
if
mpcdf_common
.
has_attribute
(
api_url
,
to_project
,
orig_package
,
attribute
):
mpcdf_common
.
remove_attribute
(
api_url
,
to_project
,
orig_package
,
attribute
)
continue
mpcdf_common
.
set_attribute
(
api_url
,
to_project
,
orig_package
,
attr
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment