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:
@@ -30,8 +30,8 @@ def main():
|
|||||||
'echo -en \'/bin/bash\\npids=`ps ax | '
|
'echo -en \'/bin/bash\\npids=`ps ax | '
|
||||||
'grep -v grep | '
|
'grep -v grep | '
|
||||||
'grep %s | awk {{\\047print $1\\047}}`; '
|
'grep %s | awk {{\\047print $1\\047}}`; '
|
||||||
'echo $pids | xargs kill -19; sleep %s; '
|
'echo $pids | xargs kill -SIGSTOP; sleep %s; '
|
||||||
'echo $pids | xargs kill -18; rm \' >> $tf; '
|
'echo $pids | xargs kill -SIGCONT; rm \' >> $tf; '
|
||||||
'echo -n $tf >> $tf; '
|
'echo -n $tf >> $tf; '
|
||||||
'chmod 770 $tf; nohup $tf &"') % (grep, sec)
|
'chmod 770 $tf; nohup $tf &"') % (grep, sec)
|
||||||
rc, stdout, stderr = module.run_command(cmd, check_rc=True)
|
rc, stdout, stderr = module.run_command(cmd, check_rc=True)
|
||||||
|
@@ -19,7 +19,7 @@ def main():
|
|||||||
module = AnsibleModule(
|
module = AnsibleModule(
|
||||||
argument_spec=dict(
|
argument_spec=dict(
|
||||||
grep=dict(required=True, type='str'),
|
grep=dict(required=True, type='str'),
|
||||||
sig=dict(required=True, type='int')
|
sig=dict(required=True, type='str')
|
||||||
))
|
))
|
||||||
|
|
||||||
grep = module.params['grep']
|
grep = module.params['grep']
|
||||||
|
@@ -12,7 +12,6 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import signal
|
|
||||||
|
|
||||||
from os_faults.ansible import executor
|
from os_faults.ansible import executor
|
||||||
from os_faults.api import error
|
from os_faults.api import error
|
||||||
@@ -121,7 +120,7 @@ class ServiceAsProcess(service.Service):
|
|||||||
def kill(self, nodes=None):
|
def kill(self, nodes=None):
|
||||||
task = {
|
task = {
|
||||||
'kill': {
|
'kill': {
|
||||||
'grep': self.grep, 'sig': signal.SIGKILL
|
'grep': self.grep, 'sig': 'SIGKILL'
|
||||||
},
|
},
|
||||||
'become': 'yes',
|
'become': 'yes',
|
||||||
}
|
}
|
||||||
@@ -138,7 +137,7 @@ class ServiceAsProcess(service.Service):
|
|||||||
else:
|
else:
|
||||||
task = {
|
task = {
|
||||||
'kill': {
|
'kill': {
|
||||||
'grep': self.grep, 'sig': signal.SIGSTOP
|
'grep': self.grep, 'sig': 'SIGSTOP'
|
||||||
},
|
},
|
||||||
'become': 'yes',
|
'become': 'yes',
|
||||||
}
|
}
|
||||||
@@ -148,7 +147,7 @@ class ServiceAsProcess(service.Service):
|
|||||||
def unfreeze(self, nodes=None):
|
def unfreeze(self, nodes=None):
|
||||||
task = {
|
task = {
|
||||||
'kill': {
|
'kill': {
|
||||||
'grep': self.grep, 'sig': signal.SIGCONT
|
'grep': self.grep, 'sig': 'SIGCONT'
|
||||||
},
|
},
|
||||||
'become': 'yes',
|
'become': 'yes',
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user