Module: Chef::Sugar::DSL
- Defined in:
- lib/chef/sugar/ip.rb,
lib/chef/sugar/ruby.rb,
lib/chef/sugar/cloud.rb,
lib/chef/sugar/shell.rb,
lib/chef/sugar/docker.rb,
lib/chef/sugar/filters.rb,
lib/chef/sugar/vagrant.rb,
lib/chef/sugar/data_bag.rb,
lib/chef/sugar/platform.rb,
lib/chef/sugar/constraints.rb,
lib/chef/sugar/run_context.rb,
lib/chef/sugar/architecture.rb,
lib/chef/sugar/virtualization.rb,
lib/chef/sugar/platform_family.rb
Instance Method Summary collapse
- #_32_bit? ⇒ Boolean (also: #i386?)
- #_64_bit? ⇒ Boolean
-
#after(identifier, &block) ⇒ Object
Dynamically insert resources after an existing resource in the resource_collection.
- #azure? ⇒ Boolean
-
#before(identifier, &block) ⇒ Object
Dynamically insert resources before an existing resource in the resource_collection.
- #best_ip_for(other) ⇒ Object
-
#chef_version ⇒ Chef::Sugar::Constraints::Version
This wrapper/convenience method is only available in the recipe DSL.
- #cloud? ⇒ Boolean
- #cloudstack? ⇒ Boolean
-
#compile_time(&block) ⇒ Object
Dynamically run resources specified in the block during the compilation phase, instead of the convergence phase.
- #constraint(*constraints) ⇒ Object
- #dev_null ⇒ Object
- #docker? ⇒ Boolean
- #ec2? ⇒ Boolean
- #encrypted_data_bag_item(bag, id, secret = nil) ⇒ Object
- #encrypted_data_bag_item_for_environment(bag, id, secret = nil) ⇒ Object
- #eucalyptus? ⇒ Boolean (also: #euca?)
- #gce? ⇒ Boolean
- #includes_recipe?(recipe_name) ⇒ Boolean (also: #include_recipe?)
- #installed?(cmd) ⇒ Boolean
- #installed_at_version?(cmd, version, flag = '--version') ⇒ Boolean
- #linode? ⇒ Boolean
- #lxc? ⇒ Boolean
- #openstack? ⇒ Boolean
- #rackspace? ⇒ Boolean
- #ruby_19? ⇒ Boolean
- #ruby_20? ⇒ Boolean
- #vagrant? ⇒ Boolean
- #version(version) ⇒ Object
- #version_for(cmd, flag = '--version') ⇒ Object
- #vmware? ⇒ Boolean
- #which(cmd) ⇒ Object
Instance Method Details
#_32_bit? ⇒ Boolean Also known as: i386?
50 |
# File 'lib/chef/sugar/architecture.rb', line 50 def _32_bit?; Chef::Sugar::Architecture._32_bit?(node); end |
#_64_bit? ⇒ Boolean
47 |
# File 'lib/chef/sugar/architecture.rb', line 47 def _64_bit?; Chef::Sugar::Architecture._64_bit?(node); end |
#after(identifier, &block) ⇒ Object
Dynamically insert resources after an existing resource in the resource_collection.
after 'service[apache2]' do
template '/etc/apache2/thing.conf' do
source '...'
end
end
148 149 150 |
# File 'lib/chef/sugar/filters.rb', line 148 def after(identifier, &block) Chef::Sugar::Filters::Injector.new(self, identifier, :after).evaluate(&block) end |
#azure? ⇒ Boolean
159 |
# File 'lib/chef/sugar/cloud.rb', line 159 def azure?; Chef::Sugar::Cloud.azure?(node); end |
#before(identifier, &block) ⇒ Object
Dynamically insert resources before an existing resource in the resource_collection.
before 'service[apache2]' do
template '/etc/apache2/thing.conf' do
source '...'
end
end
128 129 130 |
# File 'lib/chef/sugar/filters.rb', line 128 def before(identifier, &block) Chef::Sugar::Filters::Injector.new(self, identifier, :before).evaluate(&block) end |
#best_ip_for(other) ⇒ Object
45 |
# File 'lib/chef/sugar/ip.rb', line 45 def best_ip_for(other); Chef::Sugar::IP.best_ip_for(node, other); end |
#chef_version ⇒ Chef::Sugar::Constraints::Version
This wrapper/convenience method is only available in the recipe DSL. It creates a new version object from the VERSION.
156 157 158 |
# File 'lib/chef/sugar/constraints.rb', line 156 def chef_version version(Chef::VERSION) end |
#cloud? ⇒ Boolean
134 |
# File 'lib/chef/sugar/cloud.rb', line 134 def cloud?; Chef::Sugar::Cloud.cloud?(node); end |
#cloudstack? ⇒ Boolean
156 |
# File 'lib/chef/sugar/cloud.rb', line 156 def cloudstack?; Chef::Sugar::Cloud.cloudstack?(node); end |
#compile_time(&block) ⇒ Object
Dynamically run resources specified in the block during the compilation phase, instead of the convergence phase.
108 109 110 |
# File 'lib/chef/sugar/filters.rb', line 108 def compile_time(&block) Chef::Sugar::Filters::CompileTime.new(self).evaluate(&block) end |
#constraint(*constraints) ⇒ Object
142 143 144 |
# File 'lib/chef/sugar/constraints.rb', line 142 def constraint(*constraints) Chef::Sugar::Constraints.constraint(*constraints) end |
#dev_null ⇒ Object
131 |
# File 'lib/chef/sugar/shell.rb', line 131 def dev_null; Chef::Sugar::Shell.dev_null(node); end |
#docker? ⇒ Boolean
37 |
# File 'lib/chef/sugar/docker.rb', line 37 def docker?; Chef::Sugar::Docker.docker?(node); end |
#ec2? ⇒ Boolean
137 |
# File 'lib/chef/sugar/cloud.rb', line 137 def ec2?; Chef::Sugar::Cloud.ec2?(node); end |
#encrypted_data_bag_item(bag, id, secret = nil) ⇒ Object
98 99 100 |
# File 'lib/chef/sugar/data_bag.rb', line 98 def encrypted_data_bag_item(bag, id, secret = nil) Chef::Sugar::DataBag.encrypted_data_bag_item(bag, id, secret) end |
#encrypted_data_bag_item_for_environment(bag, id, secret = nil) ⇒ Object
103 104 105 |
# File 'lib/chef/sugar/data_bag.rb', line 103 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 |
#eucalyptus? ⇒ Boolean Also known as: euca?
146 |
# File 'lib/chef/sugar/cloud.rb', line 146 def eucalyptus?; Chef::Sugar::Cloud.eucalyptus?(node); end |
#gce? ⇒ Boolean
140 |
# File 'lib/chef/sugar/cloud.rb', line 140 def gce?; Chef::Sugar::Cloud.gce?(node); end |
#includes_recipe?(recipe_name) ⇒ Boolean Also known as: include_recipe?
35 36 37 |
# File 'lib/chef/sugar/run_context.rb', line 35 def includes_recipe?(recipe_name) Chef::Sugar::RunContext.includes_recipe?(node, recipe_name) end |
#installed?(cmd) ⇒ Boolean
134 |
# File 'lib/chef/sugar/shell.rb', line 134 def installed?(cmd); Chef::Sugar::Shell.installed?(cmd); end |
#installed_at_version?(cmd, version, flag = '--version') ⇒ Boolean
137 138 139 |
# File 'lib/chef/sugar/shell.rb', line 137 def installed_at_version?(cmd, version, flag = '--version') Chef::Sugar::Shell.installed_at_version?(cmd, version, flag) end |
#linode? ⇒ Boolean
150 |
# File 'lib/chef/sugar/cloud.rb', line 150 def linode?; Chef::Sugar::Cloud.linode?(node); end |
#lxc? ⇒ Boolean
51 |
# File 'lib/chef/sugar/virtualization.rb', line 51 def lxc?; Chef::Sugar::Virtualization.lxc?(node); end |
#openstack? ⇒ Boolean
153 |
# File 'lib/chef/sugar/cloud.rb', line 153 def openstack?; Chef::Sugar::Cloud.openstack?(node); end |
#rackspace? ⇒ Boolean
143 |
# File 'lib/chef/sugar/cloud.rb', line 143 def rackspace?; Chef::Sugar::Cloud.rackspace?(node); end |
#ruby_19? ⇒ Boolean
48 |
# File 'lib/chef/sugar/ruby.rb', line 48 def ruby_19?; Chef::Sugar::Ruby.ruby_19?(node); end |
#ruby_20? ⇒ Boolean
45 |
# File 'lib/chef/sugar/ruby.rb', line 45 def ruby_20?; Chef::Sugar::Ruby.ruby_20?(node); end |
#vagrant? ⇒ Boolean
74 |
# File 'lib/chef/sugar/vagrant.rb', line 74 def vagrant?; Chef::Sugar::Vagrant.vagrant?(node); end |
#version(version) ⇒ Object
137 138 139 |
# File 'lib/chef/sugar/constraints.rb', line 137 def version(version) Chef::Sugar::Constraints::Version.new(version) end |
#version_for(cmd, flag = '--version') ⇒ Object
142 143 144 |
# File 'lib/chef/sugar/shell.rb', line 142 def version_for(cmd, flag = '--version') Chef::Sugar::Shell.version_for(cmd, flag) end |
#vmware? ⇒ Boolean
54 |
# File 'lib/chef/sugar/virtualization.rb', line 54 def vmware?; Chef::Sugar::Virtualization.vmware?(node); end |