예제 #1
0
파일: util.py 프로젝트: ktdreyer/rhcephpkg
def jenkins_connection():
        """ Return an initialized python-jenkins object. """
        configp = config()
        try:
            user = configp.get('rhcephpkg', 'user')
            token = configp.get('rhcephpkg.jenkins', 'token')
            url = configp.get('rhcephpkg.jenkins', 'url')
        except configparser.Error as err:
            raise SystemExit('Problem parsing .rhcephpkg.conf: %s',
                             err.message)
        jenkins = Jenkins(url, username=user, password=token)
        # These "password" and "url" attributes are not formally part of
        # python-jenkins' API, but they are nice to make available to consumers
        # (for logging/debugging, for example.)
        jenkins.password = token
        jenkins.url = url
        return jenkins
예제 #2
0
def jenkins_connection():
        """ Return an initialized python-jenkins object. """
        configp = config()
        try:
            user = configp.get('rhcephpkg', 'user')
            token = configp.get('rhcephpkg.jenkins', 'token')
            url = configp.get('rhcephpkg.jenkins', 'url')
        except configparser.Error as err:
            raise SystemExit('Problem parsing .rhcephpkg.conf: %s',
                             err.message)
        jenkins = Jenkins(url, username=user, password=token)
        # These "password" and "url" attributes are not formally part of
        # python-jenkins' API, but they are nice to make available to consumers
        # (for logging/debugging, for example.)
        jenkins.password = token
        jenkins.url = url
        return jenkins
예제 #3
0
def connect(credentials):
    """
    Since a user can have simple authentication with a single user/password or
    define a set of IRC nick to Jenkin's users with API tokens, this helper
    untangles this and returns a connection.

    If no authentication is configured, just a connection is returned with no
    authentication (probably read-only, depending on Jenkins settings)
    """
    connection = Jenkins(
        credentials['url'],
        username=credentials['username'],
        password=credentials['password'],
    )
    connection.password = credentials['password']

    # try an actual request so we can bail if something is off
    connection.get_info()

    return connection
예제 #4
0
def connect(credentials):
    """
    Since a user can have simple authentication with a single user/password or
    define a set of IRC nick to Jenkin's users with API tokens, this helper
    untangles this and returns a connection.

    If no authentication is configured, just a connection is returned with no
    authentication (probably read-only, depending on Jenkins settings)
    """
    connection = Jenkins(
        credentials['url'],
        username=credentials['username'],
        password=credentials['password'],
    )
    connection.password = credentials['password']

    # try an actual request so we can bail if something is off
    connection.get_info()

    return connection