module Chef::Sugar::DSL
Public Instance Methods
@see Chef::Sugar::Architecture#_32_bit?
# File lib/chef/sugar/architecture.rb, line 144 def _32_bit?; Chef::Sugar::Architecture._32_bit?(node); end
@see Chef::Sugar::Architecture#_64_bit?
# File lib/chef/sugar/architecture.rb, line 141 def _64_bit?; Chef::Sugar::Architecture._64_bit?(node); end
@see Chef::Sugar::Architecture#aarch64?
# File lib/chef/sugar/architecture.rb, line 168 def aarch64?; Chef::Sugar::Architecture.aarch64?(node); end
Dynamically insert resources after an existing resource in the resource_collection.
@example Write a custom template after the apache2 service actions
are run after 'service[apache2]' do template '/etc/apache2/thing.conf' do source '...' end end
@param [String] identifier
the +resource[name]+ identifier string
# File lib/chef/sugar/filters.rb, line 148 def after(identifier, &block) Chef::Sugar::Filters::Injector.new(self, identifier, :after).evaluate(&block) end
@see Chef::Sugar::Architecture#arm?
# File lib/chef/sugar/architecture.rb, line 165 def armhf?; Chef::Sugar::Architecture.armhf?(node); end
Dynamically run resources specified in the block during the compilation phase, instead of the convergence phase.
@example The old way
package('apache2') do action :nothing end.run_action(:install)
@example The new way
at_compile_time do package('apache2') end
@example Resource actions are run in order
at_compile_time do service 'apache2' do action [:enable, :start] # run_action(:enable), run_action(:start) end end
# File lib/chef/sugar/filters.rb, line 108 def at_compile_time(&block) Chef::Sugar::Filters::AtCompileTime.new(self).evaluate(&block) end
@see Chef::Sugar::Cloud#azure?
# File lib/chef/sugar/cloud.rb, line 183 def azure?; Chef::Sugar::Cloud.azure?(node); end
Dynamically insert resources before an existing resource in the resource_collection.
@example Write a custom template before the apache2 service actions
are run before 'service[apache2]' do template '/etc/apache2/thing.conf' do source '...' end end
@param [String] identifier
the +resource[name]+ identifier string
# File lib/chef/sugar/filters.rb, line 128 def before(identifier, &block) Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block) end
@see Chef::Sugar::IP#best_ip_for
# File lib/chef/sugar/ip.rb, line 45 def best_ip_for(other); Chef::Sugar::IP.best_ip_for(node, other); end
This wrapper/convenience method is only available in the recipe DSL
. It creates a new version object from the {Chef::VERSION}.
@example Check if Chef
11+
chef_version.satisfies?('>= 11.0.0')
@return [Chef::Sugar::Constraints::Version]
a version object, wrapping the current {Chef::VERSION}
# File lib/chef/sugar/constraints_dsl.rb, line 78 def chef_version version(Chef::VERSION) end
@see Chef::Sugar::Cloud#cloud?
# File lib/chef/sugar/cloud.rb, line 158 def cloud?; Chef::Sugar::Cloud.cloud?(node); end
@see Chef::Sugar::Cloud#cloudstack?
# File lib/chef/sugar/cloud.rb, line 180 def cloudstack?; Chef::Sugar::Cloud.cloudstack?(node); end
@see Chef::Sugar::Constraints#constraint
# File lib/chef/sugar/constraints_dsl.rb, line 64 def constraint(*constraints) Chef::Sugar::Constraints.constraint(*constraints) end
@see Chef::Sugar::DataBag#data_bag_item_for_environment
# File lib/chef/sugar/data_bag.rb, line 141 def data_bag_item_for_environment(bag, id) Chef::Sugar::DataBag.data_bag_item_for_environment(node, bag, id) end
@see Chef::Sugar::Shell#dev_null
# File lib/chef/sugar/shell.rb, line 135 def dev_null; Chef::Sugar::Shell.dev_null(node); end
@see Chef::Sugar::Cloud#digitalocean?
# File lib/chef/sugar/cloud.rb, line 186 def digitalocean?; Chef::Sugar::Cloud.digitalocean?(node); end
@see Chef::Sugar::Docker#docker?
# File lib/chef/sugar/docker.rb, line 41 def docker?; Chef::Sugar::Docker.docker?(node); end
# File lib/chef/sugar/cloud.rb, line 161 def ec2?; Chef::Sugar::Cloud.ec2?(node); end
@see Chef::Sugar::DataBag#encrypted_data_bag_item
# File lib/chef/sugar/data_bag.rb, line 131 def encrypted_data_bag_item(bag, id, secret = nil) Chef::Sugar::DataBag.encrypted_data_bag_item(bag, id, secret) end
@see Chef::Sugar::DataBag#encrypted_data_bag_item_for_environment
# File lib/chef/sugar/data_bag.rb, line 136 def encrypted_data_bag_item_for_environment(bag, id, secret = nil) Chef::Sugar::DataBag.encrypted_data_bag_item_for_environment(node, bag, id, secret) end
@see Chef::Sugar::Cloud#eucalyptus?
# File lib/chef/sugar/cloud.rb, line 170 def eucalyptus?; Chef::Sugar::Cloud.eucalyptus?(node); end
# File lib/chef/sugar/cloud.rb, line 164 def gce?; Chef::Sugar::Cloud.gce?(node); end
@see Chef::Sugar::Architecture#intel?
# File lib/chef/sugar/architecture.rb, line 147 def i386?; Chef::Sugar::Architecture.i386?(node); end
@see Chef::Sugar::IP#best_ip_for
# File lib/chef/sugar/run_context.rb, line 35 def includes_recipe?(recipe_name) Chef::Sugar::RunContext.includes_recipe?(node, recipe_name) end
@see Chef::Sugar::Shell#installed?
# File lib/chef/sugar/shell.rb, line 138 def installed?(cmd); Chef::Sugar::Shell.installed?(cmd); end
@see Chef::Sugar::Shell#installed_at_version?
# File lib/chef/sugar/shell.rb, line 141 def installed_at_version?(cmd, version, flag = '--version') Chef::Sugar::Shell.installed_at_version?(cmd, version, flag) end
@see Chef::Sugar::Architecture#intel?
# File lib/chef/sugar/architecture.rb, line 150 def intel?; Chef::Sugar::Architecture.intel?(node); end
@see Chef::Sugar::Kitchen#kitchen?
# File lib/chef/sugar/kitchen.rb, line 41 def kitchen?; Chef::Sugar::Kitchen.kitchen?(node); end
@see Chef::Sugar::Virtualization#kvm?
# File lib/chef/sugar/virtualization.rb, line 111 def kvm? Chef::Sugar::Virtualization.kvm?(node) end
@see Chef::Sugar::Cloud#linode?
# File lib/chef/sugar/cloud.rb, line 174 def linode?; Chef::Sugar::Cloud.linode?(node); end
@see Chef::Sugar::Virtualization#lxc?
# File lib/chef/sugar/virtualization.rb, line 116 def lxc? Chef::Sugar::Virtualization.lxc?(node) end
@see Chef::Sugar::Cloud#openstack?
# File lib/chef/sugar/cloud.rb, line 177 def openstack?; Chef::Sugar::Cloud.openstack?(node); end
@see Chef::Sugar::Virtualization#openvz?
# File lib/chef/sugar/virtualization.rb, line 136 def openvz? Chef::Sugar::Virtualization.openvz?(node) end
@see Chef::Sugar::Virtualization#parallels?
# File lib/chef/sugar/virtualization.rb, line 121 def parallels? Chef::Sugar::Virtualization.parallels?(node) end
@see Chef::Sugar::Virtualization#physical?
# File lib/chef/sugar/virtualization.rb, line 146 def physical? Chef::Sugar::Virtualization.physical?(node) end
@see Chef::Sugar::Architecture#powerpc?
# File lib/chef/sugar/architecture.rb, line 162 def powerpc?; Chef::Sugar::Architecture.powerpc?(node); end
@see Chef::Sugar::Architecture#ppc64?
# File lib/chef/sugar/architecture.rb, line 156 def ppc64?; Chef::Sugar::Architecture.ppc64?(node); end
@see Chef::Sugar::Architecture#ppc64le?
# File lib/chef/sugar/architecture.rb, line 159 def ppc64le?; Chef::Sugar::Architecture.ppc64le?(node); end
@see Chef::Sugar::Cloud#rackspace?
# File lib/chef/sugar/cloud.rb, line 167 def rackspace?; Chef::Sugar::Cloud.rackspace?(node); end
@see Chef::Sugar::Ruby#ruby_19?
# File lib/chef/sugar/ruby.rb, line 48 def ruby_19?; Chef::Sugar::Ruby.ruby_19?(node); end
@see Chef::Sugar::Ruby#ruby_20?
# File lib/chef/sugar/ruby.rb, line 45 def ruby_20?; Chef::Sugar::Ruby.ruby_20?(node); end
# File lib/chef/sugar/init.rb, line 58 def runit?; Chef::Sugar::Init.runit?(node); end
@see Chef::Sugar::Architecture#s390x?
# File lib/chef/sugar/architecture.rb, line 171 def s390x?; Chef::Sugar::Architecture.s390x?(node); end
@see Chef::Sugar::Cloud#softlayer?
# File lib/chef/sugar/cloud.rb, line 189 def softlayer?; Chef::Sugar::Cloud.softlayer?(node); end
@see Chef::Sugar::Architecture#sparc?
# File lib/chef/sugar/architecture.rb, line 153 def sparc?; Chef::Sugar::Architecture.sparc?(node); end
@see Chef::Sugar::Shell#sugar_which
# File lib/chef/sugar/shell.rb, line 132 def sugar_which(cmd); Chef::Sugar::Shell.sugar_which(cmd); end
@see Chef::Sugar::Init#systemd?
# File lib/chef/sugar/init.rb, line 52 def systemd?; Chef::Sugar::Init.systemd?(node); end
@see Chef::Sugar::Init#upstart?
# File lib/chef/sugar/init.rb, line 55 def upstart?; Chef::Sugar::Init.upstart?(node); end
@see Chef::Sugar::Vagrant#vagrant?
# File lib/chef/sugar/vagrant.rb, line 74 def vagrant?; Chef::Sugar::Vagrant.vagrant?(node); end
@see Chef::Sugar::Constraints#version
# File lib/chef/sugar/constraints_dsl.rb, line 59 def version(version) Chef::Sugar::Constraints::Version.new(version) end
@see Chef::Sugar::Shell#version_for
# File lib/chef/sugar/shell.rb, line 146 def version_for(cmd, flag = '--version') Chef::Sugar::Shell.version_for(cmd, flag) end
@see Chef::Sugar::Virtualization#virtual?
# File lib/chef/sugar/virtualization.rb, line 141 def virtual? Chef::Sugar::Virtualization.virtual?(node) end
@see Chef::Sugar::Virtualization#virtualbox?
# File lib/chef/sugar/virtualization.rb, line 126 def virtualbox? Chef::Sugar::Virtualization.virtualbox?(node) end
@see Chef::Sugar::Virtualization#vmware?
# File lib/chef/sugar/virtualization.rb, line 131 def vmware? Chef::Sugar::Virtualization.vmware?(node) end