'''
Control aspects of the grains data
'''

# Seed the grains dict so cython will build
__grains__ = {}

# Change the default outputter to make it more readable
__outputter__ = {
    'item': 'txt',
    'items': 'yaml',
}


def items():
    '''
    Return the grains data

    CLI Example::

        salt '*' grains.items
    '''
    return __grains__


def item(key=None):
    '''
    Return a singe component of the grains data

    CLI Example::

        salt '*' grains.item os
    '''
    return __grains__.get(key, '')


def ls():
    '''
    Return a list of all available grains

    CLI Example::

        salt '*' grains.ls
    '''
    return sorted(__grains__)

@@ -224,110 +224,779 @@
 def 
-items():%0A    '''%0A    Return the grains data%0A%0A    CLI Example::%0A%0A        salt '*' grains.items%0A    '''%0A
+_str_sanitizer(instr):%0A    return %22%7B0%7D%7B1%7D%22.format(instr%5B:-4%5D, 'X' * 4)%0A%0A# A dictionary of grain -%3E function mappings for sanitizing grain output. This%0A# is used when the 'sanitize' flag is given.%0A_sanitizers = %7B%0A    'serialnumber': _str_sanitizer,%0A    'domain': lambda x: 'domain',%0A    'fqdn': lambda x: 'minion.domain',%0A    'host': lambda x: 'minion',%0A    'id': lambda x: 'minion.domain',%0A%7D%0A%0A%0Adef items(sanitize=False):%0A    '''%0A    Return the grains data%0A%0A    CLI Example::%0A%0A        salt '*' grains.items%0A%0A    Sanitized CLI output::%0A%0A        salt '*' grains.items sanitize=True%0A    '''%0A    if sanitize:%0A        out = dict(__grains__)%0A        for (k, f) in _sanitizers.items():%0A            if k in out:%0A                out%5Bk%5D = f(out%5Bk%5D)%0A        return out%0A    else:%0A    
     
@@ -1032,16 +1032,32 @@
 key=None
+, sanitize=False
 ):%0A    '
@@ -1159,24 +1159,220 @@
 item os%0A
+%0A    Sanitized CLI output::%0A%0A        salt '*' grains.items serialnumber sanitize=True%0A    '''%0A    if sanitize and key in _sanitizers:%0A        return _sanitizers%5Bkey%5D(_grains__.get(key, ''))%0A    else:%0A
     
-'''%0A
     retu

Add 'sanitize' option for grains module