import os
import sys
import subprocess
-import pluginsmf
+from . import pluginsmf
from time_slider import smf, autosnapsmf, util
command = self.smfInst.get_trigger_command()
try:
statinfo = os.stat(command)
- other_x = (statinfo.st_mode & 01)
+ other_x = (statinfo.st_mode & 0o1)
if other_x == 0:
- raise RuntimeError, 'Plugin: %s:\nConfigured trigger command is not ' \
+ raise RuntimeError('Plugin: %s:\nConfigured trigger command is not ' \
'executable:\n%s' \
- % (self.smfInst.instanceName, command)
+ % (self.smfInst.instanceName, command))
except OSError:
- raise RuntimeError, 'Plugin: %s:\nCan not access the configured ' \
+ raise RuntimeError('Plugin: %s:\nCan not access the configured ' \
'plugin/trigger_command:\n%s' \
- % (self.smfInst.instanceName, command)
+ % (self.smfInst.instanceName, command))
def execute(self, schedule, label):
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
close_fds=True)
- except OSError, message:
- raise RuntimeError, "%s subprocess error:\n %s" % \
- (cmd, str(message))
+ except OSError as message:
+ raise RuntimeError("%s subprocess error:\n %s" % \
+ (cmd, str(message)))
self._proc = None
def is_running(self):
err = p.wait()
if err != 0:
self._refreshLock.release()
- raise RuntimeError, '%s failed with exit code %d\n%s' % \
- (str(cmd), err, errdata)
+ raise RuntimeError('%s failed with exit code %d\n%s' % \
+ (str(cmd), err, errdata))
for line in outdata.rstrip().split('\n'):
line = line.rstrip().split()
state = line[0]
try:
plugin = Plugin(fmri, self.verbose)
self.plugins.append(plugin)
- except RuntimeError, message:
+ except RuntimeError as message:
sys.stderr.write("Ignoring misconfigured plugin: %s\n" \
% (fmri))
sys.stderr.write("Reason:\n%s\n" % (message))