Пример #1
0
    def __init__(self):
        session = JenkinsSession()
        counter = 0
        self.jenkins = None
        while self.jenkins is None and counter < 3:
            try:
                user = session.load_jenkins_user()
                token = session.load_jenkins_token()
                self.jenkins = Jenkins(
                    'http://mrhat.internal.radian6.com/jenkins', user, token)
                self.creds = (user, token)
            except:
                if sys.stdin.isatty():
                    login = Factory().get_login('CLI', 'Login to Jenkins...')
                else:
                    login = Factory().get_login('GUI', 'Login to Jenkins...')

                login.add_prompt('user', 'Jenkins UserName', 'TEXT',
                                 session.load_jenkins_user())
                login.add_prompt('password', 'Jenkins Password', 'PASSWORD')

                user = login.get_value('user')
                passwd = login.get_value('password')
                token = session.login(user, passwd)
                counter = counter + 1
Пример #2
0
    def __init__(self, session_id=None):
        self.sf_session = None
        self.sf_session_id = None

        if session_id is not None: #remote initialization
            try:
                self.__create_session__(session_id)
            except Exception as e:
                print "Unable to Create Session with passed token: %s" % session_id
                print e
        else: #local initialization
            session = GusSession()
            try:
                self.__create_session__(session.load_session_id())
            except Exception as e:
                if sys.stdin.isatty():
                    login = Factory().get_login('CLI', 'Looks like we need to login to Gus...')
                else:
                    login = Factory().get_login('GUI', 'Looks like we need to login to Gus...')
                    
                login.add_prompt('user', 'GUS UserName', 'TEXT', session.load_user_name())
                login.add_prompt('password', 'GUS Password', 'PASSWORD')
                login.add_prompt('token', 'GUS Security Token', 'TEXT', session.load_gus_token())

                counter = 0
                while self.sf_session_id is None and counter < 3:
                    login.display()
                    user = login.get_value('user')
                    passwd = login.get_value('password')
                    token = login.get_value('token')
                        
                    self.__create_session__(session.login(user, passwd, token))
                    
                if self.sf_session_id is None:
                    raise Exception('Not Logged into GUS')
Пример #3
0
 def __init__(self):
     session = JenkinsSession()
     counter = 0
     self.jenkins = None
     while self.jenkins is None and counter < 3:
         try:
             user = session.load_jenkins_user()
             token = session.load_jenkins_token()
             self.jenkins = Jenkins('http://mrhat.internal.radian6.com/jenkins', user, token)
             self.creds = (user, token)
         except:
             if sys.stdin.isatty():
                 login = Factory().get_login('CLI', 'Login to Jenkins...')
             else:
                 login = Factory().get_login('GUI', 'Login to Jenkins...')
                 
             login.add_prompt('user', 'Jenkins UserName', 'TEXT', session.load_jenkins_user())
             login.add_prompt('password', 'Jenkins Password', 'PASSWORD')
                 
             user = login.get_value('user')
             passwd = login.get_value('password')
             token = session.login(user, passwd)
             counter = counter + 1