Skip to content

Commit

Permalink
Merge pull request #62 from bastelfreak/restore_archlinux_support
Browse files Browse the repository at this point in the history
Restore archlinux support
  • Loading branch information
dgolja authored Mar 20, 2017
2 parents 24599ba + 86784d6 commit 33c9f50
Show file tree
Hide file tree
Showing 17 changed files with 710 additions and 271 deletions.
524 changes: 524 additions & 0 deletions .rubocop.yml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,7 @@ matrix:
env: PUPPET_GEM_VERSION="~> 3.8.1"
- rvm: 2.1.6
env: PUPPET_VERSION="~> 4.0.0"
- rvm: 2.3.3
env: PUPPET_VERSION="~> 4.0" CHECK=rubocop
notifications:
email: [email protected]
24 changes: 13 additions & 11 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ else
end

group :development, :test do
gem 'rake', require: false
gem 'rspec', require: false
gem 'rspec-puppet', require: false
gem 'puppetlabs_spec_helper', require: false
gem 'puppet-lint', require: false
gem 'simplecov', require: false
gem 'puppet_facts', require: false
gem 'json_pure', '~> 1.8', require: false
gem 'json', require: false
gem 'metadata-json-lint', require: false
gem 'rspec-puppet-facts', require: false
gem 'rake', require: false
gem 'rspec', require: false
gem 'rspec-puppet', require: false
gem 'puppetlabs_spec_helper', require: false
gem 'puppet-lint', require: false
gem 'simplecov', require: false
gem 'puppet_facts', require: false
gem 'json_pure', '~> 1.8', require: false
gem 'json', require: false
gem 'metadata-json-lint', require: false
gem 'rspec-puppet-facts', require: false
gem 'rubocop', '~> 0.47.0', require: false if RUBY_VERSION >= '2.3.0'
gem 'rubocop-rspec', '~> 1.10.0', require: false if RUBY_VERSION >= '2.3.0'
end

group :system_tests do
Expand Down
6 changes: 1 addition & 5 deletions lib/facter/influxdb_version.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
#

Facter.add(:influxdb_version) do

setcode do

if Facter::Util::Resolution.which('influx')

# InfluxDB shell version: 1.1.1
version_stdout = Facter::Util::Resolution.exec('influx --version')
match = version_stdout.match(/[0-9]+\.[0-9]+\.[0-9]+/)
match = version_stdout.match(%r{[0-9]+\.[0-9]+\.[0-9]+})

match ? match[0] : nil
end

end

end
21 changes: 7 additions & 14 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

$config_file = '/etc/influxdb/influxdb.conf'

$manage_repos = false

$influxdb_stderr_log = '/var/log/influxdb/influxd.log'
$influxdb_stdout_log = '/var/log/influxdb/influxd.log'
$influxd_opts = undef
Expand Down Expand Up @@ -176,29 +174,24 @@
$hinted_handoff_config = {}

case $::osfamily {

'Debian': {

$startup_conf = '/etc/default/influxdb'

$startup_conf = '/etc/default/influxdb'
$manage_repos = false
}

'RedHat': {

$startup_conf = $::operatingsystemmajrelease ? {
/7/ => '/etc/default/influxdb',
default => '/etc/sysconfig/influxdb'
}

$manage_repos = false
}
'Archlinux': {
$startup_conf = '/etc/default/influxdb'
$manage_repos = false
}

default: {

fail("Unsupported managed repository for osfamily: ${::osfamily}, operatingsystem: ${::operatingsystem},\
module ${module_name} currently only supports managing repos for osfamily RedHat, Debian and Archlinux")
}

}

}
7 changes: 3 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@
"12.04",
"14.04"
]
},
{
"operatingsystem": "Archlinux"
}
],
"requirements": [
{
"name": "pe",
"version_requirement": ">= 3.0.0 < 2015.4.0"
},
{
"name": "puppet",
"version_requirement": ">= 3.0.0 < 5.0.0"
Expand Down
21 changes: 9 additions & 12 deletions spec/acceptance/class_spec.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
require 'spec_helper_acceptance'

describe 'influxdb class', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do

describe 'influxdb class', unless: UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
context 'default parameters' do

pp = <<-EOS
class { 'influxdb':
Expand All @@ -12,32 +10,31 @@ class { 'influxdb':
EOS

it 'should work with no errors' do
it 'works with no errors' do
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, catch_failures: true)
# wait because influxdb takes few seconds to start
shell("/bin/sleep 10")
shell('/bin/sleep 10')
end

describe package('influxdb') do
it { is_expected.to be_installed }
end

describe port('8086') do
it { should be_listening }
it { is_expected.to be_listening }
end

describe process("influxd") do
its(:user) { should eq "influxdb" }
describe process('influxd') do
its(:user) { is_expected.to eq 'influxdb' }
end

describe command("/usr/bin/test_facter.sh influxdb_version") do
describe command('/usr/bin/test_facter.sh influxdb_version') do
its(:stdout) { is_expected.to eq "1.2.0\n" }
end

describe port('8089') do
it { should_not be_listening }
it { is_expected.not_to be_listening }
end
end

end
Loading

0 comments on commit 33c9f50

Please sign in to comment.