From bc4ee9e0f1d7f8aba2355e50f46be08f205967cb Mon Sep 17 00:00:00 2001 From: Dale McDiarmid Date: Mon, 21 Mar 2016 20:16:29 +0000 Subject: [PATCH] Better error handling for plugin install and test for removal of logging.yml --- README.md | 2 +- defaults/main.yml | 3 ++- tasks/elasticsearch-plugins.yml | 3 +-- test/integration/helpers/serverspec/config_spec.rb | 4 ++++ test/integration/helpers/serverspec/multi_spec.rb | 3 +++ test/integration/helpers/serverspec/package_spec.rb | 4 ++++ test/integration/helpers/serverspec/standard_spec.rb | 4 ++++ 7 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d94ecd8..98a24d0 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Ansible role for Elasticsearch. Currently this works on Debian and RedHat based * Centos 6 * Centos 7 -The latest Elasticsearch versions of 1.7.x and 2.x are actively tested. +The latest Elasticsearch versions of 1.7.x and 2.x are actively tested. **Only Ansible versions 2.x are supported.** ## Usage diff --git a/defaults/main.yml b/defaults/main.yml index 7bf9af0..c2e4a94 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -16,4 +16,5 @@ es_pid_dir: "/var/run/elasticsearch" es_data_dirs: "/var/lib/elasticsearch" es_log_dir: "/var/log/elasticsearch" es_work_dir: "/tmp/elasticsearch" -es_plugin_dir: "/usr/share/elasticsearch/plugins" \ No newline at end of file +es_plugin_dir: "/usr/share/elasticsearch/plugins" +es_proxy_port: 8080 \ No newline at end of file diff --git a/tasks/elasticsearch-plugins.yml b/tasks/elasticsearch-plugins.yml index caa7316..1240882 100644 --- a/tasks/elasticsearch-plugins.yml +++ b/tasks/elasticsearch-plugins.yml @@ -5,7 +5,6 @@ when: elasticsearch_install.changed or es_plugins is not defined or es_plugins is none - set_fact: list_command="list" - - set_fact: list_command="--list" when: es_version | version_compare('2.0', '<') @@ -40,7 +39,7 @@ {% endif %} --silent register: plugin_installed - failed_when: "'Failed to install' in plugin_installed.stderr" + failed_when: "'ERROR' in plugin_installed.stdout" changed_when: plugin_installed.rc == 0 with_items: es_plugins when: es_plugins is defined and not es_plugins is none diff --git a/test/integration/helpers/serverspec/config_spec.rb b/test/integration/helpers/serverspec/config_spec.rb index 7eeb44c..396b9c1 100644 --- a/test/integration/helpers/serverspec/config_spec.rb +++ b/test/integration/helpers/serverspec/config_spec.rb @@ -103,6 +103,10 @@ shared_examples 'config::init' do |es_version| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + #Init vs Systemd tests #Ubuntu 15 and up #Debian 8 and up diff --git a/test/integration/helpers/serverspec/multi_spec.rb b/test/integration/helpers/serverspec/multi_spec.rb index 1042ef6..a52bf80 100644 --- a/test/integration/helpers/serverspec/multi_spec.rb +++ b/test/integration/helpers/serverspec/multi_spec.rb @@ -225,6 +225,9 @@ shared_examples 'multi::init' do |es_version,plugins| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end #Test server spec file has been created and modified - currently not possible as not copied for debian 8 diff --git a/test/integration/helpers/serverspec/package_spec.rb b/test/integration/helpers/serverspec/package_spec.rb index 1e4218e..2d2dbbb 100644 --- a/test/integration/helpers/serverspec/package_spec.rb +++ b/test/integration/helpers/serverspec/package_spec.rb @@ -103,5 +103,9 @@ shared_examples 'package::init' do |es_version,plugins| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + end diff --git a/test/integration/helpers/serverspec/standard_spec.rb b/test/integration/helpers/serverspec/standard_spec.rb index 05b8e0e..3133493 100644 --- a/test/integration/helpers/serverspec/standard_spec.rb +++ b/test/integration/helpers/serverspec/standard_spec.rb @@ -67,5 +67,9 @@ shared_examples 'standard::init' do |es_version| it { should_not exist } end + describe file('/etc/elasticsearch/logging.yml') do + it { should_not exist } + end + end