【问题标题】:How to implement constants across custom resources in Chef?如何在 Chef 中跨自定义资源实现常量?
【发布时间】:2017-08-09 18:20:26
【问题描述】:

我正在编写一本定义四个custom resources 的食谱。应该在所有资源之间共享多个常量(某些类型文件的权限、名称前缀、相对路径等...)。

如何在多个自定义资源之间共享这些常量?

【问题讨论】:

    标签: ruby chef-infra cookbook


    【解决方案1】:

    将 em' 放在 libraries/default.rb 下的模块中:

    module MyCookbook
      BASE_PATH = '/foo'
    end
    
    # And then in the resource
    property(:path, default: MyCookbook::BASE_PATH)
    

    或类似的。

    【讨论】:

      猜你喜欢
      • 2020-06-23
      • 1970-01-01
      • 1970-01-01
      • 2022-11-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-07
      • 2020-01-10
      相关资源
      最近更新 更多