-1

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

是否需要手动将package资源中的所有属性重写为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
4

1 回答 1

1

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

于 2016-08-26T20:22:46.967 回答