def get_node_status(self): """Get node status object This will return the NodeStatus object for this object """ if self._node_status is None: states = plconfig.get_config()['states'] self._node_status = NodeStatus(states) return self._node_status
def run(): config = plconfig.get_config() node = plight.NodeStatus(states=config['states']) try: mode = sys.argv[1].lower() except IndexError: cli_fail(node._commands) except AttributeError: cli_fail(node._commands) if mode in node._commands: log_message('Changing state to {0}'.format(mode)) node.set_node_state(mode) elif mode == 'start': start_server(config, node) elif mode == 'status': format_get_current_state(node.state, config['states'][node.state]) elif mode == 'list-states': format_list_states(node._default_state, config['states']) elif mode == 'stop': stop_server() else: cli_fail(node._commands)
def run(): config = plconfig.get_config() node = plight.NodeStatus(states=config['states']) try: mode = sys.argv[1].lower() except IndexError: cli_fail(node._commands) except AttributeError: cli_fail(node._commands) if mode in node._commands: log_message('Changing state to {0}'.format(mode)) node.set_node_state(mode) elif mode == 'start': start_server(config) elif mode == 'status': format_get_current_state(node.state, config['states'][node.state]) elif mode == 'list-states': format_list_states(node._default_state, config['states']) elif mode == 'stop': stop_server() else: cli_fail(node._commands)
def config(request, tmpdir): file = tmpdir.join('config') open(file.strpath, 'w').write(request.param) return plconfig.get_config(file.strpath)