Fix representation of signal.SIG* constants
Pass signals as strings instead of using python constants which depend on host system and have different types on py27 vs py3. Change-Id: Ib8d7136bb3aed125a987678672142ce72e33af6f Closes-bug: #1836736
This commit is contained in:
parent
82cb432398
commit
e55bd553aa
|
@ -30,8 +30,8 @@ def main():
|
|||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||
'grep -v grep | '
|
||||
'grep %s | awk {{\\047print $1\\047}}`; '
|
||||
'echo $pids | xargs kill -19; sleep %s; '
|
||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
||||
'echo $pids | xargs kill -SIGSTOP; sleep %s; '
|
||||
'echo $pids | xargs kill -SIGCONT; rm \' >> $tf; '
|
||||
'echo -n $tf >> $tf; '
|
||||
'chmod 770 $tf; nohup $tf &"') % (grep, sec)
|
||||
rc, stdout, stderr = module.run_command(cmd, check_rc=True)
|
||||
|
|
|
@ -19,7 +19,7 @@ def main():
|
|||
module = AnsibleModule(
|
||||
argument_spec=dict(
|
||||
grep=dict(required=True, type='str'),
|
||||
sig=dict(required=True, type='int')
|
||||
sig=dict(required=True, type='str')
|
||||
))
|
||||
|
||||
grep = module.params['grep']
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
# limitations under the License.
|
||||
|
||||
import logging
|
||||
import signal
|
||||
|
||||
from os_faults.ansible import executor
|
||||
from os_faults.api import error
|
||||
|
@ -121,7 +120,7 @@ class ServiceAsProcess(service.Service):
|
|||
def kill(self, nodes=None):
|
||||
task = {
|
||||
'kill': {
|
||||
'grep': self.grep, 'sig': signal.SIGKILL
|
||||
'grep': self.grep, 'sig': 'SIGKILL'
|
||||
},
|
||||
'become': 'yes',
|
||||
}
|
||||
|
@ -138,7 +137,7 @@ class ServiceAsProcess(service.Service):
|
|||
else:
|
||||
task = {
|
||||
'kill': {
|
||||
'grep': self.grep, 'sig': signal.SIGSTOP
|
||||
'grep': self.grep, 'sig': 'SIGSTOP'
|
||||
},
|
||||
'become': 'yes',
|
||||
}
|
||||
|
@ -148,7 +147,7 @@ class ServiceAsProcess(service.Service):
|
|||
def unfreeze(self, nodes=None):
|
||||
task = {
|
||||
'kill': {
|
||||
'grep': self.grep, 'sig': signal.SIGCONT
|
||||
'grep': self.grep, 'sig': 'SIGCONT'
|
||||
},
|
||||
'become': 'yes',
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue