예제 #1
0
def check_jenkins_pem():
    """
        Check if the user has provided jenkinskey.pem
    """
    print(
        " Please make sure that you have the ssh login user names of jenkins and bitbucket servers."
    )
    print(
        " Please place the private key to your Jenkins server in the installer root directory with a filenameof 'jenkinskey.pem"
    )

    pause()

    # Check if file is been added to home derectory
    jenkins_pem = get_installer_root() + "/jenkinskey.pem"
    if not os.path.isfile(jenkins_pem):
        sys.exit(
            "File jenkinskey.pem not found in installer root directory, kindly add and run the installer again! "
        )

    # Copy the pem keys and give relavant permisions
    subprocess.call('cp -f {0} {1}sshkeys'.format(
        jenkins_pem, get_script_folder()).split(' '))
    subprocess.call('sudo chmod 400 {0}sshkeys/jenkinskey.pem'.format(
        get_script_folder()).split(' '))
예제 #2
0
def check_dockerised_jenkins_pem():
    """
        Check if the jenkins dockerised has created jenkinskey.pem private keys
    """
    # Check if both files are been added to home derectory
    if not os.path.isfile(get_jenkins_pem()):
        sys.exit("File jenkinskey.pem missing. Aborting! ")

    # Copy the pem keys and give relavant permissions to a dockerkeys Location. This is different from Scenario 1.
    subprocess.call('cp -f {0} {1}sshkeys/dockerkeys'.format(
        get_jenkins_pem(), get_script_folder()).split(' '))
    subprocess.call(
        'sudo chmod 400 {0}sshkeys/dockerkeys/jenkinskey.pem'.format(
            get_script_folder()).split(' '))
def check_jenkins_pem():
    """
        Check if the user has provided jenkinskey.pem private keys
    """
    # Check if both files are been added to home derectory
    if not os.path.isfile(get_jenkins_pem()):
        sys.exit(
            "File jenkinskey.pem is not present in your home (~/) folder, kindly add and run the installer again! "
        )

    # Copy the pem keys and give relavant permissions to a dockerkeys location. This is different from Scenario 1.
    subprocess.call('cp -f {0} {1}sshkeys/dockerkeys'.format(
        get_jenkins_pem(), get_script_folder()).split(' '))
    subprocess.call(
        'sudo chmod 400 {0}sshkeys/dockerkeys/jenkinskey.pem'.format(
            get_script_folder()).split(' '))