Skip to content

Commit

Permalink
Merge pull request #146 from bdangit/fix-repo-attribute
Browse files Browse the repository at this point in the history
Fix install of influxdb
  • Loading branch information
bdangit authored May 4, 2017
2 parents 3492de7 + 9df42f0 commit 61f4b61
Show file tree
Hide file tree
Showing 13 changed files with 49 additions and 39 deletions.
23 changes: 7 additions & 16 deletions .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,47 +7,39 @@ provisioner:
name: chef_zero

platforms:
<% %w(12.14 12.7 12.1).each do |chef_version| %>
<% %w(13.0 12.19).each do |chef_version| %>
- name: ubuntu-14.04-chef<%= chef_version %>
driver_config:
image: ubuntu:14.04
platform: ubuntu
require_chef_omnibus: <%= chef_version %>
provision_command:
- apt-get install net-tools -y
- name: ubuntu-15.10-chef<%= chef_version %>
- name: ubuntu-16.10-chef<%= chef_version %>
driver_config:
box: ubuntu:15.10
box: ubuntu:16.10
platform: ubuntu
run_command: /sbin/init
privileged: true
provision_command:
- apt-get install net-tools -y
provisioner:
require_chef_omnibus: <%= chef_version %>
- name: debian-8.5-chef<%= chef_version %>
- name: debian-8.7-chef<%= chef_version %>
driver_config:
box: debian:8.5
box: debian:8.7
platform: debian
run_command: /sbin/init
privileged: true
provision_command:
- apt-get install wget -y
- apt-get install net-tools -y
provisioner:
require_chef_omnibus: <%= chef_version %>
- name: centos-6.8-chef<%= chef_version %>
driver_config:
box: centos:6.8
platform: centos
provision_command:
- yum install net-tools -y
- yum install iproute -y
provisioner:
require_chef_omnibus: <%= chef_version %>
- name: centos-7.2-chef<%= chef_version %>
- name: centos-7.3-chef<%= chef_version %>
driver_config:
box: centos:7.2
box: centos:7.3
platform: centos
run_command: /usr/sbin/init
privileged: true
Expand All @@ -62,7 +54,6 @@ suites:
- name: default
run_list:
- recipe[influxdb-test::default]
- recipe[netstat]
attributes:
- name: file
run_list:
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# CHANGELOG

## 6.0.0
* [major] Removed support for 12.1 thru 12.4.
* [minor] Fix install of influxdb
- `node['influxdb']['include_repository']` was getting set to `nil` even
though custom resource `influxdb_install` set `include_repository`
default to false. To fix needed to set the node attribute to be set
properly
- fixed rubocop styling
- fixed foodcritic lints
- updated kitchen to test for Chef 13
- updated wercker profile to use latest and greatest chefdk
* [patch] Use `Generator` class instead of `dump` method for config generation [#143](../../pull/143) (contributed by @ton31337)
- *We are no longer using `toml-rb` and instead use `toml`*

## 5.2.2
* [patch] notifying influxes service after config change [#140](../../pull/140)
* [patch] notifying influxes service after config change [#140](../../pull/140)
(contributed by @nilroy)

## 5.2.1
Expand Down
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ group :integration do
end

group :test do
gem 'foodcritic'
gem 'minitest'
gem 'rubocop'
gem 'rake'
gem 'foodcritic'
gem 'rubocop'
end
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The following gems are used by the custom resources and are installed by the
`default` recipe:

- [InfluxDB gem](https://github.com/influxdb/influxdb-ruby)
- [toml-rb](https://github.com/emancu/toml-rb)
- [toml](https://github.com/jm/toml)

This cookbook ships with five custom resources for managing the configuration
file, users, databases, cluster admins, and retention policies:
Expand Down Expand Up @@ -117,7 +117,7 @@ end
### influxdb\_continuous\_query
This resources configures a continuous query on a given database.

> If you need rewrite continuous query if it already exist set `rewrite` parametr to `true`.
> If you need rewrite continuous query if it already exist set `rewrite` parametr to `true`.
```ruby
influxdb_continuous_query "test_continuous_query" do
Expand Down
2 changes: 2 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ require 'foodcritic'

task default: 'test:quick'

# rubocop:disable Metrics/BlockLength
namespace :test do
RuboCop::RakeTask.new

Expand Down Expand Up @@ -51,6 +52,7 @@ namespace :test do
Rake::Task['test:integration:vagrant'].invoke
end
end
# rubocop:enable Metrics/BlockLength

desc 'Print version of cookbook'
task :version do
Expand Down
1 change: 1 addition & 0 deletions attributes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

default['influxdb']['version'] = nil
default['influxdb']['install_type'] = 'package'
default['influxdb']['include_repository'] = true

default['influxdb']['download_urls'] = {
'debian' => 'https://dl.influxdata.com/influxdb/releases',
Expand Down
18 changes: 8 additions & 10 deletions metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@
maintainer_email '[email protected]'
license 'MIT'
description 'InfluxDB, a timeseries database'
version '5.2.2'
version '6.0.0'

supports 'centos'
supports 'debian'
supports 'redhat'
supports 'ubuntu'

# For CLI client
# https://github.com/redguide/nodejs
depends 'nodejs', '~> 2.4'
depends 'nodejs', '>= 2.4.4'

# For ChefInfluxDB Chef handler
# https://github.com/jakedavis/chef-handler-influxdb
depends 'chef_handler'

# For apt and yum repositories
depends 'apt', '>= 3.0'
depends 'yum', '>= 3.0'

# For compatibility with 12.X versions of Chef
depends 'compat_resource'

chef_version '>= 12.0' if respond_to?(:chef_version)
chef_version '>= 12.5' if respond_to?(:chef_version)
source_url 'https://github.com/bdangit/chef-influxdb' if respond_to?(:source_url)
issues_url 'https://github.com/bdangit/chef-influxdb/issues' if respond_to?(:issues_url)
2 changes: 1 addition & 1 deletion recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Installs InfluxDB

chef_gem 'toml-rb' do
chef_gem 'toml' do
compile_time false if respond_to?(:compile_time)
end

Expand Down
4 changes: 2 additions & 2 deletions resources/continuous_query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@

# rubocop:disable Metrics/AbcSize
def current_cq
@current_cq ||= (
@current_cq ||= begin
current_cq_arr = client.list_continuous_queries(database).select do |c|
c['name'] == name
end
if current_cq_arr.length > 1
Chef::Log.fatal("Unexpected number of matches for continuous query #{name} on database #{database}: #{current_policy_arr}")
end
current_cq_arr[0] if current_cq_arr.length
)
end
end
# rubocop:enable Metrics/AbcSize

Expand Down
2 changes: 2 additions & 0 deletions resources/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

include InfluxdbCookbook::Helpers

# rubocop:disable Metrics/BlockLength
action :install do
case install_type
when 'package'
Expand Down Expand Up @@ -82,6 +83,7 @@
raise "#{install_type} is not a valid install type."
end
end
# rubocop:enable Metrics/BlockLength

action :remove do
if node.platform_family? 'rhel'
Expand Down
6 changes: 3 additions & 3 deletions resources/retention_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
property :policy_name, String
property :database, String
property :duration, String, default: 'INF'
property :replication, Fixnum, default: 1
property :replication, Integer, default: 1
property :default, [TrueClass, FalseClass], default: false
property :auth_username, String, default: 'root'
property :auth_password, String, default: 'root'
Expand Down Expand Up @@ -37,15 +37,15 @@
end

def current_policy
@current_policy ||= (
@current_policy ||= begin
current_policy_arr = client.list_retention_policies(database).select do |p|
p['name'] == policy_name
end
if current_policy_arr.length > 1
Chef::Log.fatal("Unexpected number of matches for retention policy #{policy_name} on database #{database}: #{current_policy_arr}")
end
current_policy_arr[0] if current_policy_arr.length
)
end
end

# rubocop:disable Metrics/MethodLength
Expand Down
2 changes: 2 additions & 0 deletions test/integration/default/serverspec/default_spec.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
require 'spec_helper'

# rubocop:disable Metrics/BlockLength
describe 'influxdb' do
describe user('influxdb') do
it { is_expected.to exist }
Expand Down Expand Up @@ -83,3 +84,4 @@
end
end
end
# rubocop:enable Metrics/BlockLength
4 changes: 2 additions & 2 deletions wercker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build:
- install-packages:
packages: wget
- bdangit/chefdk:
version: 0.18.26
version: 1.3.43
- script:
name: lint style spec
code: |
Expand All @@ -14,7 +14,7 @@ deploy:
- install-packages:
packages: wget curl
- bdangit/chefdk:
version: 0.18.26
version: 1.3.43
- script:
name: get version from rake
code: |
Expand Down

0 comments on commit 61f4b61

Please sign in to comment.