Пример #1
0
def create_boot_properties(configData, full_path): 

    """
    Create boot.properties files for instances
    """       
    if managed_key in configData:
        jsonDataArray = configData[managed_key]
    else:
        logging.error(managed_key + " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key + " config data missing from json. will not install")
        return    

    commonRequiredFields = ['middlewareHome', 'installOwner', 'installGroup', 'wl_domain']
    commerce_setup_helper.check_required_fields(commonData, commonRequiredFields)    

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    INSTALL_GROUP = commonData['installGroup']
    WL_DOMAIN_NAME = commonData['wl_domain']
    WL_ADMIN_USER = commonData['wl_adminUser']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    
    SERVER_PATH = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME + '/servers/'
    
    logging.info("Checking boot.properties setup")
    
    for jsonData in jsonDataArray:
        
        requiredFields = ['managedServerName', 'managedServerHost']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    
        WL_SERVER_NAME = jsonData['managedServerName']
        WL_SERVER_HOST = jsonData['managedServerHost']
        
        # try to get the fqdn
        FQDN = socket.getfqdn()
        if (FQDN is not None):
            HOSTNAME = FQDN.split(".")[0]
            if (FQDN == WL_SERVER_HOST or HOSTNAME == WL_SERVER_HOST):
                # make sure the base servers path exists
                if(os.path.exists(SERVER_PATH)):
                    # create the instance and security dir to write to boot file to
                    outpath = SERVER_PATH + WL_SERVER_NAME + "/security/"
                    commerce_setup_helper.mkdir_with_perms(outpath, INSTALL_OWNER, INSTALL_GROUP)
                    outfile = outpath + 'boot.properties'
                    outdata = open(outfile, 'w')
                    outdata.write('username='******'password=' + WL_ADMIN_PW + "\n")
                    outdata.close()
                    # change the owner of boot.properties. should have been created by root
                    commerce_setup_helper.change_file_owner(outfile, INSTALL_OWNER, INSTALL_GROUP)
                    
                logging.info("Created boot.properties for " + WL_SERVER_NAME)
        else:
            logging.error("Cannot determine hostname. Cannot create boot.properties")
Пример #2
0
def add_managed_servers(configData, full_path):
    
    managed_key = "WEBLOGIC_managed_servers"
    if managed_key in configData:
        jsonDataArray = configData[managed_key]
    else:
        logging.error(managed_key + " missing from json. will not add managed servers")
        return ''
    
    logging.info("adding managed servers")
    serverData = ''
    
    for jsonData in jsonDataArray:             
        requiredFields = ['managedServerName', 'managedServerHttpPort', 'managedServerHost']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    
        WL_SERVER_NAME = jsonData['managedServerName']
        WL_SERVER_PORT = jsonData['managedServerHttpPort']
        WL_SERVER_HOST = jsonData['managedServerHost']
        
        serverData += "cd('/') \n"
        serverData += "create('" + WL_SERVER_NAME + "', 'Server')\n"
        serverData += "cd('Server/" + WL_SERVER_NAME + "')\n"
        serverData += "set('ListenPort', " + WL_SERVER_PORT + ")\n"
        serverData += "set('ListenAddress', '" + WL_SERVER_HOST + "')\n"
        serverData += "cd('/') \n"
        serverData += "assign('Server', '" + WL_SERVER_NAME + "', 'Machine','" + WL_SERVER_HOST + "') \n"
                
    return serverData
Пример #3
0
def install_mdex(configData, full_path):
    endecaData = configData[json_key]
    requiredFields = ['installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(endecaData, requiredFields)
    INSTALL_OWNER = endecaData['installOwner']
    INSTALL_GROUP = endecaData['installGroup']
    if 'mdex' in endecaData:
        jsonData = endecaData['mdex']
        requiredFields = ['endecaRoot']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    else:
        logging.error(service_name +
                      " config data missing from json. will not install")
        return

    logging.info("installing " + service_name)

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/endeca11.3/solaris"
        install_exec = "/MDEX_Install/OCmdex6.5.3-Solaris.bin"
    else:
        binary_path = full_path + "/binaries/endeca11.3"
        install_exec = "/MDEX_Install/OCmdex11.3.0-Linux64_1186050.bin"

    response_files_path = full_path + "/responseFiles/endeca11.3"
    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        logging.error("Binary " + full_exec_path +
                      " does not exist - will not install")
        return False

    if jsonData is not None:
        ENDECA_ROOT = jsonData['endecaRoot']
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER,
                                               INSTALL_GROUP)

        # data field to replace in our silent installer file
        field_replacements = {'INSTALLATION_DIR': ENDECA_ROOT}

        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/mdex_response.rsp.master',
            response_files_path + '/mdex_response.rsp', field_replacements)

        installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + '/mdex_response.rsp' + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

        # add bashrc entries
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "##################### \n")
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "#Endeca Settings \n")
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "##################### \n")
        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "source " + ENDECA_ROOT +
            "/endeca/MDEX/11.3.0/mdex_setup_sh.ini \n")
        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "export ENDECA_HOME=" + ENDECA_ROOT + "/endeca \n")
Пример #4
0
def advanced_storage(configData, full_path):

    if json_key in configData:
        jsonArray = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return

    for jsonData in jsonArray:

        requiredFields = ['device', 'mountPoint', 'mountOwner', 'mountGroup']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
        DEVICE = jsonData['device']
        MOUNT_POINT = jsonData['mountPoint']
        MOUNT_OWNER = jsonData['mountOwner']
        MOUNT_GROUP = jsonData['mountGroup']

        FSTAB_ENTRY = DEVICE + "  " + MOUNT_POINT + "  ext4  defaults  0 0 \n"

        print "creating and mounting storage on device " + DEVICE + " at " + MOUNT_POINT + " \n"

        createCmd = "mkfs -t ext4 " + DEVICE
        mountCmd = "mount " + DEVICE + " " + MOUNT_POINT + " -t ext4"
        mountOwnerCmd = "chown " + MOUNT_OWNER + ":" + MOUNT_GROUP + " " + MOUNT_POINT

        if not (os.path.exists(MOUNT_POINT)):
            os.mkdir(MOUNT_POINT, 0755)

        commerce_setup_helper.exec_cmd(createCmd)
        commerce_setup_helper.exec_cmd(mountCmd)
        commerce_setup_helper.exec_cmd(mountOwnerCmd)

        with open("/etc/fstab", "a") as myfile:
            myfile.write(FSTAB_ENTRY)
        myfile.close()
def pack_domain(configData, full_path): 
    
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return
                
    print "Packing... " + service_name                
    requiredFields = ['middlewareHome', 'installOwner', 'wl_domain']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['middlewareHome']
    INSTALL_OWNER = jsonData['installOwner']
    WL_DOMAIN_NAME = jsonData['wl_domain']

        
    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME
    DOMAIN_TEMPLATE_NAME = WL_DOMAIN_NAME + '-template.jar'
    DOMAIN_TEMPLATE_PATH = INSTALL_DIR + '/user_projects/domains/' + DOMAIN_TEMPLATE_NAME
    
    packCmd = "\"" + INSTALL_DIR + "/wlserver/common/bin/pack.sh -managed=true -domain=" + WL_DOMAIN_HOME + " -template=" + DOMAIN_TEMPLATE_PATH + " -template_name=" + WL_DOMAIN_NAME + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, packCmd)
    
    # put a copy of the packed domain in our special users homeDir
    templateUser = "******"
    homeDir = os.path.expanduser("~" + templateUser)
    if os.path.isdir(homeDir):
        shutil.copyfile(DOMAIN_TEMPLATE_PATH , homeDir + "/" + DOMAIN_TEMPLATE_NAME)
        os.chmod(homeDir + "/" + DOMAIN_TEMPLATE_NAME, 0644)
    else:
        print "user " + templateUser + " home dir not available. Will not copy packed domain" 
Пример #6
0
def add_machines(configData, full_path):
    
    machine_key = "WEBLOGIC_machines"
    if machine_key in configData:
        jsonDataArray = configData[machine_key]
    else:
        logging.error(machine_key + " missing from json. will not add machines")
        return ''
    
    logging.info("adding machines")
    machineData = ''
    
    for jsonData in jsonDataArray:             
        requiredFields = ['machineName', 'machineAddress']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    
        WL_MACHINE_NAME = jsonData['machineName']
        WL_MACHINE_ADDR = jsonData['machineAddress']           
        
        machineData += "cd('/') \n"
        machineData += "create('" + WL_MACHINE_NAME + "', 'UnixMachine')\n"
        machineData += "cd('Machines/" + WL_MACHINE_NAME + "')\n"
        machineData += "create('" + WL_MACHINE_NAME + "', 'NodeManager')\n"
        machineData += "cd('NodeManager/" + WL_MACHINE_NAME + "')\n"
        machineData += "set('NMType', 'SSL') \n"
        machineData += "set('ListenAddress', '" + WL_MACHINE_ADDR + "')\n"
        
    return machineData    
