示例#1
0
 def initial_run(connection, username="******", password="******"):
     '''
     Do rhui-manager initial run
     '''
     Expect.enter(connection, "rhui-manager")
     state = Expect.expect_list(
         connection, [(re.compile(".*RHUI Username:.*", re.DOTALL), 1),
                      (re.compile(".*rhui \(home\) =>.*", re.DOTALL), 2)])
     if state == 1:
         Expect.enter(connection, username)
         Expect.expect(connection, "RHUI Password:"******".*Invalid login.*", re.DOTALL), 1),
              (re.compile(".*rhui \(home\) =>.*", re.DOTALL), 2)])
         if password_state == 1:
             initial_password = Util.get_initial_password(connection)
             Expect.enter(connection, "rhui-manager")
             Expect.expect(connection, ".*RHUI Username:"******"RHUI Password:"******"rhui \(home\) =>")
         else:
             pass
     else:
         # initial step was already performed by someone
         pass
 def initial_run(connection, username="******", password="******"):
     '''
     Run rhui-manager and make sure we're logged in, then quit it.
     '''
     Expect.enter(connection, "rhui-manager")
     state = Expect.expect_list(
         connection, [(re.compile(".*RHUI Username:.*", re.DOTALL), 1),
                      (re.compile(r".*rhui \(home\) =>.*", re.DOTALL), 2)])
     if state == 1:
         Expect.enter(connection, username)
         Expect.expect(connection, "RHUI Password:"******".*Invalid login.*", re.DOTALL), 1),
              (re.compile(r".*rhui \(home\) =>.*", re.DOTALL), 2)])
         if password_state == 1:
             initial_password = Util.get_initial_password(connection)
             if not initial_password:
                 raise RuntimeError(
                     "Could not get the initial rhui-manager password.")
             Expect.enter(connection, "rhui-manager")
             Expect.expect(connection, ".*RHUI Username:"******"RHUI Password:"******"rhui \(home\) =>")
     Expect.enter(connection, "q")