def _config_file_get_template_data(self, templateDir, applicationGroup):
     ''' The following function will return a dictionary of all the variables for each template that is defined for a specific application group. 
     '''        
     templateFileData = {} # Set up the variable for population
     
     # Gets all the values from the configuration files templates
     for configFileTemplate in self.environmentData['applicationGroups'][applicationGroup]['configurationFiles']:
         configFilePath = os.path.join(templateDir, configFileTemplate)
         
         # Following code will ensure a config file and associated yaml file exists.
         if os.path.exists(configFilePath):
             if os.path.exists(configFilePath + ".yaml"):
                 templateFileData[configFileTemplate] = _utils._open_yaml_file(configFilePath)
             else:
                 raise Exception (("No configuration template is configured for: %s") % (configFilePath))
         else:
             raise Exception (("No configuration file for: %s") % (configFilePath))
         
         _utils._myDictAssert(templateFileData[configFileTemplate], 'configuration', ("Configuration is set for template file: %s.yaml" % configFileTemplate), "ERROR") # Ensure there is configuration node in the returned data
         _utils._myDictAssert(templateFileData[configFileTemplate]['configuration'], 'type', ("No type is set for template file: %s.yaml" % configFileTemplate), "ERROR") # Ensure there is configuration type node in the returned data
 
         configTypeValue = templateFileData[configFileTemplate]['configuration']['type'] # Set the configuration type variable for use
         if configTypeValue not in ("file", "command"):
             raise Exception (("%s is an invalid value for configuration type in file %s. Must be 'file' or 'command'.") % (configTypeValue, configFileTemplate)) # Ensure the set configuration type set is valid
      
         if configTypeValue == "file":
             _utils._myDictAssert(templateFileData[configFileTemplate]['configuration'], 'fileLocation', ("No file location is set for template file: %s.yaml" % configFileTemplate), "ERROR") # Ensure a file location value is set if file type
         
         if configTypeValue == "command":
             _utils._myDictAssert(templateFileData[configFileTemplate]['configuration'], 'command', ("No command is set for template file: %s.yaml" % configFileTemplate), "ERROR") # Ensure a command is set if type is command
         
     return templateFileData # Returns a dict with the variables for each of the configuration files template values.        
    def _config_file_get_environment_data(self, envVarDir, environment):
        ''' Gets the variables from the environment configuration file for use to build the expected configuration file outputs.
        '''
        environmentDataFilePath = os.path.join(
            envVarDir, environment)  # Create the env data file path
        environmentData = _utils._open_yaml_file(
            environmentDataFilePath)  # Read the environment data from yaml

        _utils._myDictAssert(
            environmentData, 'applicationGroups',
            ("applicationGroups key not set in file: %s.yaml" %
             environmentDataFilePath), "ERROR"
        )  # Ensure there is an application Group node in the returned data set
        _utils._myDictAssert(
            environmentData, 'environment',
            ("environment key not set in file: %s.yaml" %
             environmentDataFilePath), "ERROR"
        )  # Ensure there is an environment node in the returned data set
        _utils._myDictAssert(
            environmentData['environment'], 'auditUsername',
            ("applicationGroups key not set in file: %s.yaml" %
             environmentDataFilePath), "ERROR"
        )  # Ensure there is an audit username node in the returned data set

        return environmentData  # Return the environment data for use
 def _config_file_get_environment_data(self, envVarDir, environment):
     ''' Gets the variables from the environment configuration file for use to build the expected configuration file outputs.
     '''
     environmentDataFilePath = os.path.join(envVarDir, environment) # Create the env data file path
     environmentData = _utils._open_yaml_file(environmentDataFilePath) # Read the environment data from yaml
     
     _utils._myDictAssert(environmentData, 'applicationGroups', ("applicationGroups key not set in file: %s.yaml" % environmentDataFilePath), "ERROR")  # Ensure there is an application Group node in the returned data set
     _utils._myDictAssert(environmentData, 'environment', ("environment key not set in file: %s.yaml" % environmentDataFilePath), "ERROR")  # Ensure there is an environment node in the returned data set
     _utils._myDictAssert(environmentData['environment'], 'auditUsername', ("applicationGroups key not set in file: %s.yaml" % environmentDataFilePath), "ERROR")  # Ensure there is an audit username node in the returned data set
     
     return environmentData # Return the environment data for use
    def _config_file_get_template_data(self, templateDir, applicationGroup):
        ''' The following function will return a dictionary of all the variables for each template that is defined for a specific application group. 
        '''
        templateFileData = {}  # Set up the variable for population

        # Gets all the values from the configuration files templates
        for configFileTemplate in self.environmentData['applicationGroups'][
                applicationGroup]['configurationFiles']:
            configFilePath = os.path.join(templateDir, configFileTemplate)

            # Following code will ensure a config file and associated yaml file exists.
            if os.path.exists(configFilePath):
                if os.path.exists(configFilePath + ".yaml"):
                    templateFileData[
                        configFileTemplate] = _utils._open_yaml_file(
                            configFilePath)
                else:
                    raise Exception(
                        ("No configuration template is configured for: %s") %
                        (configFilePath))
            else:
                raise Exception(
                    ("No configuration file for: %s") % (configFilePath))

            _utils._myDictAssert(
                templateFileData[configFileTemplate], 'configuration',
                ("Configuration is set for template file: %s.yaml" %
                 configFileTemplate), "ERROR"
            )  # Ensure there is configuration node in the returned data
            _utils._myDictAssert(
                templateFileData[configFileTemplate]['configuration'], 'type',
                ("No type is set for template file: %s.yaml" %
                 configFileTemplate), "ERROR"
            )  # Ensure there is configuration type node in the returned data

            configTypeValue = templateFileData[configFileTemplate][
                'configuration'][
                    'type']  # Set the configuration type variable for use
            if configTypeValue not in ("file", "command"):
                raise Exception((
                    "%s is an invalid value for configuration type in file %s. Must be 'file' or 'command'."
                ) % (configTypeValue, configFileTemplate
                     ))  # Ensure the set configuration type set is valid

            if configTypeValue == "file":
                _utils._myDictAssert(
                    templateFileData[configFileTemplate]['configuration'],
                    'fileLocation',
                    ("No file location is set for template file: %s.yaml" %
                     configFileTemplate), "ERROR"
                )  # Ensure a file location value is set if file type

            if configTypeValue == "command":
                _utils._myDictAssert(
                    templateFileData[configFileTemplate]['configuration'],
                    'command',
                    ("No command is set for template file: %s.yaml" %
                     configFileTemplate),
                    "ERROR")  # Ensure a command is set if type is command

        return templateFileData  # Returns a dict with the variables for each of the configuration files template values.