<s> '''<STR_LIT>''' <EOL> from __future__ import absolute_import <EOL> from __future__ import generators <EOL> import os <EOL> import re <EOL> import sys <EOL> import glob <EOL> import time <EOL> import codecs <EOL> import logging <EOL> from copy import deepcopy <EOL> import types <EOL> import yaml <EOL> try : <EOL> yaml . Loader = yaml . CLoader <EOL> yaml . Dumper = yaml . CDumper <EOL> except Exception : <EOL> pass <EOL> import salt . ext . six as six <EOL> from salt . ext . six import string_types , text_type <EOL> from salt . ext . six . moves . urllib . parse import urlparse <EOL> import salt . utils <EOL> import salt . utils . dictupdate <EOL> import salt . utils . network <EOL> import salt . syspaths <EOL> import salt . utils . validate . path <EOL> import salt . utils . xdg <EOL> import salt . exceptions <EOL> import salt . utils . sdb <EOL> from salt . utils . locales import sdecode <EOL> log = logging . getLogger ( __name__ ) <EOL> _DFLT_LOG_DATEFMT = '<STR_LIT>' <EOL> _DFLT_LOG_DATEFMT_LOGFILE = '<STR_LIT>' <EOL> _DFLT_LOG_FMT_CONSOLE = '<STR_LIT>' <EOL> _DFLT_LOG_FMT_LOGFILE = ( <EOL> '<STR_LIT>' <EOL> ) <EOL> if salt . utils . is_windows ( ) : <EOL> _DFLT_IPC_MODE = '<STR_LIT>' <EOL> else : <EOL> _DFLT_IPC_MODE = '<STR_LIT>' <EOL> FLO_DIR = os . path . join ( <EOL> os . path . dirname ( os . path . dirname ( __file__ ) ) , <EOL> '<STR_LIT>' , '<STR_LIT>' ) <EOL> VALID_OPTS = { <EOL> '<STR_LIT>' : ( string_types , list ) , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT:user>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT:id>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : tuple , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT:test>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : ( bool , string_types ) , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : ( string_types , list ) , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : ( list , string_types ) , <EOL> '<STR_LIT>' : ( list , string_types ) , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : dict , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT:username>' : str , <EOL> '<STR_LIT:password>' : str , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : str , <EOL> '<STR_LIT>' : float , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : int , <EOL> '<STR_LIT>' : bool , <EOL> '<STR_LIT>' : list , <EOL> '<STR_LIT>' : bool , <EOL> } <EOL> DEFAULT_MINION_OPTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:str>' , <EOL> '<STR_LIT>' : '<STR_LIT:default>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:user>' : '<STR_LIT:root>' , <EOL> '<STR_LIT>' : salt . syspaths . ROOT_DIR , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . SOCK_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:0.5> , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_THORIUM_ROOTS_DIR ] , <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_FILE_ROOTS_DIR , <EOL> salt . syspaths . SPM_FORMULA_PATH ] <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:100> , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_PILLAR_ROOTS_DIR , <EOL> salt . syspaths . SPM_PILLAR_PATH ] <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : _DFLT_IPC_MODE , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT:info>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT_LOGFILE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_CONSOLE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_LOGFILE , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT:test>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : <NUM_LIT:30> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:1000> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . BASE_FILE_ROOTS_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . BASE_FILE_ROOTS_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . PIDFILE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:7> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : os . path . join ( FLO_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( FLO_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT:0.1> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : <NUM_LIT:100> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT:username>' : None , <EOL> '<STR_LIT:password>' : None , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:100> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:1000> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : True , <EOL> } <EOL> DEFAULT_MASTER_OPTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:1000> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:1000> , <EOL> '<STR_LIT>' : <NUM_LIT:1> , <EOL> '<STR_LIT:user>' : '<STR_LIT:root>' , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . SOCK_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : salt . syspaths . ROOT_DIR , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_FILE_ROOTS_DIR , <EOL> salt . syspaths . SPM_FORMULA_PATH ] <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_MASTER_ROOTS_DIR ] , <EOL> } , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_PILLAR_ROOTS_DIR , <EOL> salt . syspaths . SPM_PILLAR_PATH ] <EOL> } , <EOL> '<STR_LIT>' : <NUM_LIT:0.5> , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : [ salt . syspaths . BASE_THORIUM_ROOTS_DIR ] , <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT:default>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . PIDFILE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:100> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : _DFLT_IPC_MODE , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT:info>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT_LOGFILE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_CONSOLE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_LOGFILE , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . PIDFILE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT:key>' ) , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . BASE_FILE_ROOTS_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . BASE_FILE_ROOTS_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : - <NUM_LIT:1> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT:10> , <EOL> '<STR_LIT>' : <NUM_LIT:0.5> , <EOL> '<STR_LIT>' : <NUM_LIT:0.5> , <EOL> '<STR_LIT>' : <NUM_LIT:100> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT:root>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : os . path . join ( FLO_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( FLO_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( FLO_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : <NUM_LIT:2> , <EOL> '<STR_LIT>' : <NUM_LIT:100> , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:0> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : <NUM_LIT:1> * <NUM_LIT> * <NUM_LIT> , <EOL> '<STR_LIT>' : <NUM_LIT:100> * <NUM_LIT> * <NUM_LIT> * <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> DEFAULT_PROXY_MINION_OPTS = { <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> } <EOL> CLOUD_CONFIG_DEFAULTS = { <EOL> '<STR_LIT>' : True , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : False , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . LOGS_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT:info>' , <EOL> '<STR_LIT>' : None , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT , <EOL> '<STR_LIT>' : _DFLT_LOG_DATEFMT_LOGFILE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_CONSOLE , <EOL> '<STR_LIT>' : _DFLT_LOG_FMT_LOGFILE , <EOL> '<STR_LIT>' : { } , <EOL> '<STR_LIT>' : None , <EOL> } <EOL> DEFAULT_API_OPTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> } <EOL> DEFAULT_SPM_OPTS = { <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] , <EOL> '<STR_LIT>' : os . path . join ( salt . syspaths . CACHE_DIR , '<STR_LIT>' , '<STR_LIT>' ) , <EOL> } <EOL> VM_CONFIG_DEFAULTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> PROVIDER_CONFIG_DEFAULTS = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } <EOL> def _validate_file_roots ( opts ) : <EOL> '''<STR_LIT>''' <EOL> if not isinstance ( opts [ '<STR_LIT>' ] , dict ) : <EOL> log . warning ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> return { '<STR_LIT>' : _expand_glob_path ( [ salt . syspaths . BASE_FILE_ROOTS_DIR ] ) } <EOL> for saltenv , dirs in six . iteritems ( opts [ '<STR_LIT>' ] ) : <EOL> normalized_saltenv = six . text_type ( saltenv ) <EOL> if normalized_saltenv != saltenv : <EOL> opts [ '<STR_LIT>' ] [ normalized_saltenv ] = opts [ '<STR_LIT>' ] . pop ( saltenv ) <EOL> if not isinstance ( dirs , ( list , tuple ) ) : <EOL> opts [ '<STR_LIT>' ] [ normalized_saltenv ] = [ ] <EOL> opts [ '<STR_LIT>' ] [ normalized_saltenv ] = _expand_glob_path ( opts [ '<STR_LIT>' ] [ normalized_saltenv ] ) <EOL> return opts [ '<STR_LIT>' ] <EOL> def _expand_glob_path ( file_roots ) : <EOL> '''<STR_LIT>''' <EOL> unglobbed_path = [ ] <EOL> for path in file_roots : <EOL> try : <EOL> if glob . has_magic ( path ) : <EOL> unglobbed_path . extend ( glob . glob ( path ) ) <EOL> else : <EOL> unglobbed_path . append ( path ) <EOL> except Exception : <EOL> unglobbed_path . append ( path ) <EOL> return unglobbed_path <EOL> def _validate_opts ( opts ) : <EOL> '''<STR_LIT>''' <EOL> def format_multi_opt ( valid_type ) : <EOL> try : <EOL> num_types = len ( valid_type ) <EOL> except TypeError : <EOL> return valid_type . __name__ <EOL> else : <EOL> if num_types == <NUM_LIT:1> : <EOL> return valid_type . __name__ <EOL> elif num_types > <NUM_LIT:1> : <EOL> ret = '<STR_LIT:U+002CU+0020>' . join ( x . __name__ for x in valid_type [ : - <NUM_LIT:1> ] ) <EOL> ret += '<STR_LIT>' + valid_type [ - <NUM_LIT:1> ] . __name__ <EOL> errors = [ ] <EOL> err = ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> for key , val in six . iteritems ( opts ) : <EOL> if key in VALID_OPTS : <EOL> if isinstance ( val , VALID_OPTS [ key ] ) : <EOL> continue <EOL> if hasattr ( VALID_OPTS [ key ] , '<STR_LIT>' ) : <EOL> try : <EOL> VALID_OPTS [ key ] ( val ) <EOL> if isinstance ( val , ( list , dict ) ) : <EOL> errors . append ( <EOL> err . format ( <EOL> key , <EOL> val , <EOL> type ( val ) . __name__ , <EOL> VALID_OPTS [ key ] . __name__ <EOL> ) <EOL> ) <EOL> except ( TypeError , ValueError ) : <EOL> errors . append ( <EOL> err . format ( key , <EOL> val , <EOL> type ( val ) . __name__ , <EOL> VALID_OPTS [ key ] . __name__ ) <EOL> ) <EOL> continue <EOL> errors . append ( <EOL> err . format ( key , <EOL> val , <EOL> type ( val ) . __name__ , <EOL> format_multi_opt ( VALID_OPTS [ key ] . __name__ ) ) <EOL> ) <EOL> if ( salt . utils . is_windows ( ) and opts . get ( '<STR_LIT>' ) == '<STR_LIT>' and <EOL> '<STR_LIT>' in opts and <EOL> not opts [ '<STR_LIT>' ] . startswith ( '<STR_LIT>' ) ) : <EOL> opts [ '<STR_LIT>' ] = ( <EOL> '<STR_LIT>' + opts [ '<STR_LIT>' ] . replace ( '<STR_LIT::>' , '<STR_LIT>' ) ) <EOL> for error in errors : <EOL> log . warning ( error ) <EOL> if errors : <EOL> return False <EOL> return True <EOL> def _append_domain ( opts ) : <EOL> '''<STR_LIT>''' <EOL> if opts [ '<STR_LIT:id>' ] . endswith ( opts [ '<STR_LIT>' ] ) : <EOL> return opts [ '<STR_LIT:id>' ] <EOL> if opts [ '<STR_LIT:id>' ] . endswith ( '<STR_LIT:.>' ) : <EOL> return opts [ '<STR_LIT:id>' ] <EOL> return '<STR_LIT>' . format ( opts ) <EOL> def _read_conf_file ( path ) : <EOL> '''<STR_LIT>''' <EOL> log . debug ( '<STR_LIT>' . format ( path ) ) <EOL> with salt . utils . fopen ( path , '<STR_LIT:r>' ) as conf_file : <EOL> try : <EOL> conf_opts = yaml . safe_load ( conf_file . read ( ) ) or { } <EOL> except yaml . YAMLError as err : <EOL> log . error ( <EOL> '<STR_LIT>' . format ( path , err ) <EOL> ) <EOL> conf_opts = { } <EOL> if not isinstance ( conf_opts , dict ) : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( path , type ( conf_opts ) ) <EOL> ) <EOL> conf_opts = { } <EOL> if '<STR_LIT:id>' in conf_opts : <EOL> if not isinstance ( conf_opts [ '<STR_LIT:id>' ] , six . string_types ) : <EOL> conf_opts [ '<STR_LIT:id>' ] = str ( conf_opts [ '<STR_LIT:id>' ] ) <EOL> else : <EOL> conf_opts [ '<STR_LIT:id>' ] = sdecode ( conf_opts [ '<STR_LIT:id>' ] ) <EOL> for key , value in six . iteritems ( conf_opts . copy ( ) ) : <EOL> if isinstance ( value , text_type ) and six . PY2 : <EOL> conf_opts [ key ] = value . encode ( '<STR_LIT:utf-8>' ) <EOL> return conf_opts <EOL> def _absolute_path ( path , relative_to = None ) : <EOL> '''<STR_LIT>''' <EOL> if path and os . path . isabs ( path ) : <EOL> return path <EOL> if path and relative_to is not None : <EOL> _abspath = os . path . join ( relative_to , path ) <EOL> if os . path . isfile ( _abspath ) : <EOL> log . debug ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( path , _abspath ) <EOL> ) <EOL> return _abspath <EOL> return path <EOL> def load_config ( path , env_var , default_path = None ) : <EOL> '''<STR_LIT>''' <EOL> if path is None : <EOL> return { } <EOL> if default_path is None : <EOL> import inspect <EOL> previous_frame = inspect . getframeinfo ( inspect . currentframe ( ) . f_back ) <EOL> log . warning ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( <EOL> previous_frame . function , previous_frame . filename , env_var <EOL> ) <EOL> ) <EOL> default_path = DEFAULT_MASTER_OPTS [ '<STR_LIT>' ] <EOL> env_path = os . environ . get ( env_var , path ) <EOL> if not env_path or not os . path . isfile ( env_path ) : <EOL> env_path = path <EOL> if path != default_path : <EOL> env_path = path <EOL> path = env_path <EOL> if not os . path . isfile ( path ) : <EOL> template = '<STR_LIT>' . format ( path ) <EOL> if os . path . isfile ( template ) : <EOL> log . debug ( '<STR_LIT>' . format ( path , template ) ) <EOL> with salt . utils . fopen ( path , '<STR_LIT:w>' ) as out : <EOL> with salt . utils . fopen ( template , '<STR_LIT:r>' ) as ifile : <EOL> ifile . readline ( ) <EOL> out . write ( ifile . read ( ) ) <EOL> if salt . utils . validate . path . is_readable ( path ) : <EOL> opts = _read_conf_file ( path ) <EOL> opts [ '<STR_LIT>' ] = path <EOL> return opts <EOL> log . debug ( '<STR_LIT>' . format ( path ) ) <EOL> return { } <EOL> def include_config ( include , orig_path , verbose ) : <EOL> '''<STR_LIT>''' <EOL> if not include : <EOL> return { } <EOL> if orig_path is None : <EOL> return { } <EOL> if isinstance ( include , str ) : <EOL> include = [ include ] <EOL> configuration = { } <EOL> for path in include : <EOL> path = os . path . expanduser ( path ) <EOL> if not os . path . isabs ( path ) : <EOL> path = os . path . join ( os . path . dirname ( orig_path ) , path ) <EOL> if len ( glob . glob ( path ) ) == <NUM_LIT:0> : <EOL> if verbose : <EOL> log . warning ( <EOL> '<STR_LIT>' <EOL> "<STR_LIT>" . format ( path ) <EOL> ) <EOL> for fn_ in sorted ( glob . glob ( path ) ) : <EOL> log . debug ( "<STR_LIT>" . format ( fn_ ) ) <EOL> opts = _read_conf_file ( fn_ ) <EOL> include = opts . get ( '<STR_LIT>' , [ ] ) <EOL> if include : <EOL> opts . update ( include_config ( include , fn_ , verbose ) ) <EOL> salt . utils . dictupdate . update ( configuration , opts ) <EOL> return configuration <EOL> def prepend_root_dir ( opts , path_options ) : <EOL> '''<STR_LIT>''' <EOL> root_dir = os . path . abspath ( opts [ '<STR_LIT>' ] ) <EOL> root_opt = opts [ '<STR_LIT>' ] . rstrip ( os . sep ) <EOL> for path_option in path_options : <EOL> if path_option in opts : <EOL> path = opts [ path_option ] <EOL> if path == root_opt or path . startswith ( root_opt + os . sep ) : <EOL> path = path [ len ( root_opt ) : ] <EOL> opts [ path_option ] = salt . utils . path_join ( root_dir , path ) <EOL> def insert_system_path ( opts , paths ) : <EOL> '''<STR_LIT>''' <EOL> if isinstance ( paths , str ) : <EOL> paths = [ paths ] <EOL> for path in paths : <EOL> path_options = { '<STR_LIT:path>' : path , '<STR_LIT>' : opts [ '<STR_LIT>' ] } <EOL> prepend_root_dir ( path_options , path_options ) <EOL> if ( os . path . isdir ( path_options [ '<STR_LIT:path>' ] ) <EOL> and path_options [ '<STR_LIT:path>' ] not in sys . path ) : <EOL> sys . path . insert ( <NUM_LIT:0> , path_options [ '<STR_LIT:path>' ] ) <EOL> def minion_config ( path , <EOL> env_var = '<STR_LIT>' , <EOL> defaults = None , <EOL> cache_minion_id = False ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = DEFAULT_MINION_OPTS <EOL> if path is not None and path . endswith ( '<STR_LIT>' ) : <EOL> defaults . update ( DEFAULT_PROXY_MINION_OPTS ) <EOL> if not os . environ . get ( env_var , None ) : <EOL> salt_config_dir = os . environ . get ( '<STR_LIT>' , None ) <EOL> if salt_config_dir : <EOL> env_config_file_path = os . path . join ( salt_config_dir , '<STR_LIT>' ) <EOL> if salt_config_dir and os . path . isfile ( env_config_file_path ) : <EOL> os . environ [ env_var ] = env_config_file_path <EOL> overrides = load_config ( path , env_var , DEFAULT_MINION_OPTS [ '<STR_LIT>' ] ) <EOL> default_include = overrides . get ( '<STR_LIT>' , <EOL> defaults [ '<STR_LIT>' ] ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( include_config ( default_include , path , verbose = False ) ) <EOL> overrides . update ( include_config ( include , path , verbose = True ) ) <EOL> opts = apply_minion_config ( overrides , defaults , cache_minion_id = cache_minion_id ) <EOL> _validate_opts ( opts ) <EOL> return opts <EOL> def syndic_config ( master_config_path , <EOL> minion_config_path , <EOL> master_env_var = '<STR_LIT>' , <EOL> minion_env_var = '<STR_LIT>' , <EOL> minion_defaults = None , <EOL> master_defaults = None ) : <EOL> if minion_defaults is None : <EOL> minion_defaults = DEFAULT_MINION_OPTS <EOL> if master_defaults is None : <EOL> master_defaults = DEFAULT_MASTER_OPTS <EOL> opts = { } <EOL> master_opts = master_config ( <EOL> master_config_path , master_env_var , master_defaults <EOL> ) <EOL> minion_opts = minion_config ( <EOL> minion_config_path , minion_env_var , minion_defaults <EOL> ) <EOL> opts [ '<STR_LIT>' ] = master_opts [ '<STR_LIT>' ] <EOL> opts [ '<STR_LIT>' ] = minion_opts [ '<STR_LIT>' ] <EOL> opts . update ( master_opts ) <EOL> opts . update ( minion_opts ) <EOL> syndic_opts = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : opts . get ( '<STR_LIT>' , salt . syspaths . ROOT_DIR ) , <EOL> '<STR_LIT>' : opts . get ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT>' : opts . get ( '<STR_LIT>' , '<STR_LIT>' ) , <EOL> '<STR_LIT:id>' : minion_opts [ '<STR_LIT:id>' ] , <EOL> '<STR_LIT>' : minion_opts [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : opts [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : master_opts [ '<STR_LIT>' ] , <EOL> '<STR_LIT>' : int ( <EOL> opts . get ( <EOL> '<STR_LIT>' , <EOL> opts . get ( <EOL> '<STR_LIT>' , <EOL> minion_defaults . get ( <EOL> '<STR_LIT>' , <EOL> DEFAULT_MINION_OPTS [ '<STR_LIT>' ] <EOL> ) <EOL> ) <EOL> ) <EOL> ) , <EOL> '<STR_LIT:user>' : opts . get ( '<STR_LIT>' , opts [ '<STR_LIT:user>' ] ) , <EOL> '<STR_LIT>' : os . path . join ( <EOL> opts [ '<STR_LIT>' ] , opts . get ( '<STR_LIT>' , opts [ '<STR_LIT>' ] ) <EOL> ) , <EOL> '<STR_LIT>' : master_opts [ '<STR_LIT>' ] , <EOL> } <EOL> opts . update ( syndic_opts ) <EOL> prepend_root_dirs = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> for config_key in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> if urlparse ( opts . get ( config_key , '<STR_LIT>' ) ) . scheme == '<STR_LIT>' : <EOL> prepend_root_dirs . append ( config_key ) <EOL> prepend_root_dir ( opts , prepend_root_dirs ) <EOL> return opts <EOL> def apply_sdb ( opts , sdb_opts = None ) : <EOL> '''<STR_LIT>''' <EOL> if sdb_opts is None : <EOL> sdb_opts = opts <EOL> if isinstance ( sdb_opts , string_types ) and sdb_opts . startswith ( '<STR_LIT>' ) : <EOL> return salt . utils . sdb . sdb_get ( sdb_opts , opts ) <EOL> elif isinstance ( sdb_opts , dict ) : <EOL> for key , value in six . iteritems ( sdb_opts ) : <EOL> if value is None : <EOL> continue <EOL> sdb_opts [ key ] = apply_sdb ( opts , value ) <EOL> elif isinstance ( sdb_opts , list ) : <EOL> for key , value in enumerate ( sdb_opts ) : <EOL> if value is None : <EOL> continue <EOL> sdb_opts [ key ] = apply_sdb ( opts , value ) <EOL> return sdb_opts <EOL> def cloud_config ( path , env_var = '<STR_LIT>' , defaults = None , <EOL> master_config_path = None , master_config = None , <EOL> providers_config_path = None , providers_config = None , <EOL> profiles_config_path = None , profiles_config = None ) : <EOL> '''<STR_LIT>''' <EOL> overrides = load_config ( <EOL> path , <EOL> env_var , <EOL> os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> if path : <EOL> config_dir = os . path . dirname ( path ) <EOL> else : <EOL> config_dir = salt . syspaths . CONFIG_DIR <EOL> if defaults is None : <EOL> defaults = CLOUD_CONFIG_DEFAULTS <EOL> default_include = overrides . get ( <EOL> '<STR_LIT>' , defaults [ '<STR_LIT>' ] <EOL> ) <EOL> overrides . update ( <EOL> salt . config . include_config ( default_include , path , verbose = False ) <EOL> ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( <EOL> salt . config . include_config ( include , path , verbose = True ) <EOL> ) <EOL> if '<STR_LIT>' in overrides and master_config_path is None : <EOL> master_config_path = overrides [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' not in overrides and not master_config and not master_config_path : <EOL> master_config_path = os . path . join ( config_dir , '<STR_LIT>' ) <EOL> master_config_path = _absolute_path ( master_config_path , config_dir ) <EOL> if '<STR_LIT>' in overrides and providers_config_path is None : <EOL> providers_config_path = overrides [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' not in overrides and not providers_config and not providers_config_path : <EOL> providers_config_path = os . path . join ( config_dir , '<STR_LIT>' ) <EOL> providers_config_path = _absolute_path ( providers_config_path , config_dir ) <EOL> if '<STR_LIT>' in overrides and profiles_config_path is None : <EOL> profiles_config_path = overrides [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' not in overrides and not profiles_config and not profiles_config_path : <EOL> profiles_config_path = os . path . join ( config_dir , '<STR_LIT>' ) <EOL> profiles_config_path = _absolute_path ( profiles_config_path , config_dir ) <EOL> deploy_scripts_search_path = overrides . get ( <EOL> '<STR_LIT>' , <EOL> defaults . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> ) <EOL> if isinstance ( deploy_scripts_search_path , string_types ) : <EOL> deploy_scripts_search_path = [ deploy_scripts_search_path ] <EOL> for idx , entry in enumerate ( deploy_scripts_search_path [ : ] ) : <EOL> if not os . path . isabs ( entry ) : <EOL> entry = os . path . join ( os . path . dirname ( path ) , entry ) <EOL> if os . path . isdir ( entry ) : <EOL> deploy_scripts_search_path [ idx ] = entry <EOL> continue <EOL> deploy_scripts_search_path . pop ( idx ) <EOL> deploy_scripts_search_path . append ( <EOL> os . path . abspath ( <EOL> os . path . join ( <EOL> os . path . dirname ( __file__ ) , <EOL> '<STR_LIT:..>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> ) <EOL> ) <EOL> overrides . update ( <EOL> deploy_scripts_search_path = tuple ( deploy_scripts_search_path ) <EOL> ) <EOL> if master_config_path is not None and master_config is not None : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> ) <EOL> elif master_config_path is None and master_config is None : <EOL> master_config = salt . config . master_config ( <EOL> overrides . get ( <EOL> '<STR_LIT>' , <EOL> os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> ) <EOL> elif master_config_path is not None and master_config is None : <EOL> master_config = salt . config . master_config ( master_config_path ) <EOL> master_config . update ( overrides ) <EOL> overrides = master_config <EOL> if providers_config_path is not None and providers_config is not None : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> elif providers_config_path is None and providers_config is None : <EOL> providers_config_path = overrides . get ( <EOL> '<STR_LIT>' , <EOL> os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> if profiles_config_path is not None and profiles_config is not None : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> ) <EOL> elif profiles_config_path is None and profiles_config is None : <EOL> profiles_config_path = overrides . get ( <EOL> '<STR_LIT>' , <EOL> os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> opts = apply_cloud_config ( overrides , defaults ) <EOL> if '<STR_LIT>' in opts : <EOL> if providers_config is not None : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> if providers_config_path is not None : <EOL> providers_confd = os . path . join ( <EOL> os . path . dirname ( providers_config_path ) , <EOL> '<STR_LIT>' , '<STR_LIT:*>' <EOL> ) <EOL> if ( os . path . isfile ( providers_config_path ) or <EOL> glob . glob ( providers_confd ) ) : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> ) <EOL> providers_config = opts [ '<STR_LIT>' ] <EOL> elif providers_config_path is not None : <EOL> providers_config = cloud_providers_config ( providers_config_path ) <EOL> opts [ '<STR_LIT>' ] = providers_config <EOL> if profiles_config is None : <EOL> profiles_config = vm_profiles_config ( profiles_config_path , <EOL> providers_config ) <EOL> opts [ '<STR_LIT>' ] = profiles_config <EOL> apply_sdb ( opts ) <EOL> return opts <EOL> def apply_cloud_config ( overrides , defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = CLOUD_CONFIG_DEFAULTS <EOL> config = defaults . copy ( ) <EOL> if overrides : <EOL> config . update ( overrides ) <EOL> if '<STR_LIT>' in config : <EOL> providers = config [ '<STR_LIT>' ] . copy ( ) <EOL> config [ '<STR_LIT>' ] = { } <EOL> for alias , details in six . iteritems ( providers ) : <EOL> if isinstance ( details , list ) : <EOL> for detail in details : <EOL> if '<STR_LIT>' not in detail and '<STR_LIT>' not in detail : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> alias <EOL> ) <EOL> ) <EOL> elif '<STR_LIT>' in detail : <EOL> salt . utils . warn_until ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> driver = detail [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' in detail : <EOL> driver = detail [ '<STR_LIT>' ] <EOL> if '<STR_LIT::>' in driver : <EOL> alias , driver = driver . split ( '<STR_LIT::>' ) <EOL> if alias not in config [ '<STR_LIT>' ] : <EOL> config [ '<STR_LIT>' ] [ alias ] = { } <EOL> detail [ '<STR_LIT>' ] = '<STR_LIT>' . format ( alias , driver ) <EOL> config [ '<STR_LIT>' ] [ alias ] [ driver ] = detail <EOL> elif isinstance ( details , dict ) : <EOL> if '<STR_LIT>' not in details and '<STR_LIT>' not in details : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( alias ) <EOL> ) <EOL> elif '<STR_LIT>' in details : <EOL> salt . utils . warn_until ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> driver = details [ '<STR_LIT>' ] <EOL> elif '<STR_LIT>' in details : <EOL> driver = details [ '<STR_LIT>' ] <EOL> if '<STR_LIT::>' in driver : <EOL> alias , driver = driver . split ( '<STR_LIT::>' ) <EOL> if alias not in config [ '<STR_LIT>' ] : <EOL> config [ '<STR_LIT>' ] [ alias ] = { } <EOL> details [ '<STR_LIT>' ] = '<STR_LIT>' . format ( alias , driver ) <EOL> config [ '<STR_LIT>' ] [ alias ] [ driver ] = details <EOL> config = old_to_new ( config ) <EOL> return config <EOL> def old_to_new ( opts ) : <EOL> providers = ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ) <EOL> for provider in providers : <EOL> provider_config = { } <EOL> for opt , val in opts . items ( ) : <EOL> if provider in opt : <EOL> value = val <EOL> name = opt . split ( '<STR_LIT:.>' , <NUM_LIT:1> ) [ <NUM_LIT:1> ] <EOL> provider_config [ name ] = value <EOL> lprovider = provider . lower ( ) <EOL> if provider_config : <EOL> if '<STR_LIT>' in provider_config : <EOL> provider_config [ '<STR_LIT>' ] = provider_config . pop ( '<STR_LIT>' ) <EOL> provider_config [ '<STR_LIT>' ] = lprovider <EOL> opts . setdefault ( '<STR_LIT>' , { } ) <EOL> opts [ '<STR_LIT>' ] [ lprovider ] = { } <EOL> opts [ '<STR_LIT>' ] [ lprovider ] [ lprovider ] = provider_config <EOL> return opts <EOL> def vm_profiles_config ( path , <EOL> providers , <EOL> env_var = '<STR_LIT>' , <EOL> defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = VM_CONFIG_DEFAULTS <EOL> overrides = salt . config . load_config ( <EOL> path , env_var , os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> default_include = overrides . get ( <EOL> '<STR_LIT>' , defaults [ '<STR_LIT>' ] <EOL> ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( <EOL> salt . config . include_config ( default_include , path , verbose = False ) <EOL> ) <EOL> overrides . update ( <EOL> salt . config . include_config ( include , path , verbose = True ) <EOL> ) <EOL> return apply_vm_profiles_config ( providers , overrides , defaults ) <EOL> def apply_vm_profiles_config ( providers , overrides , defaults = None ) : <EOL> if defaults is None : <EOL> defaults = VM_CONFIG_DEFAULTS <EOL> config = defaults . copy ( ) <EOL> if overrides : <EOL> config . update ( overrides ) <EOL> vms = { } <EOL> for key , val in six . iteritems ( config ) : <EOL> if key in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:user>' ) : <EOL> continue <EOL> if not isinstance ( val , dict ) : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( config ) <EOL> ) <EOL> val [ '<STR_LIT>' ] = key <EOL> vms [ key ] = val <EOL> for profile , details in six . iteritems ( vms . copy ( ) ) : <EOL> if '<STR_LIT>' not in details : <EOL> if '<STR_LIT::>' in details [ '<STR_LIT>' ] : <EOL> alias , driver = details [ '<STR_LIT>' ] . split ( '<STR_LIT::>' ) <EOL> if alias not in providers or driver not in providers [ alias ] : <EOL> log . trace ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> profile , <EOL> details <EOL> ) <EOL> ) <EOL> vms . pop ( profile ) <EOL> continue <EOL> if '<STR_LIT>' not in providers [ alias ] [ driver ] : <EOL> providers [ alias ] [ driver ] [ '<STR_LIT>' ] = { } <EOL> providers [ alias ] [ driver ] [ '<STR_LIT>' ] [ profile ] = details <EOL> if details [ '<STR_LIT>' ] not in providers : <EOL> log . trace ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( profile , details ) <EOL> ) <EOL> vms . pop ( profile ) <EOL> continue <EOL> driver = next ( iter ( list ( providers [ details [ '<STR_LIT>' ] ] . keys ( ) ) ) ) <EOL> providers [ details [ '<STR_LIT>' ] ] [ driver ] . setdefault ( <EOL> '<STR_LIT>' , { } ) . update ( { profile : details } ) <EOL> details [ '<STR_LIT>' ] = '<STR_LIT>' . format ( details , driver ) <EOL> vms [ profile ] = details <EOL> continue <EOL> extends = details . pop ( '<STR_LIT>' ) <EOL> if extends not in vms : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> profile , extends <EOL> ) <EOL> ) <EOL> vms . pop ( profile ) <EOL> continue <EOL> extended = vms . get ( extends ) . copy ( ) <EOL> extended . pop ( '<STR_LIT>' ) <EOL> extended . update ( details ) <EOL> if '<STR_LIT::>' not in extended [ '<STR_LIT>' ] : <EOL> if extended [ '<STR_LIT>' ] not in providers : <EOL> log . trace ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( profile , extended ) <EOL> ) <EOL> vms . pop ( profile ) <EOL> continue <EOL> driver = next ( iter ( list ( providers [ extended [ '<STR_LIT>' ] ] . keys ( ) ) ) ) <EOL> providers [ extended [ '<STR_LIT>' ] ] [ driver ] . setdefault ( <EOL> '<STR_LIT>' , { } ) . update ( { profile : extended } ) <EOL> extended [ '<STR_LIT>' ] = '<STR_LIT>' . format ( extended , driver ) <EOL> else : <EOL> alias , driver = extended [ '<STR_LIT>' ] . split ( '<STR_LIT::>' ) <EOL> if alias not in providers or driver not in providers [ alias ] : <EOL> log . trace ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( profile , extended ) <EOL> ) <EOL> vms . pop ( profile ) <EOL> continue <EOL> providers [ alias ] [ driver ] . setdefault ( '<STR_LIT>' , { } ) . update ( <EOL> { profile : extended } <EOL> ) <EOL> vms [ profile ] = extended <EOL> return vms <EOL> def cloud_providers_config ( path , <EOL> env_var = '<STR_LIT>' , <EOL> defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = PROVIDER_CONFIG_DEFAULTS <EOL> overrides = salt . config . load_config ( <EOL> path , env_var , os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) <EOL> ) <EOL> default_include = overrides . get ( <EOL> '<STR_LIT>' , defaults [ '<STR_LIT>' ] <EOL> ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( <EOL> salt . config . include_config ( default_include , path , verbose = False ) <EOL> ) <EOL> overrides . update ( <EOL> salt . config . include_config ( include , path , verbose = True ) <EOL> ) <EOL> return apply_cloud_providers_config ( overrides , defaults ) <EOL> def apply_cloud_providers_config ( overrides , defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = PROVIDER_CONFIG_DEFAULTS <EOL> config = defaults . copy ( ) <EOL> if overrides : <EOL> config . update ( overrides ) <EOL> for name , settings in six . iteritems ( config . copy ( ) ) : <EOL> if '<STR_LIT:.>' in name : <EOL> log . warning ( <EOL> '<STR_LIT>' <EOL> ) <EOL> config = old_to_new ( config ) <EOL> for prov_name , prov_settings in six . iteritems ( config . pop ( '<STR_LIT>' ) ) : <EOL> config [ prov_name ] = prov_settings <EOL> break <EOL> providers = { } <EOL> ext_count = <NUM_LIT:0> <EOL> for key , val in six . iteritems ( config ) : <EOL> if key in ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:user>' ) : <EOL> continue <EOL> if not isinstance ( val , ( list , tuple ) ) : <EOL> val = [ val ] <EOL> else : <EOL> handled_providers = set ( ) <EOL> for details in val : <EOL> if '<STR_LIT>' not in details and '<STR_LIT>' not in details : <EOL> if '<STR_LIT>' not in details : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> ) <EOL> continue <EOL> if '<STR_LIT>' in details : <EOL> details [ '<STR_LIT>' ] = details . pop ( '<STR_LIT>' ) <EOL> if details [ '<STR_LIT>' ] in handled_providers : <EOL> log . error ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( key , details ) <EOL> ) <EOL> handled_providers . add ( details [ '<STR_LIT>' ] ) <EOL> for entry in val : <EOL> if '<STR_LIT>' in entry : <EOL> salt . utils . warn_until ( <EOL> '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> ) <EOL> entry [ '<STR_LIT>' ] = entry . pop ( '<STR_LIT>' ) <EOL> if '<STR_LIT>' not in entry : <EOL> entry [ '<STR_LIT>' ] = '<STR_LIT>' . format ( ext_count ) <EOL> ext_count += <NUM_LIT:1> <EOL> if key not in providers : <EOL> providers [ key ] = { } <EOL> provider = entry [ '<STR_LIT>' ] <EOL> if provider not in providers [ key ] : <EOL> providers [ key ] [ provider ] = entry <EOL> while True : <EOL> keep_looping = False <EOL> for provider_alias , entries in six . iteritems ( providers . copy ( ) ) : <EOL> for driver , details in six . iteritems ( entries ) : <EOL> if '<STR_LIT>' in details : <EOL> details [ '<STR_LIT>' ] = details . pop ( '<STR_LIT>' ) <EOL> providers [ provider_alias ] [ driver ] [ '<STR_LIT>' ] = { } <EOL> if '<STR_LIT>' not in details : <EOL> continue <EOL> extends = details . pop ( '<STR_LIT>' ) <EOL> if '<STR_LIT::>' in extends : <EOL> alias , provider = extends . split ( '<STR_LIT::>' ) <EOL> if alias not in providers : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> details [ '<STR_LIT>' ] , <EOL> provider_alias , <EOL> alias <EOL> ) <EOL> ) <EOL> if provider not in providers . get ( alias ) : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> details [ '<STR_LIT>' ] , <EOL> provider_alias , <EOL> alias , <EOL> provider <EOL> ) <EOL> ) <EOL> details [ '<STR_LIT>' ] = '<STR_LIT>' . format ( alias , provider ) <EOL> details [ '<STR_LIT>' ] = provider <EOL> elif providers . get ( extends ) : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> details [ '<STR_LIT>' ] , provider_alias , extends <EOL> ) <EOL> ) <EOL> elif extends not in providers : <EOL> raise salt . exceptions . SaltCloudConfigError ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' . format ( <EOL> details [ '<STR_LIT>' ] , provider_alias , extends <EOL> ) <EOL> ) <EOL> else : <EOL> if driver in providers . get ( extends ) : <EOL> details [ '<STR_LIT>' ] = '<STR_LIT>' . format ( extends , driver ) <EOL> elif '<STR_LIT>' in providers . get ( extends ) : <EOL> details [ '<STR_LIT>' ] = '<STR_LIT>' . format ( <EOL> extends , '<STR_LIT>' . format ( ext_count ) <EOL> ) <EOL> else : <EOL> details [ '<STR_LIT>' ] = extends <EOL> keep_looping = True <EOL> if not keep_looping : <EOL> break <EOL> while True : <EOL> keep_looping = False <EOL> for alias , entries in six . iteritems ( providers . copy ( ) ) : <EOL> for driver , details in six . iteritems ( entries ) : <EOL> if '<STR_LIT>' not in details : <EOL> continue <EOL> if '<STR_LIT>' in details [ '<STR_LIT>' ] : <EOL> keep_looping = True <EOL> continue <EOL> extends = details . pop ( '<STR_LIT>' ) <EOL> ext_alias , ext_driver = extends . split ( '<STR_LIT::>' ) <EOL> extended = providers . get ( ext_alias ) . get ( ext_driver ) . copy ( ) <EOL> extended . update ( details ) <EOL> providers [ alias ] [ driver ] = extended <EOL> if driver . startswith ( '<STR_LIT>' ) : <EOL> providers [ alias ] [ ext_driver ] = providers [ alias ] [ driver ] <EOL> del providers [ alias ] [ driver ] <EOL> if not keep_looping : <EOL> break <EOL> for provider_alias , entries in six . iteritems ( providers . copy ( ) ) : <EOL> for driver , details in six . iteritems ( entries . copy ( ) ) : <EOL> if not driver . startswith ( '<STR_LIT>' ) : <EOL> continue <EOL> log . info ( <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' . format ( <EOL> provider_alias <EOL> ) <EOL> ) <EOL> providers [ provider_alias ] . pop ( driver ) <EOL> if not providers [ provider_alias ] : <EOL> providers . pop ( provider_alias ) <EOL> return providers <EOL> def get_cloud_config_value ( name , vm_ , opts , default = None , search_global = True ) : <EOL> '''<STR_LIT>''' <EOL> value = default <EOL> if search_global is True and opts . get ( name , None ) is not None : <EOL> value = deepcopy ( opts [ name ] ) <EOL> if vm_ and name : <EOL> if '<STR_LIT>' in vm_ and vm_ [ '<STR_LIT>' ] is not None : <EOL> if name in opts [ '<STR_LIT>' ] [ vm_ [ '<STR_LIT>' ] ] : <EOL> if isinstance ( value , dict ) : <EOL> value . update ( opts [ '<STR_LIT>' ] [ vm_ [ '<STR_LIT>' ] ] [ name ] . copy ( ) ) <EOL> else : <EOL> value = deepcopy ( opts [ '<STR_LIT>' ] [ vm_ [ '<STR_LIT>' ] ] [ name ] ) <EOL> if '<STR_LIT>' in vm_ : <EOL> vm_ [ '<STR_LIT>' ] = vm_ . pop ( '<STR_LIT>' ) <EOL> if '<STR_LIT::>' in vm_ [ '<STR_LIT>' ] : <EOL> alias , driver = vm_ [ '<STR_LIT>' ] . split ( '<STR_LIT::>' ) <EOL> if alias in opts [ '<STR_LIT>' ] and driver in opts [ '<STR_LIT>' ] [ alias ] : <EOL> details = opts [ '<STR_LIT>' ] [ alias ] [ driver ] <EOL> if name in details : <EOL> if isinstance ( value , dict ) : <EOL> value . update ( details [ name ] . copy ( ) ) <EOL> else : <EOL> value = deepcopy ( details [ name ] ) <EOL> elif len ( opts [ '<STR_LIT>' ] . get ( vm_ [ '<STR_LIT>' ] , ( ) ) ) > <NUM_LIT:1> : <EOL> log . error ( <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' . format ( <EOL> vm_ [ '<STR_LIT>' ] <EOL> ) <EOL> ) <EOL> if vm_ [ '<STR_LIT>' ] in opts [ '<STR_LIT>' ] : <EOL> alias_defs = opts [ '<STR_LIT>' ] . get ( vm_ [ '<STR_LIT>' ] ) <EOL> provider_driver_defs = alias_defs [ next ( iter ( list ( alias_defs . keys ( ) ) ) ) ] <EOL> if name in provider_driver_defs : <EOL> if isinstance ( value , dict ) : <EOL> value . update ( provider_driver_defs [ name ] . copy ( ) ) <EOL> else : <EOL> value = deepcopy ( provider_driver_defs [ name ] ) <EOL> if name and vm_ and name in vm_ : <EOL> if isinstance ( vm_ [ name ] , types . GeneratorType ) : <EOL> value = next ( vm_ [ name ] , '<STR_LIT>' ) <EOL> else : <EOL> if isinstance ( value , dict ) : <EOL> value . update ( vm_ [ name ] . copy ( ) ) <EOL> else : <EOL> value = deepcopy ( vm_ [ name ] ) <EOL> return value <EOL> def is_provider_configured ( opts , provider , required_keys = ( ) ) : <EOL> '''<STR_LIT>''' <EOL> if '<STR_LIT::>' in provider : <EOL> alias , driver = provider . split ( '<STR_LIT::>' ) <EOL> if alias not in opts [ '<STR_LIT>' ] : <EOL> return False <EOL> if driver not in opts [ '<STR_LIT>' ] [ alias ] : <EOL> return False <EOL> for key in required_keys : <EOL> if opts [ '<STR_LIT>' ] [ alias ] [ driver ] . get ( key , None ) is None : <EOL> log . warning ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( key , provider , alias ) <EOL> ) <EOL> return False <EOL> return opts [ '<STR_LIT>' ] [ alias ] [ driver ] <EOL> for alias , drivers in six . iteritems ( opts [ '<STR_LIT>' ] ) : <EOL> for driver , provider_details in six . iteritems ( drivers ) : <EOL> if driver != provider : <EOL> continue <EOL> skip_provider = False <EOL> for key in required_keys : <EOL> if provider_details . get ( key , None ) is None : <EOL> log . warning ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( <EOL> key , provider , alias <EOL> ) <EOL> ) <EOL> skip_provider = True <EOL> break <EOL> if skip_provider : <EOL> continue <EOL> return provider_details <EOL> return False <EOL> def is_profile_configured ( opts , provider , profile_name , vm_ = None ) : <EOL> '''<STR_LIT>''' <EOL> required_keys = [ '<STR_LIT>' ] <EOL> alias , driver = provider . split ( '<STR_LIT::>' ) <EOL> non_image_drivers = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> non_size_drivers = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> provider_key = opts [ '<STR_LIT>' ] [ alias ] [ driver ] <EOL> profile_key = opts [ '<STR_LIT>' ] [ alias ] [ driver ] [ '<STR_LIT>' ] [ profile_name ] <EOL> if driver == '<STR_LIT>' and profile_key . get ( '<STR_LIT>' , False ) : <EOL> non_image_drivers . append ( '<STR_LIT>' ) <EOL> non_size_drivers . append ( '<STR_LIT>' ) <EOL> if driver == '<STR_LIT>' and profile_key . get ( '<STR_LIT:image>' , True ) : <EOL> non_image_drivers . append ( '<STR_LIT>' ) <EOL> if driver not in non_image_drivers : <EOL> required_keys . append ( '<STR_LIT:image>' ) <EOL> if driver == '<STR_LIT>' : <EOL> required_keys . append ( '<STR_LIT>' ) <EOL> elif driver in [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] : <EOL> required_keys . append ( '<STR_LIT>' ) <EOL> elif driver == '<STR_LIT>' : <EOL> nova_image_keys = [ '<STR_LIT:image>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> if not any ( [ key in provider_key for key in nova_image_keys ] ) and not any ( [ key in profile_key for key in nova_image_keys ] ) : <EOL> required_keys . extend ( nova_image_keys ) <EOL> if driver not in non_size_drivers : <EOL> required_keys . append ( '<STR_LIT:size>' ) <EOL> for item in list ( required_keys ) : <EOL> if item in provider_key : <EOL> required_keys . remove ( item ) <EOL> if vm_ : <EOL> for item in list ( required_keys ) : <EOL> if item in vm_ : <EOL> required_keys . remove ( item ) <EOL> for item in required_keys : <EOL> if profile_key . get ( item , None ) is None : <EOL> log . error ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' . format ( item , profile_name , alias ) <EOL> ) <EOL> return False <EOL> return True <EOL> def check_driver_dependencies ( driver , dependencies ) : <EOL> '''<STR_LIT>''' <EOL> ret = True <EOL> for key , value in six . iteritems ( dependencies ) : <EOL> if value is False : <EOL> log . warning ( <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" . format ( <EOL> key , <EOL> driver <EOL> ) <EOL> ) <EOL> ret = False <EOL> return ret <EOL> def _cache_id ( minion_id , cache_file ) : <EOL> '''<STR_LIT>''' <EOL> try : <EOL> with salt . utils . fopen ( cache_file , '<STR_LIT:w>' ) as idf : <EOL> idf . write ( minion_id ) <EOL> except ( IOError , OSError ) as exc : <EOL> log . error ( '<STR_LIT>' . format ( exc ) ) <EOL> def get_id ( opts , cache_minion_id = False ) : <EOL> '''<STR_LIT>''' <EOL> if opts [ '<STR_LIT>' ] is None : <EOL> root_dir = salt . syspaths . ROOT_DIR <EOL> else : <EOL> root_dir = opts [ '<STR_LIT>' ] <EOL> config_dir = salt . syspaths . CONFIG_DIR <EOL> if config_dir . startswith ( salt . syspaths . ROOT_DIR ) : <EOL> config_dir = config_dir . split ( salt . syspaths . ROOT_DIR , <NUM_LIT:1> ) [ - <NUM_LIT:1> ] <EOL> id_cache = os . path . join ( root_dir , <EOL> config_dir . lstrip ( os . path . sep ) , <EOL> '<STR_LIT>' ) <EOL> if opts . get ( '<STR_LIT>' , True ) : <EOL> try : <EOL> with salt . utils . fopen ( id_cache ) as idf : <EOL> name = idf . readline ( ) . strip ( ) <EOL> bname = salt . utils . to_bytes ( name ) <EOL> if bname . startswith ( codecs . BOM ) : <EOL> name = salt . utils . to_str ( bname . replace ( codecs . BOM , '<STR_LIT>' , <NUM_LIT:1> ) ) <EOL> if name : <EOL> log . debug ( '<STR_LIT>' . format ( id_cache , name ) ) <EOL> return name , False <EOL> except ( IOError , OSError ) : <EOL> pass <EOL> if '<STR_LIT>' in opts and opts . get ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> log . debug ( '<STR_LIT>' <EOL> . format ( os . path . join ( salt . syspaths . CONFIG_DIR , '<STR_LIT>' ) ) ) <EOL> newid = salt . utils . network . generate_minion_id ( ) <EOL> if '<STR_LIT>' in opts and opts . get ( '<STR_LIT>' ) == '<STR_LIT>' : <EOL> log . info ( '<STR_LIT>' . format ( newid ) ) <EOL> if cache_minion_id and opts . get ( '<STR_LIT>' , True ) : <EOL> _cache_id ( newid , id_cache ) <EOL> is_ipv4 = newid . count ( '<STR_LIT:.>' ) == <NUM_LIT:3> and not any ( c . isalpha ( ) for c in newid ) <EOL> return newid , is_ipv4 <EOL> def apply_minion_config ( overrides = None , <EOL> defaults = None , <EOL> cache_minion_id = False ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = DEFAULT_MINION_OPTS <EOL> opts = defaults . copy ( ) <EOL> opts [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if overrides : <EOL> opts . update ( overrides ) <EOL> opts [ '<STR_LIT>' ] = os . path . basename ( sys . argv [ <NUM_LIT:0> ] ) <EOL> if len ( opts [ '<STR_LIT>' ] ) > len ( opts [ '<STR_LIT>' ] ) + <NUM_LIT:10> : <EOL> opts [ '<STR_LIT>' ] = os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> using_ip_for_id = False <EOL> if not opts . get ( '<STR_LIT:id>' ) : <EOL> opts [ '<STR_LIT:id>' ] , using_ip_for_id = get_id ( <EOL> opts , <EOL> cache_minion_id = cache_minion_id ) <EOL> if not using_ip_for_id and '<STR_LIT>' in opts : <EOL> opts [ '<STR_LIT:id>' ] = _append_domain ( opts ) <EOL> opts [ '<STR_LIT>' ] = opts [ '<STR_LIT>' ] is True <EOL> opts [ '<STR_LIT>' ] = ( <EOL> opts . get ( '<STR_LIT>' ) or <EOL> [ os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) ] <EOL> ) <EOL> insert_system_path ( opts , opts [ '<STR_LIT>' ] ) <EOL> prepend_root_dirs = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> ] <EOL> for config_key in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> if urlparse ( opts . get ( config_key , '<STR_LIT>' ) ) . scheme == '<STR_LIT>' : <EOL> prepend_root_dirs . append ( config_key ) <EOL> prepend_root_dir ( opts , prepend_root_dirs ) <EOL> if '<STR_LIT>' not in opts : <EOL> opts [ '<STR_LIT>' ] = { } <EOL> if '<STR_LIT>' not in opts : <EOL> opts [ '<STR_LIT>' ] = { } <EOL> opts [ '<STR_LIT>' ] = opts [ '<STR_LIT>' ] . lower ( ) <EOL> return opts <EOL> def master_config ( path , env_var = '<STR_LIT>' , defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = DEFAULT_MASTER_OPTS <EOL> if not os . environ . get ( env_var , None ) : <EOL> salt_config_dir = os . environ . get ( '<STR_LIT>' , None ) <EOL> if salt_config_dir : <EOL> env_config_file_path = os . path . join ( salt_config_dir , '<STR_LIT>' ) <EOL> if salt_config_dir and os . path . isfile ( env_config_file_path ) : <EOL> os . environ [ env_var ] = env_config_file_path <EOL> overrides = load_config ( path , env_var , DEFAULT_MASTER_OPTS [ '<STR_LIT>' ] ) <EOL> default_include = overrides . get ( '<STR_LIT>' , <EOL> defaults [ '<STR_LIT>' ] ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( include_config ( default_include , path , verbose = False ) ) <EOL> overrides . update ( include_config ( include , path , verbose = True ) ) <EOL> opts = apply_master_config ( overrides , defaults ) <EOL> _validate_opts ( opts ) <EOL> if opts . get ( '<STR_LIT>' ) is None : <EOL> opts [ '<STR_LIT>' ] = DEFAULT_MASTER_OPTS . get ( '<STR_LIT>' , { } ) <EOL> if opts . get ( '<STR_LIT>' ) == '<STR_LIT>' and '<STR_LIT>' in opts : <EOL> opts . pop ( '<STR_LIT>' ) <EOL> return opts <EOL> def apply_master_config ( overrides = None , defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> import salt . crypt <EOL> if defaults is None : <EOL> defaults = DEFAULT_MASTER_OPTS <EOL> opts = defaults . copy ( ) <EOL> opts [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if overrides : <EOL> opts . update ( overrides ) <EOL> if len ( opts [ '<STR_LIT>' ] ) > len ( opts [ '<STR_LIT>' ] ) + <NUM_LIT:10> : <EOL> opts [ '<STR_LIT>' ] = os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> opts [ '<STR_LIT>' ] = ( <EOL> opts . get ( '<STR_LIT>' ) or <EOL> os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> ) <EOL> opts [ '<STR_LIT>' ] = os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> opts [ '<STR_LIT>' ] = os . path . join ( opts [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> using_ip_for_id = False <EOL> append_master = False <EOL> if not opts . get ( '<STR_LIT:id>' ) : <EOL> opts [ '<STR_LIT:id>' ] , using_ip_for_id = get_id ( <EOL> opts , <EOL> cache_minion_id = None ) <EOL> append_master = True <EOL> if not using_ip_for_id and '<STR_LIT>' in opts : <EOL> opts [ '<STR_LIT:id>' ] = _append_domain ( opts ) <EOL> if append_master : <EOL> opts [ '<STR_LIT:id>' ] += '<STR_LIT>' <EOL> prepend_root_dirs = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' <EOL> ] <EOL> for config_key in ( '<STR_LIT>' , '<STR_LIT>' ) : <EOL> log_setting = opts . get ( config_key , '<STR_LIT>' ) <EOL> if log_setting is None : <EOL> continue <EOL> if urlparse ( log_setting ) . scheme == '<STR_LIT>' : <EOL> prepend_root_dirs . append ( config_key ) <EOL> prepend_root_dir ( opts , prepend_root_dirs ) <EOL> opts [ '<STR_LIT>' ] = opts [ '<STR_LIT>' ] is True <EOL> opts [ '<STR_LIT>' ] = opts [ '<STR_LIT>' ] is True <EOL> opts [ '<STR_LIT>' ] = _validate_file_roots ( opts ) <EOL> if opts [ '<STR_LIT>' ] : <EOL> if isinstance ( opts [ '<STR_LIT>' ] , str ) : <EOL> ignore_regex = [ opts [ '<STR_LIT>' ] ] <EOL> elif isinstance ( opts [ '<STR_LIT>' ] , list ) : <EOL> ignore_regex = opts [ '<STR_LIT>' ] <EOL> opts [ '<STR_LIT>' ] = [ ] <EOL> for regex in ignore_regex : <EOL> try : <EOL> re . compile ( regex ) <EOL> opts [ '<STR_LIT>' ] . append ( regex ) <EOL> except Exception : <EOL> log . warning ( <EOL> '<STR_LIT>' . format ( <EOL> regex <EOL> ) <EOL> ) <EOL> if opts [ '<STR_LIT>' ] : <EOL> if isinstance ( opts [ '<STR_LIT>' ] , str ) : <EOL> opts [ '<STR_LIT>' ] = [ opts [ '<STR_LIT>' ] ] <EOL> if opts [ '<STR_LIT>' ] < <NUM_LIT:3> and opts . get ( '<STR_LIT>' , None ) : <EOL> log . warning ( <EOL> "<STR_LIT>" <EOL> '<STR_LIT>' . format ( <EOL> opts [ '<STR_LIT>' ] <EOL> ) <EOL> ) <EOL> opts [ '<STR_LIT>' ] = <NUM_LIT:3> <EOL> opts . setdefault ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> opts [ '<STR_LIT>' ] = opts [ '<STR_LIT>' ] . lower ( ) <EOL> return opts <EOL> def client_config ( path , env_var = '<STR_LIT>' , defaults = None ) : <EOL> '''<STR_LIT>''' <EOL> if defaults is None : <EOL> defaults = DEFAULT_MASTER_OPTS <EOL> xdg_dir = salt . utils . xdg . xdg_config_dir ( ) <EOL> if os . path . isdir ( xdg_dir ) : <EOL> client_config_dir = xdg_dir <EOL> saltrc_config_file = '<STR_LIT>' <EOL> else : <EOL> client_config_dir = os . path . expanduser ( '<STR_LIT>' ) <EOL> saltrc_config_file = '<STR_LIT>' <EOL> opts = { <EOL> '<STR_LIT>' : defaults . get ( <EOL> '<STR_LIT>' , <EOL> os . path . join ( client_config_dir , '<STR_LIT>' ) <EOL> ) <EOL> } <EOL> opts . update ( <EOL> master_config ( path , defaults = defaults ) <EOL> ) <EOL> saltrc_config = os . path . join ( client_config_dir , saltrc_config_file ) <EOL> opts . update ( <EOL> load_config ( <EOL> saltrc_config , <EOL> env_var , <EOL> saltrc_config <EOL> ) <EOL> ) <EOL> if '<STR_LIT>' in opts : <EOL> opts [ '<STR_LIT>' ] = os . path . abspath ( <EOL> os . path . expanduser ( <EOL> opts [ '<STR_LIT>' ] <EOL> ) <EOL> ) <EOL> if os . path . isfile ( opts [ '<STR_LIT>' ] ) : <EOL> expire = opts . get ( '<STR_LIT>' , <NUM_LIT> ) <EOL> if os . stat ( opts [ '<STR_LIT>' ] ) . st_mtime + expire > time . mktime ( time . localtime ( ) ) : <EOL> with salt . utils . fopen ( opts [ '<STR_LIT>' ] ) as fp_ : <EOL> opts [ '<STR_LIT>' ] = fp_ . read ( ) . strip ( ) <EOL> if opts [ '<STR_LIT>' ] == '<STR_LIT>' : <EOL> opts [ '<STR_LIT>' ] = '<STR_LIT:127.0.0.1>' <EOL> if '<STR_LIT>' not in opts : <EOL> opts [ '<STR_LIT>' ] = '<STR_LIT>' . format ( <EOL> ip = salt . utils . ip_bracket ( opts [ '<STR_LIT>' ] ) , <EOL> port = opts [ '<STR_LIT>' ] <EOL> ) <EOL> _validate_opts ( opts ) <EOL> return opts <EOL> def api_config ( path ) : <EOL> '''<STR_LIT>''' <EOL> defaults = DEFAULT_MASTER_OPTS <EOL> defaults . update ( DEFAULT_API_OPTS ) <EOL> return client_config ( path , defaults = defaults ) <EOL> def spm_config ( path ) : <EOL> '''<STR_LIT>''' <EOL> defaults = DEFAULT_MASTER_OPTS <EOL> defaults . update ( DEFAULT_SPM_OPTS ) <EOL> overrides = load_config ( path , '<STR_LIT>' , DEFAULT_SPM_OPTS [ '<STR_LIT>' ] ) <EOL> default_include = overrides . get ( '<STR_LIT>' , <EOL> defaults [ '<STR_LIT>' ] ) <EOL> include = overrides . get ( '<STR_LIT>' , [ ] ) <EOL> overrides . update ( include_config ( default_include , path , verbose = False ) ) <EOL> overrides . update ( include_config ( include , path , verbose = True ) ) <EOL> defaults = apply_master_config ( overrides , defaults ) <EOL> defaults = apply_spm_config ( overrides , defaults ) <EOL> return client_config ( path , env_var = '<STR_LIT>' , defaults = defaults ) <EOL> def apply_spm_config ( overrides , defaults ) : <EOL> '''<STR_LIT>''' <EOL> opts = defaults . copy ( ) <EOL> if overrides : <EOL> opts . update ( overrides ) <EOL> prepend_root_dirs = [ <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' <EOL> ] <EOL> for config_key in ( '<STR_LIT>' , ) : <EOL> log_setting = opts . get ( config_key , '<STR_LIT>' ) <EOL> if log_setting is None : <EOL> continue <EOL> if urlparse ( log_setting ) . scheme == '<STR_LIT>' : <EOL> prepend_root_dirs . append ( config_key ) <EOL> prepend_root_dir ( opts , prepend_root_dirs ) <EOL> return opts </s>