Пример #7
0
def install_atgpatch(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return False

    binary_path = full_path + "/binaries/atg11.1"
    response_files_path = full_path + "/responseFiles/atg11.1"

    print "installing " + service_name
    requiredFields = ['dynamoRoot', 'installOwner']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['dynamoRoot']
    INSTALL_OWNER = jsonData['installOwner']
    PATCH_ARCHIVE = jsonData['atg_patch_archive']
    PATCH_NAME = jsonData['atg_patch_destination']

    path_to_patch = binary_path + "/patches/" + PATCH_ARCHIVE
    patch_destination = INSTALL_DIR + "/patch/" + PATCH_NAME

    if not os.path.exists(path_to_patch):
        print "patch file " + path_to_patch + " does not exist - will not install"
        return False

    unzipCommand = "\"" + "unzip " + path_to_patch + " -d " + INSTALL_DIR + "/patch" + "\""
    chmodCmd = "\"" + "chmod 755 " + patch_destination + "/bin/install.sh" + "\""
    installCmd = "\"" + "cd " + patch_destination + "/bin; ./install.sh < " + response_files_path + "/patches/YES.txt" + "\""

    commerce_setup_helper.exec_as_user(INSTALL_OWNER, unzipCommand)
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, chmodCmd)
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCmd)
Пример #8
0
def install_java(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print service_name + " config data missing from json. will not install"
        return

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/java1.8/solaris"
    else:
        binary_path = full_path + "/binaries/java1.8"

    requiredFields = ['javaHome', 'installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    JAVA_HOME = jsonData['javaHome']

    commerce_setup_helper.mkdir_with_perms(JAVA_HOME, INSTALL_OWNER,
                                           INSTALL_GROUP)

    # solaris setup is different
    if (platform.system() == "SunOS"):
        install64bitCommand = "\"" + "cd " + JAVA_HOME + "; tar zxf " + binary_path + "/jdk-8u73-solaris-sparcv9.tar.gz " + "\""
    else:
        installCommand = "\"" + "tar zxf " + binary_path + "/jdk-8u73-linux-x64.tar.gz -C " + JAVA_HOME + "\""

    linkCommand = "\"" + "ln -sf " + JAVA_HOME + "/jdk1.8.0_73 " + JAVA_HOME + "/latest" + "\""

    if (platform.system() == "SunOS"):
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, install64bitCommand)
    else:
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    if (os.path.exists(JAVA_HOME + "/latest")
            or os.path.islink(JAVA_HOME + "/latest")):
        os.remove(JAVA_HOME + "/latest")
    os.symlink(JAVA_HOME + "/jdk1.8.0_73", JAVA_HOME + "/latest")

    # commerce_setup_helper.exec_as_user(INSTALL_OWNER, linkCommand)
    if (platform.system() != "SunOS"):
        if (os.path.exists('/usr/bin/java')
                or os.path.islink('/usr/bin/java')):
            os.remove('/usr/bin/java')
        os.symlink(JAVA_HOME + '/latest/bin/java', '/usr/bin/java')

    # add bashrc entries
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Java Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export JAVA_HOME=" + JAVA_HOME + "/latest \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export PATH=" + JAVA_HOME + "/latest/bin:$PATH \n\n")

    os.environ['JAVA_HOME'] = JAVA_HOME
    os.environ["PATH"] = JAVA_HOME + "/bin" + os.pathsep + os.environ["PATH"]
Пример #9
0
def create_servers(configData, full_path):
    """
    Create references to managed servers in the Weblogic Admin instance
    Uses WLST. Not for initial domain setup, but can be used on running domain later
    """
    if json_key in configData:
        jsonDataArray = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key +
                      " config data missing from json. will not install")
        return

    response_files_path = full_path + "/responseFiles/wls-12.1.2"

    logging.info("Updating " + service_name)

    commonRequiredFields = [
        'middlewareHome', 'installOwner', 'wl_adminUser', 'wl_adminHttpPort',
        'wl_adminHost'
        'wl_adminPassword'
    ]
    commerce_setup_helper.check_required_fields(commonData,
                                                commonRequiredFields)

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    WL_ADMIN_USER = commonData['wl_adminUser']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    WL_ADMIN_HOST = commonData['wl_adminHost']
    WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort']

    wlst_path = INSTALL_DIR + "/wlserver/common/bin/wlst.sh"

    if not os.path.exists(wlst_path):
        logging.error("Binary " + wlst_path +
                      " does not exist - will not install")
        return False

    for jsonData in jsonDataArray:

        requiredFields = [
            'managedServerName', 'managedServerHttpPort', 'managedServerHost'
        ]
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)

        WL_SERVER_NAME = jsonData['managedServerName']
        WL_SERVER_PORT = jsonData['managedServerHttpPort']
        WL_SERVER_HOST = jsonData['managedServerHost']

        wlCmd = "\"" + wlst_path + " " + response_files_path + "/createManagedServer.py -u " + WL_ADMIN_USER + \
        " -p " + WL_ADMIN_PW + " -a t3://" + WL_ADMIN_HOST + ":" + WL_ADMIN_HTTP_PORT + " -n " + WL_SERVER_NAME + " -h " + WL_SERVER_PORT + " -m " + WL_SERVER_HOST + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, wlCmd)
Пример #10
0
def create_machines(configData, full_path):
    """
    Meant to add machines to a running WebLogic domain
    """
    if json_key in configData:
        jsonDataArray = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key +
                      " config data missing from json. will not install")
        return

    response_files_path = full_path + "/responseFiles/wls-12.1.2"

    logging.info("Updating " + service_name)

    commonRequiredFields = [
        'middlewareHome', 'installOwner', 'wl_adminUser', 'wl_adminHttpPort',
        'wl_adminHost'
        'wl_adminPassword'
    ]
    commerce_setup_helper.check_required_fields(commonData,
                                                commonRequiredFields)

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    WL_ADMIN_USER = commonData['wl_adminUser']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    WL_ADMIN_HOST = commonData['wl_adminHost']
    WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort']

    wlst_path = INSTALL_DIR + "/wlserver/common/bin/wlst.sh"

    if not os.path.exists(wlst_path):
        logging.error("Binary " + wlst_path +
                      " does not exist - will not install")
        return False

    for jsonData in jsonDataArray:
        requiredFields = ['machineName', 'machineAddress']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)

        WL_MACHINE_NAME = jsonData['machineName']
        WL_MACHINE_ADDR = jsonData['machineAddress']

        wlCmd = "\"" + wlst_path + " " + response_files_path + "/createMachine.py -u " + WL_ADMIN_USER + \
        " -p " + WL_ADMIN_PW + " -a t3://" + WL_ADMIN_HOST + ":" + WL_ADMIN_HTTP_PORT + " -m " + WL_MACHINE_NAME + " -h " + WL_MACHINE_ADDR + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, wlCmd)
Пример #11
0
def install_mdex(configData, full_path):
    endecaData = configData[json_key]
    requiredFields = ['installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(endecaData, requiredFields)
    INSTALL_OWNER = endecaData['installOwner']
    INSTALL_GROUP = endecaData['installGroup']
    if 'mdex' in endecaData:
        jsonData = endecaData['mdex']
        requiredFields = ['endecaRoot']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    else:
        print service_name + " config data missing from json. will not install"
        return

    print "installing " + service_name

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/endeca11.1/solaris"
        install_exec = "/MDEX_Install/OCmdex6.5.1-Solaris_829811.sh"
    else:
        binary_path = full_path + "/binaries/endeca11.1"
        install_exec = "/MDEX_Install/OCmdex6.5.1-Linux64_829811.sh"

    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    if jsonData is not None:

        ENDECA_ROOT = jsonData['endecaRoot']
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER,
                                               INSTALL_GROUP)

        installCommand = "\"" + full_exec_path + " --target " + ENDECA_ROOT + "\""
        # print "command is " + installCommand
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

        # add bashrc entries
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "##################### \n")
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "#Endeca Settings \n")
        commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                            "##################### \n")
        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "source " + ENDECA_ROOT +
            "/endeca/MDEX/6.5.1/mdex_setup_sh.ini \n")
        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "export ENDECA_HOME=" + ENDECA_ROOT + "/endeca \n")
def config_wl_domain(configData, full_path):
    """
    Modify settings in a running domain
    """

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key +
                      " config data missing from json. will not install")
        return

    response_files_path = full_path + "/responseFiles/wls-12.1.3"

    logging.info("Updating " + service_name)

    commonRequiredFields = [
        'middlewareHome', 'installOwner', 'wl_adminUser', 'wl_adminPassword',
        'wl_domain', 'wl_adminHttpPort', 'wl_adminHost'
    ]
    commerce_setup_helper.check_required_fields(commonData,
                                                commonRequiredFields)

    requiredFields = ['jtaTimeout']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    WL_ADMIN_USER = commonData['wl_adminUser']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    WL_ADMIN_HOST = commonData['wl_adminHost']
    WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort']
    JTA_TIMEOUT = jsonData['jtaTimeout']

    wlst_path = INSTALL_DIR + "/wlserver/common/bin/wlst.sh"

    if not os.path.exists(wlst_path):
        logging.error("Binary " + wlst_path +
                      " does not exist - will not install")
        return False

    jtaCmd = "\"" + wlst_path + " " + response_files_path + "/setJTA.py -u " + WL_ADMIN_USER + \
    " -p " + WL_ADMIN_PW + " -a t3://" + WL_ADMIN_HOST + ":" + WL_ADMIN_HTTP_PORT + " -j " + JTA_TIMEOUT + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, jtaCmd)
Пример #13
0
def patch_weblogic(configData, full_path):
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return

    binary_path = full_path + "/binaries/wls-12.2.1"
    patches_path = binary_path + "/patches"
    # json key containing patch files
    patchKey = "wl_patches"

    requiredFields = ['middlewareHome', 'installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['middlewareHome']
    INSTALL_OWNER = jsonData['installOwner']
    PATCH_FILES = None

    # if the patches key was provided, get the list of patches to apply
    if patchKey in jsonData:
        PATCH_FILES = jsonData['wl_patches']

    if PATCH_FILES:
        logging.info("patching " + service_name)
        patches = PATCH_FILES.split(',')
        patchList = []
        patchScript = INSTALL_DIR + "/OPatch/opatch"
        tmpPatchDir = "/tmp/wlpatches"
        for patch in patches:
            # get list of patches - comma separated
            patchParts = patch.split('_')
            # get just the patch numbner
            patchNum = patchParts[0][1:]
            # keep a running list of all patch numbers
            patchList.append(patchNum)
            if not os.path.exists(patches_path + "/" + patch):
                logging.error("patch file " + patches_path + "/" + patch +
                              " missing - will not install")
                return
            # unzip patch to /tmp. This will create a dir with the patchNum as the name
            unzipCommand = "\"" + "unzip " + patches_path + "/" + patch + " -d " + tmpPatchDir + "\""
            commerce_setup_helper.exec_as_user(INSTALL_OWNER, unzipCommand)
        patchCommand = "\"" + patchScript + " napply " + tmpPatchDir + " -jre /usr/java/latest" + " -silent -id " + ','.join(
            patchList) + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, patchCommand)
        # cleanup our files from /tmp
        shutil.rmtree(tmpPatchDir)
Пример #14
0
def copy_keys(configData, full_path): 
    
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key + " config data missing from json. will not install")
        return

               
    requiredFields = ['fromUser', 'toUser', 'toUserGroup']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    
    FROM_USER = jsonData['fromUser']
    TO_USER = jsonData['toUser']
    TO_USER_GROUP = jsonData['toUserGroup']
    
    logging.info("Copy ssh keys from user " + FROM_USER + " to user " + TO_USER)
    commerce_setup_helper.copy_sshkeys(FROM_USER, TO_USER, TO_USER_GROUP)
Пример #15
0
def create_schema(configData, full_path): 
    
    if json_key in configData:
        jsonArray = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return
        
    for otdData in jsonArray:
        requiredFields = ['configName', 'installDir', 'adminUser', 'adminPassword', 'installOwner', 'virtualServerName', 'virtualServerPort', 'originServers', 'originPoolName', 'originServerType', 'loadDistribution', 'instanceHostname']
        commerce_setup_helper.check_required_fields(otdData, requiredFields)
        CONFIG_NAME = otdData['configName']
        INSTALL_DIR = otdData['installDir']
        INSTALL_OWNER = otdData['installOwner']
        ADMIN_USER = otdData['adminUser']
        ADMIN_PASSWORD = otdData['adminPassword']
        VSERVER_NAME = otdData['virtualServerName']
        VSERVER_PORT = otdData['virtualServerPort']
        OSERVERS = otdData['originServers']
        OPOOL_NAME = otdData['originPoolName']
        OSERVER_TYPE = otdData['originServerType']
        LOAD_ALG = otdData['loadDistribution']
        INSTANCE_HOST = otdData['instanceHostname']
        
        TADM_COMMAND = INSTALL_DIR + "/bin/tadm"
        otdPassword_replacements = {'TADM_ADMINPASSWORD':ADMIN_PASSWORD}
    
        # setup password file
        commerce_setup_helper.substitute_file_fields(full_path + '/OTD/responseFiles/otdPassword.pwd.master', full_path + '/OTD/responseFiles/otdPassword.pwd', otdPassword_replacements)
        
        # create new config
        configCommand = "\"" + TADM_COMMAND + " create-config --user="******" --password-file=" + full_path + "/OTD/responseFiles/otdPassword.pwd --listener-port=" + \
            VSERVER_PORT + " --server-name=" + VSERVER_NAME + " --origin-server=" + OSERVERS + " --origin-server-pool-name=" + OPOOL_NAME + " --origin-server-type=" + OSERVER_TYPE + " " + CONFIG_NAME + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, configCommand)
        
        # set load balancer algorithm
        loadDistCommand = "\"" + TADM_COMMAND + " set-origin-server-pool-prop --user="******" --password-file=" + full_path + "/OTD/responseFiles/otdPassword.pwd --config=" + \
            CONFIG_NAME + " --origin-server-pool=" + OPOOL_NAME + " load-distribution=" + LOAD_ALG + "\""
    
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, loadDistCommand)    
        
        # create new instance
        instanceCommand = "\"" + TADM_COMMAND + " create-instance --user="******" --password-file=" + full_path + "/OTD/responseFiles/otdPassword.pwd --config=" + CONFIG_NAME + " " + INSTANCE_HOST + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, instanceCommand)           
def pack_domain(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return

    logging.info("Packing... " + service_name)
    requiredFields = ['middlewareHome', 'installOwner', 'wl_domain']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['middlewareHome']
    INSTALL_OWNER = jsonData['installOwner']
    WL_DOMAIN_NAME = jsonData['wl_domain']

    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME
    DOMAIN_TEMPLATE_NAME = WL_DOMAIN_NAME + '-template.jar'
    DOMAIN_TEMPLATE_PATH = INSTALL_DIR + '/user_projects/domains/' + DOMAIN_TEMPLATE_NAME

    JAVA_RAND = ""
    # if linux/Solaris, change random, This is faster in some implementations.
    if (platform.system() == "SunOS"):
        JAVA_RAND = "-Djava.security.egd=file:///dev/urandom"
    else:
        JAVA_RAND = "-Djava.security.egd=file:/dev/./urandom"

    packCmd = "\""
    packCmd += "export CONFIG_JVM_ARGS='" + JAVA_RAND + "'; "
    packCmd += INSTALL_DIR + "/wlserver/common/bin/pack.sh -managed=true -domain=" + WL_DOMAIN_HOME + " -template=" + DOMAIN_TEMPLATE_PATH + " -template_name=" + WL_DOMAIN_NAME + "\""

    commerce_setup_helper.exec_as_user(INSTALL_OWNER, packCmd)

    # put a copy of the packed domain in our special users homeDir
    templateUser = "******"
    homeDir = os.path.expanduser("~" + templateUser)
    if os.path.isdir(homeDir):
        shutil.copyfile(DOMAIN_TEMPLATE_PATH,
                        homeDir + "/" + DOMAIN_TEMPLATE_NAME)
        os.chmod(homeDir + "/" + DOMAIN_TEMPLATE_NAME, 0644)
    else:
        logging.error("user " + templateUser +
                      " home dir not available. Will not copy packed domain")
Пример #17
0
def mount_storage(configData, full_path): 
    
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key + " config data missing from json. will not install")
        return
                
    logging.info("creating and mounting storage")
    
    requiredFields = ['mountPoint', 'mountOwner', 'mountGroup']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    MOUNT_POINT = jsonData['mountPoint']
    MOUNT_OWNER = jsonData['mountOwner']
    MOUNT_GROUP = jsonData['mountGroup']
    
    FSTAB_ENTRY = "/dev/xvdb        " + MOUNT_POINT + "            ext4    defaults    0 0 \n"
    
    createCmd = "mkfs -t ext4 /dev/xvdb"
    mountCmd = "mount /dev/xvdb " + MOUNT_POINT
    mountOwnerCmd = "chown " + MOUNT_OWNER + ":" + MOUNT_GROUP + " " + MOUNT_POINT
    
    if not (os.path.exists(MOUNT_POINT)):
        os.mkdir(MOUNT_POINT, 0755)    
    
    commerce_setup_helper.exec_cmd(createCmd)
    commerce_setup_helper.exec_cmd(mountCmd)
    commerce_setup_helper.exec_cmd(mountOwnerCmd)

    with open("/etc/fstab", "a") as myfile:
        myfile.write(FSTAB_ENTRY)
    myfile.close()    
      
    
    
                
Пример #18
0
def install_oracle(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return

    print "installing " + service_name

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/oracleDB12c/solaris"
    else:
        binary_path = full_path + "/binaries/oracleDB12c"

    response_files_path = full_path + "/responseFiles/oracle12c"

    install_exec = "/database/runInstaller"
    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    requiredFields = [
        'oracleBase', 'installOwner', 'installGroup', 'installHost',
        'oraInventoryDir', 'oracleHome', 'oracleSID', 'pdbName', 'adminPW',
        'dbStorageLoc'
    ]
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    ORACLE_BASE = jsonData['oracleBase']
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    INSTALL_HOST = jsonData['installHost']
    ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir']
    ORACLE_HOME = jsonData['oracleHome']
    ORACLE_SID = jsonData['oracleSID']
    PDB_NAME = jsonData['pdbName']
    ORACLE_PW = jsonData['adminPW']
    DB_FILE_DIR = jsonData['dbStorageLoc']
    ORACLE_BOOT = jsonData['db_onBoot']

    oracle_replacements = {
        'BASE_DIR': ORACLE_BASE,
        'IGROUP': INSTALL_GROUP,
        'INSTALL_HOST': INSTALL_HOST,
        'INVENTORY_DIR': ORACLE_INVENTORY_DIR,
        'PRODUCT_HOME': ORACLE_HOME,
        'GLOBAL_DBNAME': ORACLE_SID,
        'PDB_NAME': PDB_NAME,
        'ORA_PW': ORACLE_PW,
        'DB_FILE_DIR': DB_FILE_DIR,
    }

    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/db.rsp.master',
        response_files_path + '/db.rsp', oracle_replacements)
    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/dbca.rsp.master',
        response_files_path + '/dbca.rsp', oracle_replacements)

    # make the install trees with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(ORACLE_BASE, INSTALL_OWNER,
                                           INSTALL_GROUP)
    commerce_setup_helper.mkdir_with_perms(ORACLE_INVENTORY_DIR, INSTALL_OWNER,
                                           INSTALL_GROUP)
    commerce_setup_helper.mkdir_with_perms(ORACLE_HOME, INSTALL_OWNER,
                                           INSTALL_GROUP)
    commerce_setup_helper.mkdir_with_perms(DB_FILE_DIR, INSTALL_OWNER,
                                           INSTALL_GROUP)

    # install db
    installCommand = "\"" + full_exec_path + " -silent -waitforcompletion -responseFile " + response_files_path + "/db.rsp" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    invCmd = ORACLE_INVENTORY_DIR + "/orainstRoot.sh"
    commerce_setup_helper.exec_cmd(invCmd)

    rootCmd = ORACLE_HOME + "/root.sh"
    commerce_setup_helper.exec_cmd(rootCmd)

    postInstallCmd = "\"" + ORACLE_HOME + "/cfgtoollogs/configToolAllCommands RESPONSE_FILE=" + response_files_path + "/db.rsp" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, postInstallCmd)

    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#Oracle Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export ORACLE_HOME=" + ORACLE_HOME + "\n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export ORACLE_SID=" + ORACLE_SID + "\n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export PATH=$PATH:" + ORACLE_HOME + "/bin \n")

    # copy start/stop script
    script_replacements = {
        'ORACLE_HOME': ORACLE_HOME,
        'ORACLE_PROCESS_OWNER': INSTALL_OWNER
    }
    commerce_setup_helper.copy_start_script(
        ORACLE_BOOT,
        full_path + '/startStopScripts/bootScripts/oracleDatabase.master',
        script_replacements)
    # commerce_setup_helper.copy_start_script(ORACLE_BOOT, full_path + '/startStopScripts/bootScripts/oracleDBconsole.master', script_replacements)

    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "# echo " + service_name +
        " start/stop script: /etc/init.d/oracleDatabase \n")
    # not used for 12c install - using em express instead
    # commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "# echo database console start/stop script: /etc/init.d/oracleDBconsole \n\n")

    install_listener(INSTALL_OWNER, ORACLE_HOME, response_files_path)

    install_sampledb(INSTALL_OWNER, ORACLE_HOME, response_files_path)

    if (platform.system() == "SunOS"):
        oratab_file = "/var/opt/oracle/oratab"
    else:
        oratab_file = "/etc/oratab"

    # set our DB to autostart in the future
    line_to_replace = ORACLE_SID + ":" + ORACLE_HOME + ":" "N"
    replace_with = ORACLE_SID + ":" + ORACLE_HOME + ":" "Y"

    for line in fileinput.input(oratab_file, inplace=True):
        print line.rstrip().replace(line_to_replace, replace_with)
Пример #19
0
def create_wl_domain(configData, full_path): 
    
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key + " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key + " config data missing from json. will not install")
        return   

    response_files_path = full_path + "/responseFiles/wls-12.2.1"
                    
    logging.info("Creating " + service_name)               
     
    commonRequiredFields = ['middlewareHome', 'installOwner', 'wl_domain', 'wl_adminHttpPort', 'wl_adminHttpsPort', 'wl_adminPassword']
    commerce_setup_helper.check_required_fields(commonData, commonRequiredFields)
    
    requiredFields = ['wl_startAdmin_onBoot', 'wl_startNodemgr_onBoot']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)    

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    WL_DOMAIN_NAME = commonData['wl_domain']
    WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort']
    WL_ADMIN_HTTPS_PORT = commonData['wl_adminHttpsPort']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    WL_ADMIN_BOOT = jsonData['wl_startAdmin_onBoot']
    WL_NODE_BOOT = jsonData['wl_startNodemgr_onBoot']

    WL_MACHINES = add_machines(configData, full_path)
    WL_MANAGED_SERVERS = add_managed_servers(configData, full_path)

    wlst_path = INSTALL_DIR + "/oracle_common/common/bin/wlst.sh"
    
    if not os.path.exists(wlst_path):
        logging.error("Binary " + wlst_path + " does not exist - will not install")
        return False   
        
    wl_replacements = {'INSTALL_DIR':INSTALL_DIR, 'WL_DOMAIN_NAME':WL_DOMAIN_NAME, 'WL_ADMIN_HTTP_PORT':WL_ADMIN_HTTP_PORT, 'WL_ADMIN_HTTPS_PORT':WL_ADMIN_HTTPS_PORT, 'WL_ADMIN_PW':WL_ADMIN_PW, 'WL_MANAGED_SERVERS':WL_MANAGED_SERVERS, 'WL_MACHINES':WL_MACHINES}
    commerce_setup_helper.substitute_file_fields(response_files_path + '/basicWLSDomain.py.master', response_files_path + '/basicWLSDomain.py', wl_replacements)

    domainCmd = "\""
    
    JAVA_RAND = ""
    # if linux/Solaris, change random, This is faster in some implementations.
    if (platform.system() == "SunOS"):
        JAVA_RAND = "-Djava.security.egd=file:///dev/urandom"
    else:
        JAVA_RAND = "-Djava.security.egd=file:/dev/./urandom"
        
    # create wl domain CONFIG_JVM_ARGS
    domainCmd += "export CONFIG_JVM_ARGS='" + JAVA_RAND + "'; "
    domainCmd += wlst_path + " " + response_files_path + "/basicWLSDomain.py " + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, domainCmd)  
   
    if (platform.system() == 'SunOS'):
        startStopPath = "/startStopScripts/solaris/bootScripts/"
    else:
        startStopPath = "/startStopScripts/bootScripts/"
   
    # copy start/stop script
    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME
    wlScript_replacements = {'WL_DOMAIN_HOME':WL_DOMAIN_HOME, "WL_PROCESS_OWNER":INSTALL_OWNER}
    commerce_setup_helper.copy_start_script(WL_ADMIN_BOOT, full_path + startStopPath + 'weblogicAdmin.master', wlScript_replacements)
    commerce_setup_helper.copy_start_script(WL_NODE_BOOT, full_path + startStopPath + 'weblogicNodemgr.master', wlScript_replacements)
    
    # pack the domain for managed servers
    weblogic_packer.pack_domain(configData, full_path)
    
    # fire up the admin server and nodemgr 
    startWLCmd = "/etc/init.d/weblogicAdmin"
    commerce_setup_helper.exec_cmd(startWLCmd + " start")
    startNodeCmd = "/etc/init.d/weblogicNodemgr"
    commerce_setup_helper.exec_cmd(startNodeCmd + " start")
    
    # give admin server time to finish starting
    sleepTime = 60
    time.sleep(sleepTime)
    
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "# echo 'WebLogic Admin start/stop script: '" + startWLCmd + "\n")    
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "# echo 'WebLogic NodeManager start/stop script: '" + startNodeCmd + "\n")   
def unpack_domain(configData, full_path):
    """
    Get domain template and unpack it for a new managed server setup
    """
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        print common_key + " config data missing from json. will not install"
        return

    print "Unpacking... " + service_name

    commonRequiredFields = [
        'middlewareHome', 'installOwner', 'installGroup', 'wl_domain',
        'wl_adminHost'
    ]
    commerce_setup_helper.check_required_fields(commonData,
                                                commonRequiredFields)

    requiredFields = ['wl_startNodemgr_onBoot']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    INSTALL_GROUP = commonData['installGroup']
    WL_DOMAIN_NAME = commonData['wl_domain']
    WL_ADMIN_HOST = commonData['wl_adminHost']
    WL_NODE_BOOT = jsonData['wl_startNodemgr_onBoot']

    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME
    DOMAIN_TEMPLATE_NAME = WL_DOMAIN_NAME + '-template.jar'
    DOMAIN_TEMPLATE_PATH = INSTALL_DIR + '/user_projects/domains/' + DOMAIN_TEMPLATE_NAME

    if not os.path.isfile(DOMAIN_TEMPLATE_PATH):
        print "domain template not found. Try to get it"
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(WL_DOMAIN_HOME, INSTALL_OWNER,
                                               INSTALL_GROUP)
        retrieve_domain_template(DOMAIN_TEMPLATE_NAME, DOMAIN_TEMPLATE_PATH,
                                 WL_ADMIN_HOST)

    unpackCmd = "\"" + INSTALL_DIR + "/wlserver/common/bin/unpack.sh -domain=" + WL_DOMAIN_HOME + " -template=" + WL_DOMAIN_HOME + "-template.jar\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, unpackCmd)

    # copy start/stop script
    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME

    if (platform.system() == 'SunOS'):
        startStopPath = "/startStopScripts/solaris/bootScripts/"
    else:
        startStopPath = "/startStopScripts/bootScripts/"
    # copy start/stop script
    WL_DOMAIN_HOME = INSTALL_DIR + '/user_projects/domains/' + WL_DOMAIN_NAME
    wlScript_replacements = {
        'WL_DOMAIN_HOME': WL_DOMAIN_HOME,
        "WL_PROCESS_OWNER": INSTALL_OWNER
    }
    commerce_setup_helper.copy_start_script(
        WL_NODE_BOOT, full_path + startStopPath + 'weblogicNodemgr.master',
        wlScript_replacements)

    # fire up the nodemgr
    startNodeCmd = "/etc/init.d/weblogicNodemgr"
    commerce_setup_helper.exec_cmd(startNodeCmd + " start")
Пример #21
0
def install_weblogic(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return

    print "installing " + service_name

    binary_path = full_path + "/binaries/wls-12.1.3"
    response_files_path = full_path + "/responseFiles/wls-12.1.3"
    install_exec = "fmw_12.1.3.0.0_wls.jar"
    full_exec_path = binary_path + "/" + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    requiredFields = [
        'middlewareHome', 'installOwner', 'installGroup', 'oraInventoryDir'
    ]
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['middlewareHome']
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir']
    ORA_INST = "/etc/oraInst.loc"

    oraInst_replacements = {
        'ORACLE_INVENTORY_DIR': ORACLE_INVENTORY_DIR,
        'ORACLE_INVENTORY_GROUP': INSTALL_GROUP
    }

    # if oraInst.loc doesn't already exist, we need to make one
    if not os.path.isfile(ORA_INST):
        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/oraInst.loc.master',
            response_files_path + '/oraInst.loc', oraInst_replacements)
        shutil.copyfile(response_files_path + "/oraInst.loc", ORA_INST)
        commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER,
                                                INSTALL_GROUP)
        os.chmod(ORA_INST, 0664)

    wl_replacements = {'INSTALL_DIR': INSTALL_DIR}
    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/install.rsp.master',
        response_files_path + '/install.rsp', wl_replacements)

    # make the install tree with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER,
                                           INSTALL_GROUP)

    # install wl
    if (platform.system() == 'SunOS'):
        installCommand = "\"" + "java -d64 -jar "
    else:
        installCommand = "\"" + "java -jar "
    installCommand = installCommand + full_exec_path + " -silent -invPtrLoc " + ORA_INST + " -responseFile " + response_files_path + "/install.rsp -logfile wlinstall.log" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#WebLogic Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export MW_HOME=" + INSTALL_DIR + "\n\n")

    # install patches if any were listed
    patch_weblogic(configData, full_path)
Пример #22
0
def generate_atg_server_layers(configData, full_path):
    """
    Create ATG server layers based on the instance type
    """
    # we need the server defs, and the path to the ATG install
    wl_managed_key = "WEBLOGIC_managed_servers"
    atg_key = "ATG_install"

    if wl_managed_key in configData:
        managedServerArray = configData[wl_managed_key]
    else:
        logger.error(wl_managed_key +
                     " missing from json. will not create atg server layers")
        return ''

    if atg_key in configData:
        atgData = configData[atg_key]
    else:
        logger.error(atg_key +
                     " missing from json. will not create atg server layers")
        return ''

    ATG_INSTALL_ROOT = atgData['dynamoRoot']
    ATG_CLUSTER_NAME = atgData['atg_clustername']
    ATG_INSTALL_OWNER = atgData['installOwner']
    ATG_SERVERS_HOME = ATG_INSTALL_ROOT + "/home/servers"

    logger.info("Creating ATG Server layers")
    serverData = ''

    PROD_LOCK_PORTS_ARRAY = []
    PROD_LOCK_SERVERS_ARRAY = []

    # calculate lock server data first. We need this for all other instances
    for jsonData in managedServerArray:
        requiredFields = ['atgServerType']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
        ATG_SERVER_TYPE = jsonData['atgServerType']
        if (ATG_SERVER_TYPE == "lock"):
            PROD_LOCK_PORTS_ARRAY.append(jsonData['atgLockManPort'])
            PROD_LOCK_SERVERS_ARRAY.append(jsonData['managedServerHost'])

    for jsonData in managedServerArray:
        requiredFields = [
            'managedServerName', 'managedServerHttpPort',
            'managedServerHttpsPort', 'managedServerHost', 'atgServerType',
            'atgRmiPort', 'atgFdPort', 'atgDrpPort'
        ]
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)

        WL_SERVER_NAME = jsonData['managedServerName']
        WL_SERVER_HTTP_PORT = jsonData['managedServerHttpPort']
        WL_SERVER_HTTPS_PORT = jsonData['managedServerHttpsPort']
        WL_SERVER_HOST = jsonData['managedServerHost']
        ATG_SERVER_TYPE = jsonData['atgServerType']
        ATG_RMI_PORT = jsonData['atgRmiPort']
        ATG_FD_PORT = jsonData['atgFdPort']
        ATG_DRP_PORT = jsonData['atgDrpPort']
        BCC_FILE_PORT = ""
        BCC_LOCK_PORT = ""
        ATG_LOCK_PORT = ""
        if 'bccFileSyncPort' in jsonData:
            BCC_FILE_PORT = jsonData['bccFileSyncPort']
        if 'bccLockPort' in jsonData:
            BCC_LOCK_PORT = jsonData['bccLockPort']
        if 'atgLockManPort' in jsonData:
            ATG_LOCK_PORT = jsonData['atgLockManPort']

        PROD_LOCK_PORTS = ','.join(PROD_LOCK_PORTS_ARRAY)
        PROD_LOCK_SERVERS = ','.join(PROD_LOCK_SERVERS_ARRAY)

        server_layer_path = full_path + "/atg-server-layers/"

        cpCmd = "\"" + "cp -R " + server_layer_path + ATG_SERVER_TYPE + " " + ATG_SERVERS_HOME + "/" + WL_SERVER_NAME + "\""
        commerce_setup_helper.exec_as_user(ATG_INSTALL_OWNER, cpCmd)

        #distutils.dir_util.copy_tree(server_layer_path + ATG_SERVER_TYPE , ATG_SERVERS_HOME + "/" + WL_SERVER_NAME)
        string_replacements = {'ATG_DRP_PORT':ATG_DRP_PORT, 'ATG_RMI_PORT':ATG_RMI_PORT, 'ATG_FD_PORT':ATG_FD_PORT, 'ATG_HTTP_PORT':WL_SERVER_HTTP_PORT, \
                               'ATG_HTTPS_PORT':WL_SERVER_HTTPS_PORT, 'BCC_FILE_SYNC_PORT':BCC_FILE_PORT, 'BCC_LOCK_PORT':BCC_LOCK_PORT, \
                               'ATG_CLUSTER_NAME':ATG_CLUSTER_NAME, 'PROD_LOCK_PORTS':PROD_LOCK_PORTS, 'PROD_LOCK_SERVERS':PROD_LOCK_SERVERS}

        for dname, dirs, files in os.walk(ATG_SERVERS_HOME + "/" +
                                          WL_SERVER_NAME):
            for fname in files:
                fpath = os.path.join(dname, fname)
                commerce_setup_helper.substitute_file_fields_inplace(
                    fpath, string_replacements)

    return serverData
