Ejemplo n.º 1
0
"""A special [PinshCmd] command which is the root of all other commands. Slash
Does not do anything itself, but merely has other PinshCmd objects which are
its children"""

import traceback, StringIO
import exceptions, readline
import sys
import PinshCmd, libUi
from Exceptions import AmbiguousCommand, UnknownCommand, ServerException
from Exceptions import CommandError, ServerTracebackException
from Exceptions import MachineStatusException
import CommandLine
from SystemStateSingleton import SystemState

system_state = SystemState()
from bombardier_core.static_data import FAIL, OK


class Slash(PinshCmd.PinshCmd):
    """Root-level PinshCmd object, has no name."""

    def __init__(self, children):
        PinshCmd.PinshCmd.__init__(self, "")
        self.children = children
        self.cmd_owner = 1
        self.help_text = ""

    def complete_tokens(self, command_line):
        "Go through all the tokens in the current command line and expand them"
        completed_tokens = []
Ejemplo n.º 2
0
if __name__ == "__main__":
    import optparse

    parser = optparse.OptionParser("usage: %prog [-d] <Test Module>")
    parser.add_option("-d", "--debug", dest="debug", action="store_const",
                      const=True, help="Turn on debugging")
    parser.add_option("-s", "--server_home", dest="server_home", metavar = "HOME",
                      help="Set server home")

    (options, modules_to_test) = parser.parse_args()
    debug = False
    if options.debug:
        debug = True

    system_state = SystemState()
    system_state.load_config()
    libUi.login("admin", 'abc123')

    output = system_state.cnm_connector.dispatcher_control("start")
    if not debug:
        print "(suppressing output)"
        output_handle = StringIO.StringIO()
        system_state.set_output(output_handle)
    else:
        print "OUTPUT FROM DISPATCHER START", output
        print "(clearing existing connections)"
    system_state.cnm_connector.cleanup_connections()

    if options.server_home:
        system_state.cnm_connector.sync_server_home(options.server_home)
Ejemplo n.º 3
0
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

'''A set of routines that handles user input/output on the terminal'''

import sys, termios, tty
from CnmConnector import CnmConnector, UnexpectedDataException, ServerException
from SystemStateSingleton import SystemState
system_state = SystemState()
from bombardier_core.static_data import FAIL
from bombardier_core.static_data import WARNING, CRITICAL, DEBUG, INFO
from bombardier_core.static_data import USER, ADMIN, LOG_LEVEL_LOOKUP
from bombardier_core.static_data import WARNING_COLOR, STRONG_COLOR
from bombardier_core.static_data import WEAK_COLOR, NO_COLOR
import CommandLine


ONE_LINE = 0
QUIT = 1
BACKUP = 2
PAGE = 3
NEUTRAL = 5
YES = 1
NO = 0