saltstack/salt — pull request #2063 by thekuffs (2012-09-23 01:43:18+00:00)
Title: Rework os, osrelease, and oscodename grains

* Rework the above three grains
* Rework data flow for Windows and Linux core grains
* Optimize some repeated calls

As noted in #2054, I had some issues when using CentOS-built frozen installs on Ubuntu. The grains were incorrect and insisted that my Ubuntu box was Debian Sid. This comes about from some custom patches that Ubuntu runs to read ```/etc/lsb-release``` before ```/etc/debian-release``` in ```platform.linux_distribution()```

I've also taken the liberty of optimizing some of the code paths. There were some unnecessary calls to the command-line ```uname``` when Python's own ```platform.uname()``` provides the info we want. I removed the massive switchblock to read ```/etc/DISTRO-release``` and instead am using functionality from ```platform.linux_distribution()```. As part of that cleanup I added an ```os``` -> ```os_family``` map.

I've tested these changes on CentOS 6.3 and Ubuntu 10.04 as well as a frozen build from CentOS 6.3 *on* Ubuntu 10.04. I also tested Windows Server 2008 R2. All the grains produce the same exact values as from an unmodified tree (except for the new ```'kernelversion'``` grain on Windows , and ```'num_cpus'``` is now an integer on Windows).