Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
osc-plugins
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mpcdf
obs
osc-plugins
Commits
5a5fc9a7
Commit
5a5fc9a7
authored
Apr 01, 2020
by
Lorenz Huedepohl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
New command 'mpcdf_copy_attributes'
parent
4a6a1ab3
Pipeline
#71924
passed with stage
in 15 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
0 deletions
+42
-0
mpcdf_copy_attributes.py
mpcdf_copy_attributes.py
+42
-0
No files found.
mpcdf_copy_attributes.py
0 → 100644
View file @
5a5fc9a7
#!/usr/bin/python2
from
__future__
import
print_function
import
mpcdf_common
import
osc
import
osc.conf
import
osc.core
import
osc.cmdln
@
osc
.
cmdln
.
option
(
'-t'
,
'--to-apiurl'
,
metavar
=
'URL'
,
help
=
'URL of destination api server. Default is the source api server.'
)
@
osc
.
cmdln
.
alias
(
"mpcdf_copy_attrs"
)
def
do_mpcdf_copy_attributes
(
self
,
subcmd
,
opts
,
*
args
):
"""${cmd_name}: Copy attributes from one package to another
Usage:
osc mpcdf_copy_attributes SOURCE_PROJECT SOURCE_PACKAGE DEST_PROJECT DEST_PACKAGE
${cmd_option_list}
"""
if
len
(
args
)
!=
4
:
raise
osc
.
oscerr
.
WrongArgs
(
'Wrong number of arguments'
)
else
:
src_project
,
src_package
,
dst_project
,
dst_package
=
args
src_api
=
self
.
get_api_url
()
if
opts
.
to_apiurl
:
dst_api
=
osc
.
conf
.
config
[
'apiurl_aliases'
].
get
(
opts
.
to_apiurl
,
opts
.
to_apiurl
)
else
:
dst_api
=
src_api
for
attribute
in
mpcdf_common
.
package_attributes
+
mpcdf_common
.
config_attributes
:
try
:
attr
=
mpcdf_common
.
get_attribute
(
src_api
,
src_project
,
src_package
,
attribute
)
except
mpcdf_common
.
UnsetAttributeException
:
if
mpcdf_common
.
has_attribute
(
dst_api
,
dst_project
,
dst_package
,
attribute
):
mpcdf_common
.
remove_attribute
(
dst_api
,
dst_project
,
dst_package
,
attribute
)
continue
mpcdf_common
.
set_attribute
(
dst_api
,
dst_project
,
dst_package
,
attr
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment