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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -