Test process

This commit is contained in:
James Barnsley
2018-11-02 21:44:16 +13:00
parent f7faa059ad
commit 4cb33c7aaa
6 changed files with 16 additions and 25 deletions

View File

@ -5687,7 +5687,6 @@ exports.upgrade = upgrade;
exports.reload = reload;
exports.restart = restart;
exports.localScan = localScan;
exports.test = test;
exports.getConnections = getConnections;
exports.connectionAdded = connectionAdded;
exports.connectionChanged = connectionChanged;
@ -5771,12 +5770,6 @@ function localScan() {
};
}
function test() {
return {
type: 'PUSHER_TEST'
};
}
function getConnections() {
return {
type: 'PUSHER_GET_CONNECTIONS'
@ -54411,7 +54404,7 @@ var PusherMiddleware = function () {
store.dispatch(uiActions.createNotification({ type: 'info', content: 'Restarting server...' }));
break;
// Upgrade
// Test
case 'test_started':
store.dispatch(uiActions.updateProcess('test', 'Running test'));
break;
@ -68646,7 +68639,7 @@ var Debug = function (_React$Component) {
_react2.default.createElement(
'a',
{ className: 'button secondary', onClick: function onClick(e) {
return _this2.props.pusherActions.test();
return _this2.props.pusherActions.request('test');
} },
'Run test process'
)

File diff suppressed because one or more lines are too long

View File

@ -10,6 +10,7 @@ class IrisSystemThread(Thread):
Thread.__init__(self)
self.action = action
self.callback = callback
self.path = os.path.dirname(__file__)
##
# Run the defined action
@ -22,14 +23,17 @@ class IrisSystemThread(Thread):
except Exception, e:
logger.error(e)
# And then, when complete, return to our callback
error = {
'message': "Permission denied",
'description': str(e)
}
if self.callback:
self.callback(False, "Permission denied")
self.callback(False, error)
# Run the actual task (this is the process-blocking instruction)
path = os.path.dirname(__file__)
output = subprocess.check_output(["sudo "+path+"/system.sh "+self.action], shell=True)
output = subprocess.check_output(["sudo "+self.path+"/system.sh "+self.action], shell=True)
# And then, when complete, return to our callback
if self.callback:
@ -45,13 +49,13 @@ class IrisSystemThread(Thread):
# @return boolean or exception
##
def check_system_access(self, *args, **kwargs):
path = os.path.dirname(__file__)
# Attempt the upgrade
process = subprocess.Popen("sudo -n "+path+"/system.sh", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
# Attempt an empty call to our system file
process = subprocess.Popen("sudo -n "+self.path+"/system.sh", stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
result, error = process.communicate()
exitCode = process.wait()
# Some kind of failure, so we can't run any commands this way
if exitCode > 0:
raise Exception("Password-less access to "+path+"/system.sh was refused. Check your /etc/sudoers file.")
else: