Skip to content

Commit

Permalink
add sendsysrq command
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianschroeter committed Feb 9, 2018
1 parent 9c4f0d5 commit 80352cb
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
0.163
-
- add sendsysrq command (requires OBS 2.10)

0.162.1
- Send sha256 hashes for tracked files if the wc is pulled/linkrepair
Expand Down
43 changes: 43 additions & 0 deletions osc/commandline.py
Original file line number Diff line number Diff line change
Expand Up @@ -6865,6 +6865,49 @@ def do_info(self, subcmd, opts, *args):
print(p.info())


@cmdln.option('-M', '--multibuild-package', action='append',
help='specify a specific multibuild flavor')
def do_sendsysrq(self, subcmd, opts, *args):
"""${cmd_name}: trigger a sysrq in a running build
This is only going to work when the build is running in a supported VM.
Also only a subset of sysrq are supported. Typical use case for debugging
are 9, t and w in this sequence.
usage:
osc restartbuild REPOSITORY ARCH SYSRQ
osc restartbuild PROJECT PACKAGE REPOSITORY ARCH SYSRQ

This comment has been minimized.

Copy link
@jirislaby

jirislaby Feb 9, 2018

restartbuild?

This comment has been minimized.

Copy link
@adrianschroeter

adrianschroeter via email Feb 9, 2018

Author Member
${cmd_option_list}
"""
args = slash_split(args)

project = package = repo = arch = sysrq = None
apiurl = self.get_api_url()

if len(args) < 4:
if is_package_dir(os.curdir):
project = store_read_project(os.curdir)
package = store_read_package(os.curdir)
apiurl = store_read_apiurl(os.curdir)
repo = args[0]
arch = args[1]
sysrq = args[2]
else:
raise oscerr.WrongArgs('Too few arguments.')
elif len(args) != 5:
raise oscerr.WrongArgs('Wrong number of arguments.')
else:
project = args[0]
package = args[1]
repo = args[2]
arch = args[3]
sysrq = args[4]

if opts.multibuild_package:
package = package + ":" + opts.multibuild_package

print(cmdbuild(apiurl, 'sendsysrq', project, package, arch, repo, None, sysrq))

@cmdln.option('-a', '--arch', metavar='ARCH',
help='Restart builds for a specific architecture')
@cmdln.option('-M', '--multibuild-package', action='append',
Expand Down
6 changes: 5 additions & 1 deletion osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -6453,7 +6453,7 @@ def wipebinaries(apiurl, project, package=None, arch=None, repo=None, code=None)
return cmdbuild(apiurl, 'wipe', project, package, arch, repo, code)


def cmdbuild(apiurl, cmd, project, package=None, arch=None, repo=None, code=None):
def cmdbuild(apiurl, cmd, project, package=None, arch=None, repo=None, code=None, sysrq=None):
query = { 'cmd': cmd }
if package:
query['package'] = package
Expand All @@ -6463,6 +6463,8 @@ def cmdbuild(apiurl, cmd, project, package=None, arch=None, repo=None, code=None
query['repository'] = repo
if code:
query['code'] = code
if sysrq:
query['sysrq'] = sysrq

u = makeurl(apiurl, ['build', project], query)
try:
Expand All @@ -6477,6 +6479,8 @@ def cmdbuild(apiurl, cmd, project, package=None, arch=None, repo=None, code=None
e.osc_msg += ' repository %s' % repo
if code:
e.osc_msg += ' code=%s' % code
if sysrq:
e.osc_msg += ' sysrq=%s' % code
raise

root = ET.parse(f).getroot()
Expand Down

0 comments on commit 80352cb

Please sign in to comment.