Chef 'package' resource as LWRP

139 Views Asked by At

I want to extend 'package' resource and provide it as LWRP - cookbookname_package to be called from other cookbooks.

Is it necessary to manually rewrite all properties from the package resource to cookbookname/resources/package.rb?

Is there a way to simply take existing ones from Chef source code or is there only way to be as translator and maintain all of these?

  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

There are 1 best solutions below

1
On BEST ANSWER

No, the LWRP DSL doesn't allow for subclassing. You'll need to put the file under libraries/ and write Plain Old Ruby Code.