forked from adamkrone/chef-consul-template
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: use the archive_file resource - Chef 15+
- deprecate the tar_archive resource for archive_file, this requires Chef 15+ - remove the tar cookbook dependency
- Loading branch information
1 parent
0929dfe
commit fc75e85
Showing
11 changed files
with
117 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,11 +5,9 @@ | |
maintainer_email '[email protected]' | ||
license 'Apache-2.0' | ||
description 'Installs/Configures consul-template. This is a fork of the consul-template cookbook which fixes some errors and removes support for Windows.' | ||
version '1.0.0' | ||
chef_version '>= 14.10' | ||
version '1.1.0' | ||
chef_version '>= 15.0.293' | ||
|
||
supports 'ubuntu', '>= 18.04' | ||
supports 'debian', '>= 9.8' | ||
supports 'centos', '>= 7.6' | ||
|
||
depends 'tar', '~> 2.2.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,6 @@ | |
c.formatter = :documentation | ||
# log level | ||
c.log_level = :error | ||
c.platform = 'centos' | ||
c.version = '7.8.2003' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,57 @@ | ||
require 'spec_helper' | ||
|
||
describe 'consul-template::default' do | ||
let(:chef_run) do | ||
ChefSpec::ServerRunner.new(platform: 'centos', version: '7.6').converge('consul-template-cookbook::default') | ||
end | ||
let(:consul_template_tgz) { "consul-template_#{chef_run.node['consul_template']['version']}_linux_amd64" } | ||
|
||
# Installation | ||
it 'symlinks to /usr/local/bin/consul-template' do | ||
expect(chef_run).to create_link('/usr/local/bin/consul-template') | ||
end | ||
|
||
# Service | ||
it 'should create the consul-template config directory' do | ||
expect(chef_run).to create_directory('/etc/consul-template.d') | ||
end | ||
|
||
it 'should create the consul-template default config' do | ||
expect(chef_run).to create_file('/etc/consul-template.d/default.json') | ||
end | ||
|
||
it 'should enable the consul-template service' do | ||
expect(chef_run).to enable_service('consul-template') | ||
end | ||
|
||
it 'should start the consul-template service' do | ||
expect(chef_run).to start_service('consul-template') | ||
end | ||
|
||
it 'should create the consul-template service user' do | ||
expect(chef_run).to create_poise_service_user('consul-template') | ||
end | ||
|
||
it 'should enable the consul-template service' do | ||
expect(chef_run).to enable_service('consul-template') | ||
end | ||
|
||
it 'should start the consul-template service' do | ||
expect(chef_run).to start_service('consul-template') | ||
context 'default' do | ||
let(:chef_run) do | ||
ChefSpec::ServerRunner.new.converge('consul-template-cookbook::default') | ||
end | ||
|
||
# Installation | ||
it 'symlinks to /usr/local/bin/consul-template' do | ||
expect(chef_run).to create_link('/usr/local/bin/consul-template') | ||
end | ||
|
||
# Service | ||
it 'should create the consul-template config directory' do | ||
expect(chef_run).to create_directory('/etc/consul-template.d') | ||
end | ||
|
||
it 'should create the consul-template systemd unit' do | ||
expect(chef_run).to create_systemd_unit('consul-template.service') | ||
end | ||
|
||
it 'should start the consul-template service' do | ||
expect(chef_run).to start_service('consul-template') | ||
end | ||
|
||
it 'should create the consul-template service user' do | ||
expect(chef_run).to create_user('consul-template') | ||
expect(chef_run).to create_group('consul-template') | ||
end | ||
|
||
it 'should enable the consul-template service' do | ||
expect(chef_run).to enable_systemd_unit('consul-template.service') | ||
end | ||
end | ||
|
||
context 'additional settings' do | ||
let(:chef_run) do | ||
ChefSpec::ServerRunner.new do |node, _server| | ||
node.override['consul_template']['service_execstartpre'] = '/usr/local/bin/wrapper.sh' | ||
node.override['consul_template']['vault_addr'] = 'https://my.vault.server:8200' | ||
end.converge('consul-template-cookbook::default') | ||
end | ||
|
||
it 'should create the consul-template systemd unit with additional settings' do | ||
expect(chef_run).to create_systemd_unit('consul-template.service').with_content( | ||
%r{ExecStartPre=/usr/local/bin/wrapper.sh} | ||
) | ||
expect(chef_run).to create_systemd_unit('consul-template.service').with_content( | ||
/User=consul-template/ | ||
) | ||
expect(chef_run).to create_systemd_unit('consul-template.service').with_content( | ||
%r{ExecStart=/usr/local/bin/consul-template -config /etc/consul-template.d -consul-addr 127.0.0.1:8500 -vault-addr https://my.vault.server:8200 -log-level warn} | ||
) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters