Class: PoiseApplication::Resources::Application::Resource
- Inherits:
-
Chef::Resource
- Object
- Chef::Resource
- PoiseApplication::Resources::Application::Resource
- Defined in:
- lib/poise_application/resources/application.rb
Overview
An ‘application` resource to manage application deployment.
Instance Attribute Summary collapse
-
#action_on_update ⇒ String, ...
Action to run when any subresource is updated.
-
#action_on_update_immediately ⇒ Boolean
Run the #action_on_update notification with ‘:immediately`.
-
#environment ⇒ Hash<String, String>
Environment variables to set for the whole application.
-
#group ⇒ String
System group that will own the application.
-
#owner ⇒ String
System user that will own the application.
-
#path ⇒ String
Application base path.
Instance Method Summary collapse
-
#app_state ⇒ Mash
Application-specific state values used as a way to communicate between subresources.
-
#initialize(*args) ⇒ Resource
constructor
private
Run the DSL rewire when the resource object is created.
-
#register_subresource(resource) ⇒ Object
private
Override Container#register_subresource to add our action_on_update.
Constructor Details
#initialize(*args) ⇒ Resource
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the DSL rewire when the resource object is created.
78 79 80 81 |
# File 'lib/poise_application/resources/application.rb', line 78 def initialize(*args) super _rewire_dsl! if node end |
Instance Attribute Details
#action_on_update ⇒ String, ...
Action to run when any subresource is updated. Defaults to ‘:restart`.
70 |
# File 'lib/poise_application/resources/application.rb', line 70 attribute(:action_on_update, kind_of: [Symbol, String, NilClass, FalseClass], default: :restart) |
#action_on_update_immediately ⇒ Boolean
Run the #action_on_update notification with ‘:immediately`.
74 |
# File 'lib/poise_application/resources/application.rb', line 74 attribute(:action_on_update_immediately, equal_to: [true, false], default: false) |
#environment ⇒ Hash<String, String>
Environment variables to set for the whole application.
56 |
# File 'lib/poise_application/resources/application.rb', line 56 attribute(:environment, kind_of: Hash, default: lazy { Mash.new }) |
#group ⇒ String
System group that will own the application. This can be overriden in individual subresources.
66 |
# File 'lib/poise_application/resources/application.rb', line 66 attribute(:group, kind_of: String) |
#owner ⇒ String
System user that will own the application. This can be overriden in individual subresources.
61 |
# File 'lib/poise_application/resources/application.rb', line 61 attribute(:owner, kind_of: String) |
#path ⇒ String
Application base path.
52 |
# File 'lib/poise_application/resources/application.rb', line 52 attribute(:path, kind_of: String, name_attribute: true) |
Instance Method Details
#app_state ⇒ Mash
Application-specific state values used as a way to communicate between subresources.
89 90 91 |
# File 'lib/poise_application/resources/application.rb', line 89 def app_state @app_state ||= Mash.new(environment: environment) end |
#register_subresource(resource) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Override Container#register_subresource to add our action_on_update.
96 97 98 99 100 101 102 103 |
# File 'lib/poise_application/resources/application.rb', line 96 def register_subresource(resource) super.tap do |added| if added && action_on_update Chef::Log.debug("[#{self}] Registering #{action_on_update_immediately ? 'immediate ' : ''}#{action_on_update} notification from #{resource}") resource.notifies action_on_update.to_sym, self, (action_on_update_immediately ? :immediately : :delayed) end end end |