Accessing attributes of Chef::Provider::Package subclass instance from recipe -


i need somehow "return" variable custom subclass of chef::provider::package recipe called from, can use variable later in same recipe.

i tried add custom chef::resource::package subclass attribute , appropriate setter/getter wrapper set_or_return function. can write , read attribute chef::provider::package subclass, when try access attribute recipe see nil value. can illustrated following recipe:

a = apt_package "bzip2"   action :install end  # won't work, a.version nil log "bzip package version #{a.version}" 

however, can see in lib/chef/provider/package/apt.rb @current_resource.version being set:

@current_resource.version(installed_version) 

what right way of reading arbitrary attribute (version in example) of chef::resource::aptpackage instance, created apt_package provider same recipe?

maybe like::

a = apt_package "bzip2"           action :install       end        ruby_block "init logger"         block           logger= resources("log[printing version]")           logger.message a.version         end       end        log "printing version"         message ""        end 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -