puppetlabs/facter — pull request #342 by jeffmccune (2012-10-19 22:24:01+00:00)
Title: (#11609) Fix processorX facts for AIX systems

Without this patch Facter running on AIX systems will output misleading
information in the indexed processorX facts. This misleading
information looks like:

$ facter processor0
processor0 => 0PowerPC_POWER5
processor1 => 6PowerPC_POWER5
processor2 => 2PowerPC_POWER5
processor3 => 4PowerPC_POWER5

There are a number of problems here. First, the mapping of values to
their index is not stable, resulting in non-deterministic behavior.
Second, the AIX specific identifiers are leaking into the fact values.

I learned my lesson when I implemented the Mac OS X System Profiler sp_*
facts. The lesson learned is that we should not implement facts
specific to a single platform, but instead re-use the existing
platform-agnostic and consistent facts we have.

To this end, this patch solves the problem by mapping the platform
specific processor identifiers to our incrementing index identifiers.
The patch makes sure to sort the list so the results are idempotent.

The new output is:

$ facter processor0
processor0 => PowerPC_POWER5
processor1 => PowerPC_POWER5
processor2 => PowerPC_POWER5
processor3 => PowerPC_POWER5