lwrp

Why does the LWRP custom definition gives me undefined method for nil:NilClass

蹲街弑〆低调 提交于 2019-12-22 08:40:11
问题 I have problem with my custom definition of this LWRP. resources : user_postgresql. actions :create, :alter default_action :create attribute :username, :kind_of => String attribute :password, :kind_of => String attribute :database_name, :kind_of => String providers : user_postgresql. def whyrun_supported? true end action :create do converge_by "Create [#{new_resource}]" do USER_NAME = new_resource.username USER_PASSWORD = new_resource.password unless (new_resource.password.nil? || new

How can you access Chef LWRP attributes in a recipe

左心房为你撑大大i 提交于 2019-12-11 13:48:54
问题 With some of the default chef resources, it is possible to access some of their attributes after they have been called # recipes/default.rb f = file "/tmp/file_resource" do owner "root" group "root" mode "0755" action :create end log "Path to my file is #{f.path}" # outputs "/tmp/file_resource" How can this be achieved in a custom LWRP (here is an example) # resources/default.rb actions :create default_action :create attribute :relative_path, :kind_of => String, :name_attribute => true

How to I get a chef custom lwrp to implement notifies and not_if?

谁说胖子不能爱 提交于 2019-12-07 16:45:00
问题 I write a custom Lightweight resource. But the notifies and only_if is not recognized. Anyone else get this working? I use these in opsworks supplies resources. So I know I am using them correctly. Unfortunately proprietary code, so I can't post the code. 回答1: Ok. RTFM. Well not really. I did not find this specific issue covered. If you write your own light weight resource and want to be able to use notifies, then use new_resource.updated_by_last_action(false) or new_resource.updated_by_last

How to I get a chef custom lwrp to implement notifies and not_if?

℡╲_俬逩灬. 提交于 2019-12-06 02:26:01
I write a custom Lightweight resource. But the notifies and only_if is not recognized. Anyone else get this working? I use these in opsworks supplies resources. So I know I am using them correctly. Unfortunately proprietary code, so I can't post the code. Ok. RTFM. Well not really. I did not find this specific issue covered. If you write your own light weight resource and want to be able to use notifies, then use new_resource.updated_by_last_action(false) or new_resource.updated_by_last_action(true) in your resource action code. notifies will then happen (true) or not happen(false). Here is an

Why does the LWRP custom definition gives me undefined method for nil:NilClass

喜你入骨 提交于 2019-12-05 11:55:34
I have problem with my custom definition of this LWRP. resources : user_postgresql. actions :create, :alter default_action :create attribute :username, :kind_of => String attribute :password, :kind_of => String attribute :database_name, :kind_of => String providers : user_postgresql. def whyrun_supported? true end action :create do converge_by "Create [#{new_resource}]" do USER_NAME = new_resource.username USER_PASSWORD = new_resource.password unless (new_resource.password.nil? || new_resource.password.empty?) USER_PASSWORD = USER_NAME DATABASE_NAME = new_resource.database_name unless (new

Including a Chef LWRP from another cookbook

别来无恙 提交于 2019-12-04 08:51:24
问题 I wrote a small LWRP my app cookbook ( trim_log ), and it works. However, now I am trying to move this particular LWRP in to the commons cookbook so that my other cookbooks can also use it. The problem is that I cannot figure out how to load in the trim_log resource/provider in to any of the cookbooks, including my app cookbook. ├── app │ ├── recipes │ └── default.rb ├── commons ├── providers │ └── trim_log.rb └── resources └── trim_log.rb I have defined the trim_log provider/resource in the

Including a Chef LWRP from another cookbook

自古美人都是妖i 提交于 2019-12-03 01:18:07
I wrote a small LWRP my app cookbook ( trim_log ), and it works. However, now I am trying to move this particular LWRP in to the commons cookbook so that my other cookbooks can also use it. The problem is that I cannot figure out how to load in the trim_log resource/provider in to any of the cookbooks, including my app cookbook. ├── app │ ├── recipes │ └── default.rb ├── commons ├── providers │ └── trim_log.rb └── resources └── trim_log.rb I have defined the trim_log provider/resource in the commons cookbook. Now I wish to use this trim_log provider/resource in the app cookbook. How can I make