Python 版本的“facter”?
我正在考虑收集服务器数据,并且在这些服务器中预安装了 Python 2.6。 现在我想知道是否有Python库对应于Ruby的“facter”,而不是Python的“facter”“绑定”。
我用谷歌搜索了一下但没有找到。有人对此有任何想法吗?
I'm considering collect server data and in those servers Python 2.6 are pre-installed.
Now I wonder if there are Python library correspond to "facter" of Ruby, not the Python "binding" for facter.
I googled about it but couldn't find any. Does anyone have any idea about this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我看不出你有什么理由不直接使用facter 本身。输出格式可以在 python 脚本中轻松使用。
I can't see any reason why you wouldn't just use facter itself. The output format is easily consumable from within a python script.
Salt 实现了一个称为 Grains 的 Facter 替代品。
http://docs.saltstack.org/en/latest /ref/modules/index.html#grains-data
还有一种尝试称为 Phacter
http://code.google.com/p/speed/wiki/Phacter
我没有尝试过,但我同意这个概念。人们可能不希望/无法在他们的系统上安装 Ruby,但想要类似的功能。
Salt implements a Facter replacement called Grains.
http://docs.saltstack.org/en/latest/ref/modules/index.html#grains-data
There is also an attempt to do this called Phacter
http://code.google.com/p/speed/wiki/Phacter
I haven't tried it, however I agree with the concept. One may not want/be able to install Ruby on their system but want the similar functionality.
有点新 http://github.com/hihellobolke/sillyfacter/
安装使用
您可能需要升级 pip也
Somewhat new http://github.com/hihellobolke/sillyfacter/
Install using
You may beed to upgrade pip too
这是@AndrewWalker 建议的更压缩版本。它还确保 ' => ' 在分割之前存在并删除尾随 \n :
我想我会选择 facterpy,不过。
pip installfacterpy
,然后:Here is a more compressed version of @AndrewWalker's suggestion. It also ensures ' => ' is present before splitting and removes the trailing \n :
I think I am going for facterpy, though.
pip install facterpy
, then: