dmg_package resource¶
Use the dmg_package resource to install a package from a .dmg file. The resource will retrieve the file from a remote URL, mount it using OS X’s hdidutil, copy the application to the specified destination (/Applications), and detach the image using hdiutil. The .dmg file will be stored in the Chef::Config[:file_cache_path].
New in Chef Client 14.0.
Syntax¶
This resource has the following syntax:
dmg_package 'name' do
accept_eula true, false # default value: 'false'
allow_untrusted true, false # default value: 'false'
app String # default value: 'name'
checksum String
destination String # default value: '/Applications'
dmg_name String
dmg_passphrase String
file String
headers Hash, nil # default value: 'nil'
notifies # see description
owner String
package_id String
source String
subscribes # see description
type String # default value: 'app'
volumes_dir String
action Symbol # defaults to :install if not specified
end
where:
dmg_packageis the resource.nameis the name given to the resource block.actionidentifies which steps the chef-client will take to bring the node into the desired state.accept_eula,allow_untrusted,app,checksum,destination,dmg_name,dmg_passphrase,file,headers,notifies,owner,package_id,source,subscribes,type, andvolumes_dirare the properties available to this resource
Actions¶
The dmg_package resource has the following actions:
:install- Default. Installs the application.
:nothing- Define this resource block to do nothing until notified by another resource to take action. When this resource is notified, this resource block is either run immediately or it is queued up to be run at the end of the Chef Client run.
Properties¶
The dmg_package resource has the following properties:
accept_eulaRuby Type: true, false | Default Value:
falseSpecify if the application’s EULA should be accepted, if applicable.
allow_untrustedRuby Type: true, false | Default Value:
falseAllow installation of packages that do not have trusted certificates.
appRuby Type: String | Default Value:
'name'The name of the application as it appears in the
/Volumesdirectory, if it differs from the resource block name.checksumRuby Type: String
The sha256 checksum of the
.dmgfile to download.destinationRuby Type: String | Default Value:
/ApplicationsThe directory to copy the
.appinto.dmg_nameRuby Type: String
The name of the
.dmgfile if it differs from that of the app, or if the name has spaces.dmg_passphraseRuby Type: String
Specify a passphrase to be used to decrypt the
.dmgfile during the mount process.fileRuby Type: String
The full path to the
.dmgfile on the local system.headersRuby Type: Hash, nil | Default Value:
nilAllows custom HTTP headers (like cookies) to be set on the
remote_fileresource.notifiesRuby Type: Symbol, ‘Chef::Resource[String]’
A resource may notify another resource to take action when its state changes. Specify a
'resource[name]', the:actionthat resource should take, and then the:timerfor that action. A resource may notify more than one resource; use anotifiesstatement for each resource to be notified.A timer specifies the point during the Chef Client run at which a notification is run. The following timers are available:
:before- Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
:delayed- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Client run.
:immediate,:immediately- Specifies that a notification should be run immediately, per resource notified.
The syntax for
notifiesis:notifies :action, 'resource[name]', :timer
ownerRuby Type: String
The system user that should own the package installation.
package_idRuby Type: String
The package ID that is registered with
pkgutilwhen apkgormpkgis installed.sourceRuby Type: String
The remote URL that is used to download the
.dmgfile, if specified.subscribesRuby Type: Symbol, ‘Chef::Resource[String]’
A resource may listen to another resource, and then take action if the state of the resource being listened to changes. Specify a
'resource[name]', the:actionto be taken, and then the:timerfor that action.Note that
subscribesdoes not apply the specified action to the resource that it listens to - for example:file '/etc/nginx/ssl/example.crt' do mode '0600' owner 'root' end service 'nginx' do subscribes :reload, 'file[/etc/nginx/ssl/example.crt]', :immediately end
In this case the
subscribesproperty reloads thenginxservice whenever its certificate file, located under/etc/nginx/ssl/example.crt, is updated.subscribesdoes not make any changes to the certificate file itself, it merely listens for a change to the file, and executes the:reloadaction for its resource (in this examplenginx) when a change is detected.A timer specifies the point during the Chef Client run at which a notification is run. The following timers are available:
:before- Specifies that the action on a notified resource should be run before processing the resource block in which the notification is located.
:delayed- Default. Specifies that a notification should be queued up, and then executed at the end of the Chef Client run.
:immediate,:immediately- Specifies that a notification should be run immediately, per resource notified.
The syntax for
subscribesis:subscribes :action, 'resource[name]', :timer
typeRuby Type: String | Default Value:
appThe type of package.
volumes_dirRuby Type: String
The directory under
/Volumeswhere the dmg is mounted, if it differs from the name of the.dmgfile.