Пример #23
0
def install_atg(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key +
                      " config data missing from json. will not install")
        return False

    logging.info("installing " + service_name)
    binary_path = full_path + "/binaries/atg11.3"
    response_files_path = full_path + "/responseFiles/atg11.3"
    install_exec = "/linux/OCPlatform11.3.bin"
    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        logging.error("Binary " + full_exec_path +
                      " does not exist - will not install")
        return False

    requiredFields = [
        'dynamoRoot', 'installOwner', 'installGroup', 'rmiPort', 'javaHome',
        'wl_home', 'wl_domain', 'wl_adminPort', 'install_crs', 'install_csa'
    ]
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['dynamoRoot']
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    RMI_PORT = jsonData['rmiPort']
    JAVA_DIR = jsonData['javaHome']
    WL_HOME = jsonData['wl_home']
    WL_DOMAIN = jsonData['wl_domain']
    WL_ADMIN_PORT = jsonData['wl_adminPort']
    INSTALL_CRS = jsonData['install_crs']
    INSTALL_CSA = jsonData['install_csa']
    INSTALL_SERVICE = jsonData['install_service']

    field_replacements = {
        'INSTALL_HOME': INSTALL_DIR,
        'WEBLOGIC_HOME': WL_HOME,
        'WEBLOGIC_DOMAIN': WL_DOMAIN,
        'WEBLOGIC_ADMIN_PORT': WL_ADMIN_PORT,
        'ATGRMI_PORT': RMI_PORT,
        'JDK_PATH': JAVA_DIR
    }
    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/linux/installer.properties.master',
        response_files_path + '/linux/installer.properties',
        field_replacements)

    # make the install tree with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER,
                                           INSTALL_GROUP)

    installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + "/linux/installer.properties" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#ATG Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export DYNAMO_ROOT=" + INSTALL_DIR + "\n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export DYNAMO_HOME=$DYNAMO_ROOT/home \n\n")

    if (INSTALL_CRS == "true"):
        logging.info("installing CRS")
        crs_exec_path = binary_path + "/crs/OCReferenceStore11.3.bin"
        if not os.path.exists(crs_exec_path):
            logging.error("Binary " + crs_exec_path +
                          " does not exist - will not install")
            return False
        field_replacements = {'INSTALL_HOME': INSTALL_DIR}
        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/crs/crsinstaller.properties.master',
            response_files_path + '/crs/crsinstaller.properties',
            field_replacements)
        installCommand = "\"" + crs_exec_path + " -i silent -f " + response_files_path + "/crs/crsinstaller.properties" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    if (INSTALL_CSA == "true"):
        logging.info("installing CSA")
        csa_exec_path = binary_path + "/csa/OCStoreAccelerator11.3.bin"
        if not os.path.exists(csa_exec_path):
            logging.error("Binary " + csa_exec_path +
                          " does not exist - will not install")
            return False
        field_replacements = {'INSTALL_HOME': INSTALL_DIR}
        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/csa/csainstaller.properties.master',
            response_files_path + '/csa/csainstaller.properties',
            field_replacements)
        installCommand = "\"" + csa_exec_path + " -i silent -f " + response_files_path + "/csa/csainstaller.properties" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    if (INSTALL_SERVICE == "true"):

        logging.info("installing Service")

        service_exec_path = binary_path + "/service/OCServiceCenter11.3.bin"
        if not os.path.exists(service_exec_path):
            logging.error("Binary " + service_exec_path +
                          " does not exist - will not install")
            return

        field_replacements = {'INSTALL_HOME': INSTALL_DIR}
        commerce_setup_helper.substitute_file_fields(
            response_files_path +
            '/service/serviceinstaller.properties.master',
            response_files_path + '/service/serviceinstaller.properties',
            field_replacements)
        installCommand = "\"" + service_exec_path + " -i silent -f " + response_files_path + "/service/serviceinstaller.properties" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)
Пример #24
0
def install_atg(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return False

    print "installing " + service_name

    binary_path = full_path + "/binaries/atg11.1"
    response_files_path = full_path + "/responseFiles/atg11.1"
    install_exec = "/linux/OCPlatform11.1.bin"
    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    requiredFields = [
        'dynamoRoot', 'installOwner', 'installGroup', 'rmiPort', 'javaHome',
        'wl_home', 'wl_domain', 'wl_adminPort', 'install_crs'
    ]
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['dynamoRoot']
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    RMI_PORT = jsonData['rmiPort']
    JAVA_DIR = jsonData['javaHome']
    WL_HOME = jsonData['wl_home']
    WL_DOMAIN = jsonData['wl_domain']
    WL_ADMIN_PORT = jsonData['wl_adminPort']
    INSTALL_CRS = jsonData['install_crs']
    INSTALL_SERVICE = jsonData['install_service']

    field_replacements = {
        'INSTALL_HOME': INSTALL_DIR,
        'WEBLOGIC_HOME': WL_HOME,
        'WEBLOGIC_DOMAIN': WL_DOMAIN,
        'WEBLOGIC_ADMIN_PORT': WL_ADMIN_PORT,
        'ATGRMI_PORT': RMI_PORT,
        'JDK_PATH': JAVA_DIR
    }
    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/linux/installer.properties.master',
        response_files_path + '/linux/installer.properties',
        field_replacements)

    # make the install tree with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER,
                                           INSTALL_GROUP)

    installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + "/linux/installer.properties" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#ATG Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER,
                                        "##################### \n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export DYNAMO_ROOT=" + INSTALL_DIR + "\n")
    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER, "export DYNAMO_HOME=$DYNAMO_ROOT/home \n\n")

    if (INSTALL_CRS == "true"):

        print "installing CRS"

        crs_exec_path = binary_path + "/crs/OCReferenceStore11.1.bin"
        if not os.path.exists(crs_exec_path):
            print "Binary " + crs_exec_path + " does not exist - will not install"
            return

        field_replacements = {'INSTALL_HOME': INSTALL_DIR}
        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/crs/crsinstaller.properties.master',
            response_files_path + '/crs/crsinstaller.properties',
            field_replacements)
        installCommand = "\"" + crs_exec_path + " -i silent -f " + response_files_path + "/crs/crsinstaller.properties" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

        # If patch1 is installed, these are not updated. fix it.
        cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Storefront/j2ee-apps/Storefront/store.war/WEB-INF/lib" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd)
        cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Storefront/j2ee-apps/Storefront/storedocroot.war/WEB-INF/lib" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd)
        cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/Fluoroscope/j2ee-apps/Fluoroscope/fluoroscope.war/WEB-INF/lib" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd)
        cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/DCS-CSR/j2ee-apps/DCS-CSR/CSRHelper.war/WEB-INF/lib" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd)
        cpCmd = "\"" + "cp " + INSTALL_DIR + "/DAS/taglib/dspjspTaglib/1.0/lib/dspjspTaglib1_0.jar " + INSTALL_DIR + "/CommerceReferenceStore/Store/EStore/Versioned/j2ee-apps/Versioned/store-merchandising.war/WEB-INF/lib" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, cpCmd)

    if (INSTALL_SERVICE == "true"):

        print "installing Service"

        service_exec_path = binary_path + "/service/OCServiceCenter11.1.bin"
        if not os.path.exists(service_exec_path):
            print "Binary " + service_exec_path + " does not exist - will not install"
            return

        field_replacements = {'INSTALL_HOME': INSTALL_DIR}
        commerce_setup_helper.substitute_file_fields(
            response_files_path +
            '/service/serviceinstaller.properties.master',
            response_files_path + '/service/serviceinstaller.properties',
            field_replacements)
        installCommand = "\"" + service_exec_path + " -i silent -f " + response_files_path + "/service/serviceinstaller.properties" + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)
Пример #25
0
def install_otd(configData, full_path):

    if json_key in configData:
        jsonData = configData[json_key]
    else:
        print json_key + " config data missing from json. will not install"
        return False

    print "installing " + service_name

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/OTD11.1.1.9/solaris"
    else:
        binary_path = full_path + "/binaries/OTD11.1.1.9"

    install_exec = "/Disk1/runInstaller"

    response_files_path = full_path + "/responseFiles/OTD11"

    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    requiredFields = [
        'instanceHome', 'installDir', 'adminUser', 'installOwner',
        'adminPassword', 'oraInventoryDir'
    ]
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_OWNER = jsonData['installOwner']
    INSTANCE_HOME = jsonData['instanceHome']
    INSTALL_DIR = jsonData['installDir']
    ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir']
    ORACLE_INVENTORY_GROUP = jsonData['oraInventoryGroup']
    ADMIN_USER = jsonData['adminUser']
    ADMIN_PASSWORD = jsonData['adminPassword']
    OTD_ADMIN_BOOT = jsonData['otd_startAdmin_onBoot']
    ORA_INST = "/etc/oraInst.loc"
    OTD_INSTANCE_NAME = "admin-server"

    oraInst_replacements = {
        'ORACLE_INVENTORY_DIR': ORACLE_INVENTORY_DIR,
        'ORACLE_INVENTORY_GROUP': ORACLE_INVENTORY_GROUP
    }
    otdPassword_replacements = {'TADM_ADMINPASSWORD': ADMIN_PASSWORD}

    # if oraInst.loc doesn't already exist, we need to make one
    if not os.path.isfile(ORA_INST):
        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/oraInst.loc.master',
            response_files_path + '/oraInst.loc', oraInst_replacements)
        shutil.copyfile(response_files_path + "/oraInst.loc", ORA_INST)
        commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER,
                                                ORACLE_INVENTORY_GROUP)
        os.chmod(ORA_INST, 0664)

    # make the install tree with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER,
                                           ORACLE_INVENTORY_GROUP)

    # exec the install command
    installCommand = "\"" + binary_path + "/Disk1/runInstaller -silent -waitforcompletion -invPtrLoc /etc/oraInst.loc ORACLE_HOME=" + INSTALL_DIR + " SKIP_SOFTWARE_UPDATES=true\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

    # setup password file
    commerce_setup_helper.substitute_file_fields(
        response_files_path + '/otdPassword.pwd.master',
        response_files_path + '/otdPassword.pwd', otdPassword_replacements)

    # exec base admin server creation
    configCommand = "\"" + INSTALL_DIR + "/bin/tadm configure-server --user="******" --instance-home=" + INSTANCE_HOME + " --password-file=" + response_files_path + "/otdPassword.pwd\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, configCommand)

    if (platform.system() == 'SunOS'):
        startStopPath = "/startStopScripts/solaris/bootScripts/"
    else:
        startStopPath = "/startStopScripts/bootScripts/"

    # copy start/stop script
    otdScript_replacements = {
        'OTD_PROCESS_OWNER': INSTALL_OWNER,
        'OTD_INSTANCE_HOME': INSTANCE_HOME,
        'OTD_INSTANCE_NAME': OTD_INSTANCE_NAME
    }
    commerce_setup_helper.copy_start_script(
        OTD_ADMIN_BOOT, full_path + startStopPath + 'OTDAdmin.master',
        otdScript_replacements)

    # fire up the otd admin server
    startCmd = "/etc/init.d/OTDAdmin"
    commerce_setup_helper.exec_cmd(startCmd + " start")

    commerce_setup_helper.add_to_bashrc(
        INSTALL_OWNER,
        "# echo " + service_name + " start/stop script: " + startCmd + "\n\n")
