【问题标题】:Chef 'package' resource as LWRP厨师“包”资源作为 LWRP
【发布时间】:2016-08-27 16:05:44
【问题描述】:

我想扩展“包”资源并将其作为 LWRP 提供 - 可以从其他食谱中调用的食谱名称包。

是否需要手动将所有属性从package resource重写为cookbookname/resources/package.rb

有没有办法简单地从 Chef 源代码中获取现有的源代码,或者只有作为翻译器并维护所有这些的方法?

  allow_downgrade            TrueClass, FalseClass # Yum, RPM packages only
  arch                       String, Array # Yum packages only
  default_release            String # Apt packages only
  flush_cache                Array
  gem_binary                 String
  homebrew_user              String, Integer # Homebrew packages only
  notifies                   # see description
  options                    String
  package_name               String, Array # defaults to 'name' if not specified
  provider                   Chef::Provider::Package
  response_file              String # Apt packages only
  response_file_variables    Hash # Apt packages only
  source                     String
  subscribes                 # see description
  timeout                    String, Integer
  version                    String, Array
  action                     Symbol # defaults to :install if not specified

【问题讨论】:

    标签: chef-infra lwrp


    【解决方案1】:

    不,LWRP DSL 不允许子类化。您需要将文件放在 libraries/ 下并编写普通旧 Ruby 代码。

    【讨论】:

    • 据我所知,我需要成为翻译(中间人)并手动重写属性。人们在我的食谱中调用LWRP --> LWRP 调用“包装”HWRP。我的代码中有这种情况。刚刚意识到使LWRP 看起来与HWRP 相似涉及一些复杂性。换句话说,使 LWRP:cookbook_package 类似于 package 资源(为用户提供相同的属性)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-12-30
    • 1970-01-01
    • 1970-01-01
    • 2017-07-21
    • 2014-05-28
    相关资源
    最近更新 更多