saltstack/salt — pull request #2627 by thekuffs (2012-11-18 23:25:07+00:00)
Title: Add grains sanitize

This pull request fixes #2295.

This adds the 'sanitize' option to the grains module, making for safer pastbin diagnostics among community members.

An example of the sanitized output:

```yaml
biosreleasedate: 07/09/2012
biosversion: '6.00'
cpu_flags:
- fpu
- vme
- de
- pse
- tsc
- msr
- pae
- mce
- cx8
- apic
- mtrr
- pge
- mca
- cmov
- pat
- pse36
- clflush
- dts
- acpi
- mmx
- fxsr
- sse
- sse2
- ss
- syscall
- nx
- rdtscp
- lm
- constant_tsc
- up
- arch_perfmon
- pebs
- bts
- xtopology
- tsc_reliable
- nonstop_tsc
- aperfmperf
- unfair_spinlock
- pni
- ssse3
- cx16
- sse4_1
- sse4_2
- popcnt
- hypervisor
- lahf_lm
- ida
- dts
cpu_model: Intel(R) Xeon(R) CPU X5550 @ 2.67GHz
cpuarch: x86_64
defaultencoding: UTF8
defaultlanguage: en_US
domain: DOMAINNAME
fqdn: MINION.DOMAINNAME
host: MINION
id: MINION.DOMAINNAME
kernel: Linux
kernelrelease: 2.6.32-279.11.1.el6.x86_64
localhost: MINION
manufacturer: VMware, Inc.
mem_total: 996
nodename: MINION
num_cpus: 1
os: CentOS
os_family: RedHat
oscodename: Final
osfullname: CentOS
osrelease: '6.3'
path: /venvs/salt/salt-0.10.5.linux-x86_64:/sbin:/usr/sbin:/bin:/usr/bin
productname: VMware Virtual Platform
ps: ps -efH
pythonpath:
- /venvs/salt/salt-0.10.5.linux-x86_64/library.zip
- /venvs/salt/salt-0.10.5.linux-x86_64/setuptools-0.6c11-py2.6.egg
- /venvs/salt/salt-0.10.5.linux-x86_64/salt-0.10.5-py2.6.egg
- /venvs/salt/salt-0.10.5.linux-x86_64/M2Crypto-0.21.1-py2.6-linux-x86_64.egg
- /venvs/salt/salt-0.10.5.linux-x86_64/esky-0.9.7-py2.6.egg
- /venvs/salt/salt-0.10.5.linux-x86_64
pythonversion:
- 2
- 6
- 6
- final
- 0
saltpath: /venvs/salt/salt-0.10.5.linux-x86_64/salt-0.10.5-py2.6.egg/salt
saltversion: 0.10.5
serialnumber: VMware-42 15 33 65 7d b0 f3 32-d3 5d 5b XXXXXXXXXXXXXX
server_id: 1129568707
shell: /bin/sh
virtual: VMware
```

Note that all the uniquely identifying names have been replaced with generics. And that the last 1/4 of the serial number has been replaced with `X`s.