mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-02 17:56:15 +01:00
- add "maintenancerequests" command to request a maintenance incident from maintenance team
This commit is contained in:
parent
402ce3a626
commit
87b060e9a3
3
NEWS
3
NEWS
@ -14,7 +14,7 @@
|
|||||||
(For example for doing a version update without creating a _service file: osc service lr update_source)
|
(For example for doing a version update without creating a _service file: osc service lr update_source)
|
||||||
- protect rebuild and abortbuild commands with required "--all" option to mass failures by accident (similar to wipebinaries)
|
- protect rebuild and abortbuild commands with required "--all" option to mass failures by accident (similar to wipebinaries)
|
||||||
#
|
#
|
||||||
# Features which requires OBS 2.2
|
# Features which requires OBS 2.3
|
||||||
#
|
#
|
||||||
- "my requests" is doing faster and complete server side lookup now if available
|
- "my requests" is doing faster and complete server side lookup now if available
|
||||||
- "review" command has been extended to handle reviews by project or by package maintainers
|
- "review" command has been extended to handle reviews by project or by package maintainers
|
||||||
@ -22,6 +22,7 @@
|
|||||||
- support project wide source services
|
- support project wide source services
|
||||||
- support for armv7hl architecuture. used to denote armv7 + hardfloat binaries
|
- support for armv7hl architecuture. used to denote armv7 + hardfloat binaries
|
||||||
- add force option to accept requests in review state.
|
- add force option to accept requests in review state.
|
||||||
|
- add "maintenancerequests" command to request a maintenance incident from maintenance team
|
||||||
|
|
||||||
0.130
|
0.130
|
||||||
- new "revert" command to restore the original working copy file (without
|
- new "revert" command to restore the original working copy file (without
|
||||||
|
@ -2330,6 +2330,70 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
print r
|
print r
|
||||||
|
|
||||||
|
|
||||||
|
@cmdln.option('-a', '--attribute', metavar='ATTRIBUTE',
|
||||||
|
help='Use this attribute to find default maintenance project (default is OBS:Maintenance)')
|
||||||
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
|
help='specify message TEXT')
|
||||||
|
def do_maintenancerequest(self, subcmd, opts, *args):
|
||||||
|
"""${cmd_name}: Create a request for starting a maintenance incident.
|
||||||
|
|
||||||
|
[See http://doc.opensuse.org/products/draft/OBS/obs-reference-guide/cha.obs.maintenance_setup.html
|
||||||
|
for information on this topic.]
|
||||||
|
|
||||||
|
This command is asking the maintence team to start a maintence incident based on a
|
||||||
|
created maintenance update. Please see the "mbranch" command on how to create such a project and
|
||||||
|
the "patchinfo" command how add the required maintenance update informations.
|
||||||
|
|
||||||
|
usage:
|
||||||
|
osc maintenancerequest [ SOURCEPROJECT [ TARGETPROJECT ] ]
|
||||||
|
${cmd_option_list}
|
||||||
|
"""
|
||||||
|
|
||||||
|
args = slash_split(args)
|
||||||
|
apiurl = self.get_api_url()
|
||||||
|
attribute = "OBS:Maintenance" # default attribute as defined in api code.
|
||||||
|
if opts.attribute:
|
||||||
|
attribute = opts.attribute
|
||||||
|
|
||||||
|
source_project = target_project = None
|
||||||
|
|
||||||
|
if len(args) > 2:
|
||||||
|
raise oscerr.WrongArgs('Too many arguments.')
|
||||||
|
|
||||||
|
if len(args) == 0:
|
||||||
|
if is_project_dir(os.getcwd()):
|
||||||
|
apiurl = self.get_api_url()
|
||||||
|
source_project = args[0]
|
||||||
|
if len(args) >= 2:
|
||||||
|
target_project = args[1]
|
||||||
|
else:
|
||||||
|
sys.exit('osc maintenancerequest needs a source project specified either via command line or as current directory\n')
|
||||||
|
|
||||||
|
if len(args) > 0:
|
||||||
|
source_project = args[0]
|
||||||
|
|
||||||
|
if len(args) > 1:
|
||||||
|
target_project = args[1]
|
||||||
|
else:
|
||||||
|
query = { "match": "attribute/@name='" + attribute + "'" }
|
||||||
|
u = makeurl(apiurl, ['search', 'project_id'], query)
|
||||||
|
f = http_GET(u)
|
||||||
|
root = ET.parse(f).getroot()
|
||||||
|
project = root.find("project")
|
||||||
|
target_project = project.get("name")
|
||||||
|
print target_project
|
||||||
|
if not target_project:
|
||||||
|
sys.exit('Unable to find defined OBS:Maintenance project on server.\n')
|
||||||
|
|
||||||
|
if not opts.message:
|
||||||
|
opts.message = edit_message()
|
||||||
|
|
||||||
|
result = create_maintenance_request(apiurl, source_project, target_project, opts.message)
|
||||||
|
if not result:
|
||||||
|
sys.exit("maintenance request creation failed")
|
||||||
|
print result
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-c', '--checkout', action='store_true',
|
@cmdln.option('-c', '--checkout', action='store_true',
|
||||||
help='Checkout branched package afterwards ' \
|
help='Checkout branched package afterwards ' \
|
||||||
'(\'osc bco\' is a shorthand for this option)' )
|
'(\'osc bco\' is a shorthand for this option)' )
|
||||||
|
24
osc/core.py
24
osc/core.py
@ -3468,6 +3468,30 @@ def clone_request(apiurl, reqid, msg=None):
|
|||||||
raise oscerr.APIError('invalid data from clone request:\n%s\n' % ET.tostring(root))
|
raise oscerr.APIError('invalid data from clone request:\n%s\n' % ET.tostring(root))
|
||||||
return project
|
return project
|
||||||
|
|
||||||
|
# create a maintenance incident per request
|
||||||
|
def create_maintenance_request(apiurl, src_project, dst_project, message="" ):
|
||||||
|
import cgi
|
||||||
|
|
||||||
|
xml = """\
|
||||||
|
<request>
|
||||||
|
<action type="maintenance_incident">
|
||||||
|
<source project="%s" />
|
||||||
|
<target project="%s" />
|
||||||
|
</action>
|
||||||
|
<state name="new"/>
|
||||||
|
<description>%s</description>
|
||||||
|
</request>
|
||||||
|
""" % (src_project,
|
||||||
|
dst_project,
|
||||||
|
cgi.escape(unicode(message, "utf8")))
|
||||||
|
|
||||||
|
u = makeurl(apiurl, ['request'], query='cmd=create')
|
||||||
|
f = http_POST(u, data=xml)
|
||||||
|
|
||||||
|
root = ET.parse(f).getroot()
|
||||||
|
return root.get('id')
|
||||||
|
|
||||||
|
|
||||||
# This creates an old style submit request for server api 1.0
|
# This creates an old style submit request for server api 1.0
|
||||||
def create_submit_request(apiurl,
|
def create_submit_request(apiurl,
|
||||||
src_project, src_package,
|
src_project, src_package,
|
||||||
|
Loading…
Reference in New Issue
Block a user