def verify_tops(self, tops):
        '''
        Verify the contents of the top file data
        '''
        errors = []
        if not isinstance(tops, dict):
            errors.append('Top data was not formed as a dict')
            # No further checks will work, bail out
            return errors
        for saltenv, matches in six.iteritems(tops):
            if saltenv == 'include':
                continue
            if not isinstance(saltenv, six.string_types):
                errors.append(
                    'Environment {0} in top file is not formed as a '
                    'string'.format(saltenv)
                )
            if saltenv == '':
                errors.append('Empty saltenv statement in top file')
            if not isinstance(matches, dict):
                errors.append(
                    'The top file matches for saltenv {0} are not '
                    'formatted as a dict'.format(saltenv)
                )
            for slsmods in six.itervalues(matches):
                if not isinstance(slsmods, list):
                    errors.append('Malformed topfile (state declarations not '
                                  'formed as a list)')
                    continue
                for slsmod in slsmods:
                    if isinstance(slsmod, dict):
                        # This value is a match option
                        for val in six.itervalues(slsmod):
                            if not val:
                                errors.append(
                                    'Improperly formatted top file matcher '
                                    'in saltenv {0}: {1} file'.format(
                                        slsmod,
                                        val
                                    )
                                )
                    elif isinstance(slsmod, six.string_types):
                        # This is a sls module
                        if not slsmod:
                            errors.append(
                                'Environment {0} contains an empty sls '
                                'index'.format(saltenv)
                            )

        return errors
def verify_tops ( self , tops ) : errors = [ ] if not isinstance ( tops , dict ) : errors . append ( 'Top data was not formed as a dict' ) return errors for saltenv , matches in six . iteritems ( tops ) : if saltenv == 'include' : continue if not isinstance ( saltenv , six . string_types ) : errors . append ( 'Environment {0} in top file is not formed as a ' 'string' . format ( saltenv ) ) if saltenv == '' : errors . append ( 'Empty saltenv statement in top file' ) if not isinstance ( matches , dict ) : errors . append ( 'The top file matches for saltenv {0} are not ' 'formatted as a dict' . format ( saltenv ) ) for slsmods in six . itervalues ( matches ) : if not isinstance ( slsmods , list ) : errors . append ( 'Malformed topfile (state declarations not ' 'formed as a list)' ) continue for slsmod in slsmods : if isinstance ( slsmod , dict ) : for val in six . itervalues ( slsmod ) : if not val : errors . append ( 'Improperly formatted top file matcher ' 'in saltenv {0}: {1} file' . format ( slsmod , val ) ) elif isinstance ( slsmod , six . string_types ) : if not slsmod : errors . append ( 'Environment {0} contains an empty sls ' 'index' . format ( saltenv ) ) return errors
Verify the contents of the top file data