如何强制Facter稳定输出?

How to force Facter to output in stable order?

如果我 运行 facter(例如 facter -p)多次,那么每次我都获得相同的结果,但顺序不同。

这使得比较不同 运行 的因素或傀儡变得比必要的更困难。

如何获得稳定的输出订单?

How can I obtain a stable output order?

Facter 没有影响输出顺序的命令行选项。不过,如果您想更轻松地比较不同运行的结果,您可以通过 sort 进行管道传输。

您使用的 Ruby 是什么版本?在 Ruby 1.8.7 中,散列没有排序

The order in which you traverse a hash by either key or value may seem arbitrary, and will generally not be in the insertion order.

您的问题可能是什么原因造成的?

facter | sort

运行排序结果