Skip to content

Commit

Permalink
Merge pull request #378 from tanner-bruce/fix-webui-install
Browse files Browse the repository at this point in the history
Move webui installation to poise-archive
  • Loading branch information
legal90 authored Dec 15, 2016
2 parents 03b4a60 + ee690dd commit d7b8dda
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 10 deletions.
14 changes: 14 additions & 0 deletions .kitchen.dokken.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,17 @@ suites:
provider: binary
options:
version: 0.7.1
- name: webui
provisioner:
policyfile: test/fixtures/policies/default.rb
attributes:
consul:
provider: binary
options:
version: 0.7.1
config:
bootstrap: true
server: true
ui: true
datacenter: FortMeade
encrypt: CGXC2NsXW4AvuB4h5ODYzQ==
10 changes: 6 additions & 4 deletions libraries/consul_installation_webui.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,11 @@ def action_create
recursive true
end

zipfile options[:archive_basename] do
path ::File.join(options[:extract_to], new_resource.version)
source archive_url
checksum options[:archive_checksum]
poise_archive archive_url do
destination ::File.join(options[:extract_to], new_resource.version)
source_properties(
checksum: options[:archive_checksum]
)
not_if { ::File.exist?(::File.join(path, 'index.html')) }
notifies :create, "link[#{options[:symlink_to]}]", :immediately
end
Expand Down Expand Up @@ -97,6 +98,7 @@ def self.binary_checksum(_node, resource)
when '0.6.3' then '93bbb300cacfe8de90fb3bd5ede7d37ae6ce014898edc520b9c96a676b2bbb72'
when '0.6.4' then '5f8841b51e0e3e2eb1f1dc66a47310ae42b0448e77df14c83bb49e0e0d5fa4b7'
when '0.7.0' then '42212089c228a73a0881a5835079c8df58a4f31b5060a3b4ffd4c2497abe3aa8'
when '0.7.1' then '1b793c60e1af24cc470421d0411e13748f451b51d8a6ed5fcabc8d00bfb84264'
end
end
end
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/cookbooks/consul_spec/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
include_recipe 'consul::default'
include_recipe 'consul_spec::consul_definition'
include_recipe 'consul_spec::consul_watch'
include_recipe 'consul_spec::consul_installation_webui'
13 changes: 13 additions & 0 deletions test/integration/webui/serverspec/webui_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require 'spec_helper'

consul_version = '0.7.1'

unless windows?
describe file("/opt/consul-webui/#{consul_version}/base.css") do
it { should be_file }
end

describe command('curl -X GET http://127.0.0.1:8500/ui/') do
its(:stdout) { should match /Consul by HashiCorp/ }
end
end
9 changes: 3 additions & 6 deletions test/spec/libraries/consul_installation_webui_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,23 @@
end

it do
pending('replace with poise-archive')
is_expected.to create_directory('/opt/consul-webui/0.7.1')
.with(
recursive: true
)
end

it do
pending('replace with poise-archive')
is_expected.to create_directory('/var/lib/consul')
.with(
recursive: true
)
end

it do
pending('replace with poise-archive')
is_expected.to unzip_zipfile('consul_0.7.1_web_ui.zip')
.with(
source: 'https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip'
is_expected.to unpack_poise_archive('https://releases.hashicorp.com/consul/0.7.1/consul_0.7.1_web_ui.zip').with(
destination: '/opt/consul-webui/0.7.1',
merged_source_properties: {'checksum' => '1b793c60e1af24cc470421d0411e13748f451b51d8a6ed5fcabc8d00bfb84264' }
)
end
end
Expand Down

0 comments on commit d7b8dda

Please sign in to comment.