Пример #26
0
def install_toolsAndFramework(configData, full_path):

    endecaData = configData[json_key]
    requiredFields = ['installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(endecaData, requiredFields)
    INSTALL_OWNER = endecaData['installOwner']
    INSTALL_GROUP = endecaData['installGroup']
    if 'toolsAndFramework' in endecaData:
        jsonData = endecaData['toolsAndFramework']
        requiredFields = ['endecaRoot']
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    else:
        logging.error(service_name +
                      " config data missing from json. will not install")
        return

    logging.info("installing " + service_name)

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/endeca11.3/solaris"
    else:
        binary_path = full_path + "/binaries/endeca11.3"

    install_exec = "/ToolsAndFrameworkInstall/Disk1/install/silent_install.sh"

    response_files_path = full_path + "/responseFiles/endeca11.3"

    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        logging.error("Binary " + full_exec_path +
                      " does not exist - will not install")
        return False

    if jsonData is not None:
        ENDECA_ROOT = jsonData['endecaRoot']
        START_ON_BOOT = jsonData['start_onBoot']
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER,
                                               INSTALL_GROUP)

        # data field to replace in our silent installer file
        field_replacements = {
            'ENDECA_ROOT': ENDECA_ROOT,
            'ENDECA_GROUP': INSTALL_GROUP
        }

        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/tools_response.rsp.master',
            response_files_path + '/tools_response.rsp', field_replacements)

        installCommand = "\"" + full_exec_path + " " + \
        response_files_path + "/tools_response.rsp ToolsAndFrameworks " + \
        ENDECA_ROOT + "/endeca/ToolsAndFrameworks "

        if 'oraInventoryDir' in jsonData:
            installCommand = installCommand + jsonData['oraInventoryDir']

        commerce_setup_helper.exec_as_user(INSTALL_OWNER,
                                           installCommand + "\"")

        # copy start/stop script
        ENDECA_HOME = ENDECA_ROOT + "/endeca"
        MDEX_SETUP = ENDECA_HOME + "/MDEX/11.3.0/mdex_setup_sh.ini"
        PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini"
        script_replacements = {
            'ENDECA_PROCESS_OWNER': INSTALL_OWNER,
            'ENDECA_INSTALL_ROOT': ENDECA_HOME,
            "MDEX_SETUP": MDEX_SETUP,
            "PLATFORM_SETUP": PLATFORM_SETUP,
            "INSTALL_VERSION": endeca_version
        }
        commerce_setup_helper.copy_start_script(
            START_ON_BOOT, full_path +
            '/startStopScripts/bootScripts/toolsAndFramework.master',
            script_replacements)

        # fire up the server
        startCmd = "/etc/init.d/toolsAndFramework"
        commerce_setup_helper.exec_cmd(startCmd + " start")

        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "# echo Endeca " + service_name +
            " start/stop script: " + startCmd + "\n")
Пример #27
0
def config_wl_datasources(configData, full_path): 

    """
    Modify settings in a running domain
    Creates datasources
    """   
        
    if json_key in configData:
        dsData = configData[json_key]
    else:
        logging.error(json_key + " config data missing from json. will not install")
        return

    if common_key in configData:
        commonData = configData[common_key]
    else:
        logging.error(common_key + " config data missing from json. will not install")
        return  

    response_files_path = full_path + "/responseFiles/wls-12.2.1"
                    
    logging.info("Updating " + service_name)    
                
    commonRequiredFields = ['middlewareHome', 'installOwner', 'wl_adminUser', 'wl_adminPassword', 'wl_domain', 'wl_adminHttpPort', 'wl_adminHost']
    commerce_setup_helper.check_required_fields(commonData, commonRequiredFields)
    
    INSTALL_DIR = commonData['middlewareHome']
    INSTALL_OWNER = commonData['installOwner']
    WL_ADMIN_USER = commonData['wl_adminUser']
    WL_ADMIN_PW = commonData['wl_adminPassword']
    WL_ADMIN_HOST = commonData['wl_adminHost']
    WL_ADMIN_HTTP_PORT = commonData['wl_adminHttpPort']  

    wlst_path = INSTALL_DIR + "/oracle_common/common/bin/wlst.sh"
    
    if not os.path.exists(wlst_path):
        logging.error("Binary " + wlst_path + " does not exist - will not install")
        return False   
        
    # datasource is an array type. look through them all
    for jsonData in dsData:
        requiredFields = ["dsName", "dsJNDIName", "dsURL", "dsDriver", "dsUsername", "dsPassword", "dsTargetNames", "dsMaxCapacity"]
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)    

        dsName = jsonData['dsName']
        dsJNDIName = jsonData['dsJNDIName']
        dsURL = jsonData['dsURL']
        dsDriver = jsonData['dsDriver']
        dsUsername = jsonData['dsUsername']
        dsPassword = jsonData['dsPassword']
        dsTargetNames = jsonData['dsTargetNames']
        dsMaxCapacity = jsonData['dsMaxCapacity'] 
        
        # add login params
        cmd_flags = "--wlusername="******" --wlpassword="******" --adminUrl=t3://" + WL_ADMIN_HOST + ":" + WL_ADMIN_HTTP_PORT
        # add ds creation flags
        cmd_flags += " --dsName=" + dsName + " --dsJNDIName=" + dsJNDIName + " --dsURL=" + dsURL + " --dsDriver=" + dsDriver + " --dsUsername="******" --dsPassword="******" --dsTargetNames=" + dsTargetNames + " --dsMaxCapacity=" + dsMaxCapacity
           
        dsCmd = "\"" + wlst_path + " " + response_files_path + "/create_datasources.py " + cmd_flags + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, dsCmd)  
def install_weblogic(configData, full_path): 
    
    if json_key in configData:
        jsonData = configData[json_key]
    else:
        logging.error(json_key + " config data missing from json. will not install")
        return False

    logging.info("installing " + service_name)
    
    binary_path = full_path + "/binaries/wls-12.1.2"
    response_files_path = full_path + "/responseFiles/wls-12.1.2"
    install_exec = "wls_121200.jar"
    full_exec_path = binary_path + "/" + install_exec
    
    if not os.path.exists(full_exec_path):
        logging.error("Binary " + full_exec_path + " does not exist - will not install")
        return False
                    
                    
    requiredFields = ['middlewareHome', 'installOwner', 'installGroup', 'oraInventoryDir']
    commerce_setup_helper.check_required_fields(jsonData, requiredFields)

    INSTALL_DIR = jsonData['middlewareHome']
    INSTALL_OWNER = jsonData['installOwner']
    INSTALL_GROUP = jsonData['installGroup']
    ORACLE_INVENTORY_DIR = jsonData['oraInventoryDir']
    ORA_INST = "/etc/oraInst.loc"
    
    oraInst_replacements = {'ORACLE_INVENTORY_DIR':ORACLE_INVENTORY_DIR, 'ORACLE_INVENTORY_GROUP':INSTALL_GROUP}
    
    # if oraInst.loc doesn't already exist, we need to make one
    if not os.path.isfile(ORA_INST):
        commerce_setup_helper.substitute_file_fields(response_files_path + '/oraInst.loc.master', response_files_path + '/oraInst.loc', oraInst_replacements)
        shutil.copyfile(response_files_path + "/oraInst.loc" , ORA_INST)
        commerce_setup_helper.change_file_owner(ORA_INST, INSTALL_OWNER, INSTALL_GROUP)
        os.chmod(ORA_INST, 0664) 
        
    wl_replacements = {'INSTALL_DIR':INSTALL_DIR}
    commerce_setup_helper.substitute_file_fields(response_files_path + '/install.rsp.master', response_files_path + '/install.rsp', wl_replacements)
    
    # make the install tree with correct owner if needed
    commerce_setup_helper.mkdir_with_perms(INSTALL_DIR, INSTALL_OWNER, INSTALL_GROUP)
        
    # install wl
    if (platform.system() == 'SunOS'):
        installCommand = "\"" + "java -d64 -jar "
    else:
        installCommand = "\"" + "java -jar "
    installCommand = installCommand + full_exec_path + " -silent -invPtrLoc " + ORA_INST + " -responseFile " + response_files_path + "/install.rsp -logfile wlinstall.log" + "\""
    commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)
    
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "#WebLogic Settings \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "##################### \n")
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, "export MW_HOME=" + INSTALL_DIR + "\n\n")
    
    JAVA_RAND = ""
    # if linux/Solaris, change random, This is faster in some implementations.
    if (platform.system() == "SunOS"):
        JAVA_RAND = "-Djava.security.egd=file:///dev/urandom"
    else:
        JAVA_RAND = "-Djava.security.egd=file:/dev/./urandom"
            
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, 'export CONFIG_JVM_ARGS=\"' + JAVA_RAND + ' \" \n')
    commerce_setup_helper.add_to_bashrc(INSTALL_OWNER, 'export JAVA_OPTIONS=\"' + JAVA_RAND + ' \" \n')    
    
    # install patches if any were listed
    patch_weblogic(configData, full_path)
Пример #29
0
def install_cas(configData, full_path):

    endecaData = configData[json_key]
    requiredFields = ['installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(endecaData, requiredFields)
    INSTALL_OWNER = endecaData['installOwner']
    INSTALL_GROUP = endecaData['installGroup']
    if service_key in endecaData:
        jsonData = endecaData[service_key]
        requiredFields = [
            'endecaRoot', 'casPort', 'casShutdownPort', 'casHostname'
        ]
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    else:
        print service_name + " config data missing from json. will not install"
        return

    print "installing " + service_name

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/endeca11.1/solaris"
        install_exec = "/CAS_Install/OCcas11.1.0-Solaris.sh"
    else:
        binary_path = full_path + "/binaries/endeca11.1"
        install_exec = "/CAS_Install/OCcas11.1.0-Linux64.sh"

    response_files_path = full_path + "/responseFiles/endeca11.1"

    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        print "Binary " + full_exec_path + " does not exist - will not install"
        return False

    if jsonData is not None:

        ENDECA_ROOT = jsonData['endecaRoot']
        CAS_PORT = jsonData['casPort']
        CAS_SHUTDOWN_PORT = jsonData['casShutdownPort']
        CAS_HOSTNAME = jsonData['casHostname']
        START_ON_BOOT = jsonData['start_onBoot']
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER,
                                               INSTALL_GROUP)

        # data field to replace in our silent installer file
        field_replacements = {
            'ENDECA_ROOT': ENDECA_ROOT,
            'CAS_PORT': CAS_PORT,
            'CAS_SHUTDOWN_PORT': CAS_SHUTDOWN_PORT,
            'CAS_HOST': CAS_HOSTNAME
        }

        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/cas_silent.txt.master',
            response_files_path + '/cas_silent.txt', field_replacements)

        installCommand = "\"" + full_exec_path + " --silent --target " + ENDECA_ROOT + \
        " --endeca_tools_root " + ENDECA_ROOT + "/endeca/ToolsAndFrameworks/11.1.0 --endeca_tools_conf " + ENDECA_ROOT + "/endeca/ToolsAndFrameworks/11.1.0/server/workspace < " + \
        response_files_path + "/cas_silent.txt \""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

        if (platform.system() == 'SunOS'):
            startStopPath = "/startStopScripts/solaris/bootScripts/"
        else:
            startStopPath = "/startStopScripts/bootScripts/"

        # copy start/stop script
        ENDECA_HOME = ENDECA_ROOT + "/endeca"
        MDEX_SETUP = ENDECA_HOME + "/MDEX/6.5.1/mdex_setup_sh.ini"
        PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini"
        script_replacements = {
            'ENDECA_PROCESS_OWNER': INSTALL_OWNER,
            'ENDECA_INSTALL_ROOT': ENDECA_HOME,
            "MDEX_SETUP": MDEX_SETUP,
            "PLATFORM_SETUP": PLATFORM_SETUP
        }
        commerce_setup_helper.copy_start_script(
            START_ON_BOOT, full_path + startStopPath + 'endecaCAS.master',
            script_replacements)

        # restart other services before cas
        platformCmd = "/etc/init.d/platformServices"
        toolsCmd = "/etc/init.d/toolsAndFramework"
        commerce_setup_helper.exec_cmd(toolsCmd + " stop")
        commerce_setup_helper.exec_cmd(platformCmd + " restart")
        commerce_setup_helper.exec_cmd(toolsCmd + " start")
        # start cas
        startCmd = "/etc/init.d/endecaCAS"
        commerce_setup_helper.exec_cmd(startCmd + " start")

        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "# echo Endeca " + service_name +
            " start/stop script: " + startCmd + "\n")
Пример #30
0
def install_platformServices(configData, full_path):

    endecaData = configData[json_key]
    requiredFields = ['installOwner', 'installGroup']
    commerce_setup_helper.check_required_fields(endecaData, requiredFields)
    INSTALL_OWNER = endecaData['installOwner']
    INSTALL_GROUP = endecaData['installGroup']
    if 'platformServices' in endecaData:
        jsonData = endecaData['platformServices']
        requiredFields = [
            'endecaRoot', 'eacPort', 'eacShutdownPort', 'mdexRoot'
        ]
        commerce_setup_helper.check_required_fields(jsonData, requiredFields)
    else:
        logging.error(service_name +
                      " config data missing from json. will not install")
        return

    logging.info("installing " + service_name)

    if (platform.system() == "SunOS"):
        binary_path = full_path + "/binaries/endeca11.3/solaris"
        install_exec = "/Platform_Install/OCplatformservices11.3.0-Solaris.bin"
    else:
        binary_path = full_path + "/binaries/endeca11.3"
        install_exec = "/Platform_Install/OCplatformservices11.3.0-Linux64.bin"

    response_files_path = full_path + "/responseFiles/endeca11.3"

    full_exec_path = binary_path + install_exec

    if not os.path.exists(full_exec_path):
        logging.error("Binary " + full_exec_path +
                      " does not exist - will not install")
        return False

    if jsonData is not None:
        ENDECA_ROOT = jsonData['endecaRoot']
        MDEX_ROOT = jsonData['mdexRoot']
        EAC_PORT = jsonData['eacPort']
        EAC_SHUTDOWN_PORT = jsonData['eacShutdownPort']
        START_ON_BOOT = jsonData['start_onBoot']
        # make the install tree with correct owner if needed
        commerce_setup_helper.mkdir_with_perms(ENDECA_ROOT, INSTALL_OWNER,
                                               INSTALL_GROUP)

        # data field to replace in our silent installer file
        field_replacements = {
            'INSTALLATION_DIR': ENDECA_ROOT,
            'MDEX_INST_ROOT': MDEX_ROOT,
            'EAC_PORT': EAC_PORT,
            'EAC_SHUTDOWN_PORT': EAC_SHUTDOWN_PORT
        }

        commerce_setup_helper.substitute_file_fields(
            response_files_path + '/platform_response.rsp.master',
            response_files_path + '/platform_response.rsp', field_replacements)

        installCommand = "\"" + full_exec_path + " -i silent -f " + response_files_path + '/platform_response.rsp' + "\""
        commerce_setup_helper.exec_as_user(INSTALL_OWNER, installCommand)

        # add bashrc entries
        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "source " + ENDECA_ROOT +
            "/endeca/PlatformServices/workspace/setup/installer_sh.ini \n")

        # copy start/stop script
        ENDECA_HOME = ENDECA_ROOT + "/endeca"
        MDEX_SETUP = MDEX_ROOT + "/mdex_setup_sh.ini"
        PLATFORM_SETUP = ENDECA_HOME + "/PlatformServices/workspace/setup/installer_sh.ini"
        script_replacements = {
            'ENDECA_PROCESS_OWNER': INSTALL_OWNER,
            'ENDECA_INSTALL_ROOT': ENDECA_HOME,
            "MDEX_SETUP": MDEX_SETUP,
            "PLATFORM_SETUP": PLATFORM_SETUP,
            "INSTALL_VERSION": endeca_version
        }
        commerce_setup_helper.copy_start_script(
            START_ON_BOOT, full_path +
            '/startStopScripts/bootScripts/platformServices.master',
            script_replacements)

        # fire up the server
        startCmd = "/etc/init.d/platformServices"
        commerce_setup_helper.exec_cmd(startCmd + " start")

        commerce_setup_helper.add_to_bashrc(
            INSTALL_OWNER, "# echo Endeca " + service_name +
            " start/stop script: " + startCmd + "\n")