def build_linux_server_check_list(self, applicationGroup, server):
        self.linuxCheckCommands = yvLibKeywords._open_yaml_file(os.path.join(self.envTemplatePath, "linuxCheckCommands"))
        
        linuxCmdList = [] ## Clears the list for use
        linuxCmdList = self._build_linux_command_list(linuxCmdList, "environment:linuxCheckCommands")
        linuxCmdList = self._build_linux_command_list(linuxCmdList, ("applicationGroups:%s:linuxCheckCommands") % (applicationGroup))
        linuxCmdList = self._build_linux_command_list(linuxCmdList, ("applicationGroups:%s:servers:%s:linuxCheckCommands") % (applicationGroup, server))

        return linuxCmdList     
    def check_configuration_file(self, applicationGroup, configFileTemplate):
        
        # Gets and processes the configuration file parameters if one exists.
        if os.path.exists(os.path.join(self.envTemplatePath, configFileTemplate, ".yaml")):
            configTemplateFileVariables = yvLibKeywords._open_yaml_file(os.path.join(self.envTemplatePath, configFileTemplate)) # Getting all the Template File Variables
            configurationType = configTemplateFileVariables["configuration"]["type"] # Find environment type IE Production / Test
        
            # Works if it's a file check or command check
            if configurationType == "file":
                sourceFilePath = configTemplateFileVariables["configuration"]["fileLocation"]
            if configurationType == "command":
                cmd = configTemplateFileVariables["configuration"]["command"]

        # Creates the Server Path folder
        configEnvServerFilesPath = os.path.join(self.envServerFilesPath, applicationGroup, configFileTemplate)
        if not os.path.exists(configEnvServerFilesPath):
            os.makedirs(configEnvServerFilesPath)
        
        for server in self.envData['applicationGroups'][applicationGroup]['servers'].keys():        
            # Remove the configuration file path for file processing    
            configEnvGeneratedFilesPath = self.build_configuration_file(applicationGroup, server, configFileTemplate)          
            self.robotBuiltIn.run_keyword("ssh_connect", server, self.auditUsername)
            fileName = (("%s_%s_%s") % (server, self.id, configFileTemplate))
            destName = os.path.join(configEnvServerFilesPath, fileName)

            if configurationType == "file":
                sourceFile = self._parse_string_for_variables(sourceFilePath, applicationGroup, server)
                returnResult = self.robotBuiltIn.run_keyword_and_ignore_error("ssh_get_file", sourceFile, destName.replace("\\", "\\\\"))
                if returnResult[0] == "FAIL":
                    self._result_logger(server, fileName, "Fail", sourceFile)
                    self.robotBuiltIn.log((("ERROR: Server %s does not have file %s") % (server, sourceFile)), "WARN")
                
            if configurationType == "command":
                actualResult = self.robotBuiltIn.run_keyword('ssh_run_cmd', cmd)
                self.write_file(destName, actualResult)
                
            if configTemplateFileVariables["configuration"].get('ignore-matching-lines') != None:
                diffOpt = "-i -w -B --ignore-matching-lines=" + " --ignore-matching-lines=".join(configTemplateFileVariables["configuration"]['ignore-matching-lines'])
            else:
                diffOpt = "-i -w -B"
                
            self.robotBuiltIn.run_keyword("ssh_disconnect")
            
            
        dc = filecmp.dircmp(configEnvGeneratedFilesPath, configEnvServerFilesPath)
        
        for fileCommon in dc.common:
            fileServer = fileCommon.split("_")[0]
            returnResult = self.robotBuiltIn.run_keyword_and_ignore_error("diff_files", os.path.join(configEnvGeneratedFilesPath, fileCommon).replace("\\", "\\\\"), os.path.join(configEnvServerFilesPath, fileCommon).replace("\\", "\\\\"), diffOpt)
            if returnResult[0] == "FAIL":
                self._result_logger(fileServer, fileCommon, "Fail", str(returnResult[1]))
                self.robotBuiltIn.log((("Bad news: File %s on server %s with %s") % (fileCommon, fileServer, returnResult[1])), "WARN")
            else:
                self._result_logger(fileServer, fileCommon, "Pass", str(returnResult[1]))
                self.robotBuiltIn.log((("Good news: File %s on server %s with %s") % (fileCommon, fileServer, returnResult[1])), "INFO")
    def linux_config_set_variables(self, envConfigFile):

        
        self.envData = (yvLibKeywords._open_yaml_file(os.path.join(self.rootDir, self.envVarDir, envConfigFile)))
        
        self.envGeneratedFilesPath = self._setup_output_folders(os.path.join(GLOBAL_VARIABLES['${OUTPUTDIR}'], "%s_generatedFiles" % envConfigFile))
        self.envServerFilesPath = self._setup_output_folders(os.path.join(GLOBAL_VARIABLES['${OUTPUTDIR}'],"%s_serverFiles" % envConfigFile))
        self.resultFileName = ("%s_result.csv" % envConfigFile)
        self.resultFile = self._setup_output_folders(os.path.join(GLOBAL_VARIABLES['${OUTPUTDIR}'], self.resultFileName))

        os.makedirs(self.envServerFilesPath)
        os.makedirs(self.envGeneratedFilesPath)
        #Global Variables
        #self.envConf = self._set_generic_variables(self.envData['environment']['configuration'])
        #self.envUser = self._set_generic_variables(self.envData['environment']['user'])
        #self.envHomeDir = self._set_generic_variables(self.envData['environment']['homeDir'])
        self.auditUsername = self._set_generic_variables(self.envData['environment']['auditUsername'])       
        self.id = envConfigFile
    def build_configuration_file(self, applicationGroup, server, configFileTemplate):
        self.configurationFileSettings = {} ## Clears the dictionary for use

        configEnvGeneratedFilesPath = os.path.join(self.envGeneratedFilesPath, applicationGroup, configFileTemplate)
        if not os.path.exists(configEnvGeneratedFilesPath):
            os.makedirs(configEnvGeneratedFilesPath)
        
        # Process the Template Files Variables
        configTemplateFileVariables = yvLibKeywords._open_yaml_file(os.path.join(self.envTemplatePath, configFileTemplate))
        # Remove the configuration file path for file processing        
        del configTemplateFileVariables["configuration"]
        # Gets the configuration file settings based on the defined environment configuration
        for key, value in configTemplateFileVariables.items():
            self.configurationFileSettings[key] = self._parse_string_for_variables(value[self.envConf])

        self._build_configuration_file_settings(("environment:%s") % (configFileTemplate))
        self._build_configuration_file_settings(("applicationGroups:%s:%s") % (applicationGroup, configFileTemplate))
        self._build_configuration_file_settings(("applicationGroups:%s:servers:%s:%s") % (applicationGroup, server, configFileTemplate))

        returnValue = self._check_template_configuation_dict(configFileTemplate,server)
        if returnValue <> "Error":
            self._render_configuration_file(configFileTemplate, server, configEnvGeneratedFilesPath)
            
        return configEnvGeneratedFilesPath