def _disabled(funs): ''' Return messages for disabled states that match state functions in funs. ''' ret = [] _disabled = __salt__['grains.get']('state_runs_disabled') for state in funs: for _state in _disabled: if '.*' in _state: target_state = _state.split('.')[0] target_state = target_state + '.' if not target_state.endswith('.') else target_state if state.startswith(target_state): err = ( 'The state file "{0}" is currently disabled by "{1}", ' 'to re-enable, run state.enable {1}.' ).format( state, _state, ) ret.append(err) continue else: if _state == state: err = ( 'The state file "{0}" is currently disabled, ' 'to re-enable, run state.enable {0}.' ).format( _state, ) ret.append(err) continue return ret
def lowstate_file_refs(chunks, extras=''): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: if not isinstance(chunk, dict): continue saltenv = 'base' crefs = [] for state in chunk: if state == '__env__': saltenv = chunk[state] elif state.startswith('__'): continue crefs.extend(salt_refs(chunk[state])) if crefs: if saltenv not in refs: refs[saltenv] = [] refs[saltenv].append(crefs) if extras: extra_refs = extras.split(',') if extra_refs: for env in refs: for x in extra_refs: refs[env].append([x]) return refs
def lowstate_file_refs(chunks): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: env = 'base' crefs = [] for state in chunk: if state == '__env__': env = chunk[state] elif state.startswith('__'): continue crefs.extend(salt_refs(chunk[state])) if crefs: if not env in refs: refs[env] = [] refs[env].append(crefs) return refs
def lowstate_file_refs(chunks): """ Create a list of file ref objects to reconcile """ refs = {} for chunk in chunks: saltenv = "base" crefs = [] for state in chunk: if state == "__env__": saltenv = chunk[state] elif state.startswith("__"): continue crefs.extend(salt_refs(chunk[state])) if crefs: if not saltenv in refs: refs[saltenv] = [] refs[saltenv].append(crefs) return refs
def lowstate_file_refs(chunks): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: saltenv = 'base' crefs = [] for state in chunk: if state == '__env__': saltenv = chunk[state] elif state == 'saltenv': saltenv = chunk[state] elif state.startswith('__'): continue crefs.extend(salt_refs(chunk[state])) if crefs: if saltenv not in refs: refs[saltenv] = [] refs[saltenv].append(crefs) return refs
def lowstate_file_refs(chunks): ''' Create a list of file ref objects to reconcile ''' refs = {} for chunk in chunks: env = 'base' crefs = [] for state in chunk: if state == '__env__': env = chunk[state] elif state.startswith('__'): continue for arg in chunk[state]: if not isinstance(arg, dict): continue if len(arg) < 1: continue crefs = salt_refs(arg[arg.keys()][0]) if crefs: if not env in refs: refs[env] = [] refs[env].append(crefs) return refs