繁体   English   中英

人偶事实Mac模型

[英]puppet facter mac model

我正在创建一个人偶清单,并试图使用基于MAC模型的内置变量。 我正在使用此指南: https : //docs.puppetlabs.com/facter/3.1/core_facts.html

我看到system_profiler带有model_identifier选项,但是我不确定正确的语法是什么。

这是我很困惑的地方:

class::something::mac
if $<% system_profiler %> eq "macpro"; then
do the thing
else
don't do the thing

我实际在哪里/如何使用model_identifier? 我是puppet和MAC的新手,所以任何建议都很棒!

我当前的工厂版本v2.4不支持它,但是我无法成功安装最新的工厂版本v3.1.4,因此无法测试代码。 您的问题应该关闭。

if $::system_profiler::model_identifier == "MacBookPro10,2" {
   do the thing
}
else {
   don't do the thing
}

在Mac上运行命令进行验证。

$ system_profiler SPHardwareDataType
Hardware:

    Hardware Overview:

      Model Name: MacBook Pro
      Model Identifier: MacBookPro10,2

相关代码:

+            { "Model Identifier",       [](data& d) -> string& { return d.model_identifier; } },

https://github.com/puppetlabs/facter/commit/4283cfe23b56f22b03fbc863a3eb1498d2bcbea9#diff-c8b70e57e1ae5727ed062f26d5a9fa30R25

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM