mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-25 22:36:13 +01:00
- do_maintenancerequest: cleanup
This commit is contained in:
parent
65f817bfa8
commit
45a7a84967
@ -2360,38 +2360,30 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if len(args) > 2:
|
if len(args) > 2:
|
||||||
raise oscerr.WrongArgs('Too many arguments.')
|
raise oscerr.WrongArgs('Too many arguments.')
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0 and is_project_dir(os.curdir):
|
||||||
if is_project_dir(os.getcwd()):
|
source_project = store_read_project(os.curdir)
|
||||||
apiurl = self.get_api_url()
|
elif len(args) == 0:
|
||||||
source_project = args[0]
|
raise oscerr.WrongArgs('Too few arguments.')
|
||||||
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:
|
if len(args) > 0:
|
||||||
source_project = args[0]
|
source_project = args[0]
|
||||||
|
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
target_project = args[1]
|
target_project = args[1]
|
||||||
else:
|
else:
|
||||||
query = { "match": "attribute/@name='" + attribute + "'" }
|
xpath = 'attribute/@name = \'%s\'' % attribute
|
||||||
u = makeurl(apiurl, ['search', 'project_id'], query)
|
res = search(apiurl, project_id=xpath)
|
||||||
f = http_GET(u)
|
root = res['project_id']
|
||||||
root = ET.parse(f).getroot()
|
project = root.find('project')
|
||||||
project = root.find("project")
|
if project is None:
|
||||||
target_project = project.get("name")
|
sys.exit('Unable to find defined OBS:Maintenance project on server.')
|
||||||
print target_project
|
target_project = project.get('name')
|
||||||
if not target_project:
|
print 'Using target project \'%s\'' % target_project
|
||||||
sys.exit('Unable to find defined OBS:Maintenance project on server.\n')
|
|
||||||
|
|
||||||
if not opts.message:
|
if not opts.message:
|
||||||
opts.message = edit_message()
|
opts.message = edit_message()
|
||||||
|
|
||||||
result = create_maintenance_request(apiurl, source_project, target_project, opts.message)
|
r = create_maintenance_request(apiurl, source_project, target_project, opts.message)
|
||||||
if not result:
|
print r.reqid
|
||||||
sys.exit("maintenance request creation failed")
|
|
||||||
print result
|
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-c', '--checkout', action='store_true',
|
@cmdln.option('-c', '--checkout', action='store_true',
|
||||||
|
Loading…
Reference in New Issue
Block a user