From 806e9f2850f03287bce058620813bdfaa00e1098 Mon Sep 17 00:00:00 2001 From: Nathan Williams Date: Thu, 25 Jun 2015 17:01:29 -0700 Subject: [PATCH 1/2] set default resource actions --- libraries/resource_configure.rb | 1 + libraries/resource_install.rb | 3 +++ libraries/resource_plugin.rb | 1 + libraries/resource_service.rb | 1 + libraries/resource_user.rb | 1 + 5 files changed, 7 insertions(+) diff --git a/libraries/resource_configure.rb b/libraries/resource_configure.rb index 6fff0d672..fe20c1cad 100644 --- a/libraries/resource_configure.rb +++ b/libraries/resource_configure.rb @@ -8,6 +8,7 @@ class Resource::ElasticsearchConfigure < Resource include Poise actions(:manage, :remove) + default_action :manage attribute(:dir, kind_of: String, default: "/usr/local") diff --git a/libraries/resource_install.rb b/libraries/resource_install.rb index 6b71bcf61..30e59d6a2 100644 --- a/libraries/resource_install.rb +++ b/libraries/resource_install.rb @@ -7,6 +7,9 @@ class Resource::ElasticsearchInstall < Resource provides :elasticsearch_install actions(:install, :remove) + default_action :install + + attribute(:type, kind_of: Symbol, :equal_to => [:source, :package], default: :source) attribute(:version, kind_of: String, default: '1.5.0') diff --git a/libraries/resource_plugin.rb b/libraries/resource_plugin.rb index 462c8e5e1..7a1c5164f 100644 --- a/libraries/resource_plugin.rb +++ b/libraries/resource_plugin.rb @@ -6,6 +6,7 @@ class Resource::ElasticsearchPlugin < Resource include ElasticsearchCookbook::Helpers actions(:install, :remove) + default_action :install # /usr/local/awesome/elasticsearch-version/plugins or packaged location attribute(:plugin_dir, kind_of: String) diff --git a/libraries/resource_service.rb b/libraries/resource_service.rb index f0a1f4e26..57332db66 100644 --- a/libraries/resource_service.rb +++ b/libraries/resource_service.rb @@ -6,6 +6,7 @@ class Resource::ElasticsearchService < Resource include Poise actions(:configure, :remove) + default_action :configure attribute(:service_name, kind_of: String, :name_attribute => true) attribute(:node_name, kind_of: String, default: lazy { node.name } ) diff --git a/libraries/resource_user.rb b/libraries/resource_user.rb index 2be9953fa..484d27c40 100644 --- a/libraries/resource_user.rb +++ b/libraries/resource_user.rb @@ -6,6 +6,7 @@ class Resource::ElasticsearchUser < Resource include Poise actions(:create, :remove) + default_action :create attribute(:username, kind_of: String, default: lazy { name }) # default to resource name attribute(:uid, kind_of: Integer) From 34fe1c17e2b88572da9016c469876b969c9c710e Mon Sep 17 00:00:00 2001 From: Nathan Williams Date: Thu, 25 Jun 2015 17:04:03 -0700 Subject: [PATCH 2/2] fix extra whitespace --- libraries/resource_install.rb | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/resource_install.rb b/libraries/resource_install.rb index 30e59d6a2..eff3b0f97 100644 --- a/libraries/resource_install.rb +++ b/libraries/resource_install.rb @@ -9,7 +9,6 @@ class Resource::ElasticsearchInstall < Resource actions(:install, :remove) default_action :install - attribute(:type, kind_of: Symbol, :equal_to => [:source, :package], default: :source) attribute(:version, kind_of: String, default: '1.5.0')