diff --git a/CHANGELOG.md b/CHANGELOG.md index d1f72545..1980addc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -509,4 +509,4 @@ -\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* \ No newline at end of file +\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)* diff --git a/README.md b/README.md index a525d3cf..390325ae 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,8 @@ new versions of consul. Pin to the version that works for your setup! | Consul Version | Recommended Puppet Module Version | | ---------------- | ----------------------------------- | -| >= 0.8.0 | latest | +| >= 0.9.0 | latest | +| 0.8.x | <= 3.2.4 | | 0.7.0 | <= 2.1.1 | | 0.6.0 | <= 2.1.1 | | 0.5.x | 1.0.3 | @@ -73,7 +74,7 @@ class { '::consul': ## Web UI -To install and run the Web UI on the server, include `ui_dir` in the +To install and run the Web UI on the server, include `ui => true` in the `config_hash`. You may also want to change the `client_addr` to `0.0.0.0` from the default `127.0.0.1`, for example: ```puppet @@ -86,7 +87,7 @@ class { '::consul': 'log_level' => 'INFO', 'node_name' => 'server', 'server' => true, - 'ui_dir' => '/opt/consul/ui', + 'ui' => true, } } ``` diff --git a/manifests/init.pp b/manifests/init.pp index fa451597..be701646 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -110,21 +110,6 @@ # [*services*] # Hash of consul::service resources to create. # -# [*ui_download_extension*] -# The extension of the archive file containing the consul ui to download. -# -# [*ui_download_url*] -# Fully qualified url to the location of the archive file containing the consul ui. -# -# [*ui_download_url_base*] -# Base url to the location of the archive file containing the consul ui. -# -# [*ui_package_ensure*] -# Only valid when the install_method == package. Defaults to `latest`. -# -# [*ui_package_name*] -# Only valid when the install_method == package. Defaults to `consul_ui`. -# # [*user*] # Name of the user that should own the consul configuration files. # @@ -183,11 +168,6 @@ Boolean $service_enable = $consul::params::service_enable, Enum['stopped', 'running'] $service_ensure = $consul::params::service_ensure, Hash $services = $consul::params::services, - $ui_download_extension = $consul::params::ui_download_extension, - Optional[Stdlib::HTTPUrl] $ui_download_url = undef, - Stdlib::HTTPUrl $ui_download_url_base = $consul::params::ui_download_url_base, - $ui_package_ensure = $consul::params::ui_package_ensure, - $ui_package_name = $consul::params::ui_package_name, $user = $consul::params::user, $version = $consul::params::version, Hash $watches = $consul::params::watches, @@ -196,7 +176,6 @@ # lint:ignore:140chars $real_download_url = pick($download_url, "${download_url_base}${version}/${package_name}_${version}_${os}_${arch}.${download_extension}") - $real_ui_download_url = pick($ui_download_url, "${ui_download_url_base}${version}/${package_name}_${version}_web_ui.${ui_download_extension}") # lint:endignore $config_hash_real = deep_merge($config_defaults, $config_hash) @@ -218,16 +197,6 @@ $data_dir = undef } - if $config_hash_real['ui_dir'] { - $ui_dir = $config_hash_real['ui_dir'] - } else { - $ui_dir = undef - } - - if ($ui_dir and ! $data_dir) { - warning('data_dir must be set to install consul web ui') - } - if ($config_hash_real['ports'] and $config_hash_real['ports']['http']) { $http_port = $config_hash_real['ports']['http'] } else { diff --git a/manifests/install.pp b/manifests/install.pp index 2c48e9fb..6485a834 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -55,34 +55,6 @@ notify => $do_notify_service, target => "${install_path}/consul-${consul::version}/consul"; } - - if ($consul::ui_dir and $consul::data_dir) { - - # The 'dist' dir was removed from the web_ui archive in Consul version 0.6.0 - if (versioncmp($consul::version, '0.6.0') < 0) { - $archive_creates = "${install_path}/consul-${consul::version}_web_ui/dist" - $ui_symlink_target = $archive_creates - } else { - $archive_creates = "${install_path}/consul-${consul::version}_web_ui/index.html" - $ui_symlink_target = "${install_path}/consul-${consul::version}_web_ui" - } - - file { "${install_path}/consul-${consul::version}_web_ui": - ensure => directory, - } - -> archive { "${install_path}/consul_web_ui-${consul::version}.zip": - ensure => present, - source => $consul::real_ui_download_url, - proxy_server => $consul::proxy_server, - extract => true, - extract_path => "${install_path}/consul-${consul::version}_web_ui", - creates => $archive_creates, - } - ->file { $consul::ui_dir: - ensure => 'symlink', - target => $ui_symlink_target, - } - } } 'package': { package { $consul::package_name: @@ -90,14 +62,6 @@ notify => $consul::notify_service } - if $consul::ui_dir { - package { $consul::ui_package_name: - ensure => $consul::ui_package_ensure, - require => Package[$consul::package_name], - notify => $consul::notify_service - } - } - if $consul::manage_user { User[$consul::user_real] -> Package[$consul::package_name] } diff --git a/manifests/params.pp b/manifests/params.pp index 95d3f3f5..2c1f4d12 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -32,10 +32,6 @@ $service_enable = true $service_ensure = 'running' $services = {} - $ui_download_extension = 'zip' - $ui_download_url_base = 'https://releases.hashicorp.com/consul/' - $ui_package_ensure = 'latest' - $ui_package_name = 'consul_ui' $user = 'consul' $version = '0.7.4' $watches = {} diff --git a/metadata.json b/metadata.json index 5d805c59..4242a237 100644 --- a/metadata.json +++ b/metadata.json @@ -1,6 +1,6 @@ { "name": "KyleAnderson-consul", - "version": "3.2.4", + "version": "3.3.0", "author": "Kyle Anderson ", "summary": "Configures Consul by Hashicorp", "license": "Apache-2.0", diff --git a/spec/acceptance/class_spec.rb b/spec/acceptance/class_spec.rb index 19dd7ab5..3e792236 100644 --- a/spec/acceptance/class_spec.rb +++ b/spec/acceptance/class_spec.rb @@ -12,12 +12,11 @@ package { 'zip': ensure => present } -> # Don't manage the service as it doesn't work well in docker class { 'consul': - version => '0.8.5', + version => '1.0.1', manage_service => false, config_hash => { 'datacenter' => 'east-aws', 'data_dir' => '/opt/consul', - 'ui_dir' => '/opt/consul/ui', 'log_level' => 'INFO', 'node_name' => 'foobar', 'server' => true, @@ -34,16 +33,12 @@ class { 'consul': it { should be_directory } end - describe file('/opt/consul/ui') do - it { should be_linked_to '/opt/consul/archives/consul-0.8.5_web_ui' } - end - describe service('consul') do it { should be_enabled } end describe command('consul version') do - its(:stdout) { should match /Consul v0\.8\.5/ } + its(:stdout) { should match /Consul v1\.0\.1/ } end end diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index e4d45c1a..60c5206e 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -108,85 +108,28 @@ it { should contain_package('consul').with(:ensure => 'latest') } end - context 'When requesting to install UI via a custom package and version' do - let(:params) {{ - :install_method => 'package', - :ui_package_ensure => 'specific_ui_release', - :ui_package_name => 'custom_consul_ui_package', - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should contain_package('custom_consul_ui_package').with(:ensure => 'specific_ui_release') } - end - context 'When requesting to not to install' do let(:params) {{ :install_method => 'none' }} it { should_not contain_package('consul') } - it { should_not contain_package('consul_ui') } it { should_not contain_staging__file('consul.zip') } - it { should_not contain_staging__file('consul_web_ui-0.7.4.zip') } end - context "When installing UI via URL by default" do + context "When installing UI" do let(:params) {{ :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', + 'ui' => true }, }} - it { should contain_archive('/dir1/archives/consul_web_ui-0.7.4.zip').with(:source => 'https://releases.hashicorp.com/consul/0.7.4/consul_0.7.4_web_ui.zip') } - it { should contain_file('/dir1/dir2').that_requires('Archive[/dir1/archives/consul_web_ui-0.7.4.zip]') } - it { should contain_file('/dir1/dir2').with(:ensure => 'symlink') } + it { should contain_file('consul config.json').with_content(/"ui":true/) } end - context "When installing UI via URL with a special version" do + context "When not installing UI" do let(:params) {{ - :version => '42', - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, + :config_hash => { }, }} - it { should contain_archive('/dir1/archives/consul_web_ui-42.zip').with(:source => 'https://releases.hashicorp.com/consul/42/consul_42_web_ui.zip') } - end - - context "When installing UI via URL when version < 0.6.0" do - let(:params) {{ - 'version' => '0.5.99', - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should contain_archive('/dir1/archives/consul_web_ui-0.5.99.zip').with(:creates => %r{/dist$}) } - it { should contain_file('/dir1/dir2').with(:target => %r{/dist$}) } - end - - context "When installing UI via URL when version >= 0.6.0" do - let(:params) {{ - 'version' => '0.6.0', - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should contain_archive('/dir1/archives/consul_web_ui-0.6.0.zip').with(:creates => %r{/index\.html$}) } - it { should contain_file('/dir1/dir2').with(:target => %r{_web_ui$}) } - end - - context "When installing UI via URL by with a custom url" do - let(:params) {{ - :ui_download_url => 'http://myurl', - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should contain_archive('/dir1/archives/consul_web_ui-0.7.4.zip').with(:source => 'http://myurl') } + it { should_not contain_file('consul config.json').with_content(/"ui":true/) } end context "By default, a user and group should be installed" do @@ -209,26 +152,6 @@ it { should contain_file('/opt/consul/archives').with(:ensure => :directory) } end - context "When ui_dir is provided but not data_dir" do - let(:params) {{ - :config_hash => { - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should_not contain_file('/dir1/dir2') } - end - - context "When ui_dir and data_dir is provided" do - let(:params) {{ - :config_hash => { - 'data_dir' => '/dir1', - 'ui_dir' => '/dir1/dir2', - }, - }} - it { should contain_file('/dir1') } - it { should contain_file('/dir1/dir2') } - end - context 'The bootstrap_expect in config_hash is an int' do let(:params) {{ :config_hash =>