Chef'package'资源为LWRP

时间:2016-08-26 10:09:24

标签: chef lwrp

我想扩展'package'资源并将其作为LWRP - cookbookname_package提供,以便从其他cookbook中调用。

是否有必要手动重写package resourcecookbookname/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

1 个答案:

答案 0 :(得分:1)

不,LWRP DSL不允许进行子类化。您需要将文件放在libraries/下并编写Plain Old Ruby Code。