#NEWLINE# def sysrq( vm , action = 'nmi' , key = 'uuid' ) : #NEWLINE# #INDENT# "\n    Send non-maskable interupt to vm or capture a screenshot\n\n    vm : string\n        vm to be targetted\n    action : string\n        nmi or screenshot -- Default: nmi\n    key : string [uuid|alias|hostname]\n        value type of 'vm' parameter\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' vmadm.sysrq 186da9ab-7392-4f55-91a5-b8f1fe770543 nmi\n        salt '*' vmadm.sysrq 186da9ab-7392-4f55-91a5-b8f1fe770543 screenshot\n        salt '*' vmadm.sysrq nacl nmi key=alias\n    " #NEWLINE# ret = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# vmadm = _check_vmadm ( ) #NEWLINE# if ( key not in [ 'uuid' , 'alias' , 'hostname' ] ) : #NEWLINE# #INDENT# ret [ 'Error' ] = 'Key must be either uuid, alias or hostname' #NEWLINE# return ret #NEWLINE# #UNINDENT# if ( action not in [ 'nmi' , 'screenshot' ] ) : #NEWLINE# #INDENT# ret [ 'Error' ] = 'Action must be either nmi or screenshot' #NEWLINE# return ret #NEWLINE# #UNINDENT# vm = lookup ( '{0}={1}' . format ( key , vm ) , one = True ) #NEWLINE# if ( 'Error' in vm ) : #NEWLINE# #INDENT# return vm #NEWLINE# #UNINDENT# cmd = '{vmadm} sysrq {uuid} {action}' . format ( vmadm = vmadm , uuid = vm , action = action ) #NEWLINE# res = __salt__ [ 'cmd.run_all' ] ( cmd ) #NEWLINE# retcode = res [ 'retcode' ] #NEWLINE# if ( retcode != 0 ) : #NEWLINE# #INDENT# ret [ 'Error' ] = ( res [ 'stderr' ] if ( 'stderr' in res ) else _exit_status ( retcode ) ) #NEWLINE# return ret #NEWLINE# #UNINDENT# return True