Test process
This commit is contained in:
@ -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
@ -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:
|
||||
|
||||
@ -54,12 +54,6 @@ export function localScan(){
|
||||
}
|
||||
}
|
||||
|
||||
export function test(){
|
||||
return {
|
||||
type: 'PUSHER_TEST'
|
||||
}
|
||||
}
|
||||
|
||||
export function getConnections(){
|
||||
return {
|
||||
type: 'PUSHER_GET_CONNECTIONS'
|
||||
|
||||
@ -146,7 +146,7 @@ const 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;
|
||||
|
||||
@ -122,7 +122,7 @@ class Debug extends React.Component{
|
||||
<div className="name"></div>
|
||||
<div className="input">
|
||||
<a className="button secondary" onClick={e => this.props.uiActions.createNotification({content: 'Test notification'})}>Create notification</a>
|
||||
<a className="button secondary" onClick={e => this.props.pusherActions.test()}>Run test process</a>
|
||||
<a className="button secondary" onClick={e => this.props.pusherActions.request('test')}>Run test process</a>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user