Skip to content

Commit

Permalink
Merge pull request #5 from hw-cookbooks/cookstyle_bot/cookstyle_6_17_5
Browse files Browse the repository at this point in the history
Signed-off-by: Tim Smith <[email protected]>
  • Loading branch information
tas50 authored Sep 12, 2020
2 parents 95d1181 + 87f550b commit e903791
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 64 deletions.
16 changes: 8 additions & 8 deletions Berksfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
cookbook "apt"
cookbook "yum"
cookbook "git"
cookbook "build-essential"
cookbook "python"
cookbook "runit"
cookbook "statsite", :path => "."
cookbook 'apt'
cookbook 'yum'
cookbook 'git'
cookbook 'build-essential'
cookbook 'python'
cookbook 'runit'
cookbook 'statsite', path: '.'

group :test do
cookbook "graphite"
cookbook 'graphite'
end
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
source 'https://rubygems.org'

group :test do
gem "test-kitchen", "~> 1.0.0.alpha.0"
gem "kitchen-vagrant", "~> 0.6.0"
gem "berkshelf", :github => "RiotGames/berkshelf"
gem 'test-kitchen', '~> 1.0.0.alpha.0'
gem 'kitchen-vagrant', '~> 0.6.0'
gem 'berkshelf', github: 'RiotGames/berkshelf'
end

group :lxc do
gem "kitchen-lxc", :git => "git://github.com/portertech/kitchen-lxc"
gem 'kitchen-lxc', git: 'git://github.com/portertech/kitchen-lxc'
end
18 changes: 9 additions & 9 deletions attributes/default.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
default[:statsite][:path] = "/opt/statsite"
default[:statsite][:repo] = "git://github.com/armon/statsite.git"
default[:statsite][:ref] = "HEAD"
default[:statsite][:conf] = "/etc/statsite.conf"
default[:statsite][:owner] = "statsite"
default[:statsite][:group] = "statsite"
default[:statsite][:path] = '/opt/statsite'
default[:statsite][:repo] = 'git://github.com/armon/statsite.git'
default[:statsite][:ref] = 'HEAD'
default[:statsite][:conf] = '/etc/statsite.conf'
default[:statsite][:owner] = 'statsite'
default[:statsite][:group] = 'statsite'
default[:statsite][:port] = 8125
default[:statsite][:loglevel] = "INFO"
default[:statsite][:loglevel] = 'INFO'
default[:statsite][:flush_interval] = 10
default[:statsite][:timer_eps] = 0.01
default[:statsite][:stream_command] = ""
default[:statsite][:stream_command] = ''

default[:statsite][:service_type] = "runit"
default[:statsite][:service_type] = 'runit'
20 changes: 9 additions & 11 deletions metadata.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
maintainer "Heavy Water Ops, Inc"
maintainer_email "[email protected]"
license "Apache 2.0"
description "Installs/Configures statsite"
long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
name "statsite"
version "0.0.3"
maintainer 'Heavy Water Ops, Inc'
maintainer_email '[email protected]'
license 'Apache-2.0'
description 'Installs/Configures statsite'
name 'statsite'
version '0.0.3'

depends "git"
depends "build-essential"
depends "python"
depends "runit"
depends 'git'
depends 'python'
depends 'runit'
64 changes: 32 additions & 32 deletions recipes/default.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#
# Cookbook Name:: statsite
# Cookbook:: statsite
# Recipe:: default
#
# Copyright 2013, Heavy Water Ops, Inc
# Copyright:: 2013, Heavy Water Ops, Inc
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,73 +17,73 @@
# limitations under the License.
#

#checkout
include_recipe "git"
# checkout
include_recipe 'git'

git node[:statsite][:path] do
repository node[:statsite][:repo]
reference node[:statsite][:ref]
git node['statsite']['path'] do
repository node['statsite']['repo']
reference node['statsite']['ref']
action :sync
not_if { ::FileTest.directory?("#{node[:statsite][:path]}/.git") }
not_if { ::FileTest.directory?("#{node['statsite']['path']}/.git") }
end

# build
include_recipe "build-essential"
include_recipe "python"
build_essential 'install compilation tools'
include_recipe 'python'

package "scons"
package 'scons'

execute "scons" do
cwd node[:statsite][:path]
execute 'scons' do
cwd node['statsite']['path']
action :run
creates "statsite"
creates 'statsite'
end

# configure
group node[:statsite][:group] do
group node['statsite']['group'] do
system true
action :create
end

user node[:statsite][:owner] do
user node['statsite']['owner'] do
system true
group node[:statsite][:group]
group node['statsite']['group']
end

# service
service_type = node[:statsite][:service_type]
service_type = node['statsite']['service_type']

case service_type
when 'upstart'
service_resource = 'service[statsite]'

template "/etc/init/statsite.conf" do
source "upstart.statsite.erb"
mode "0644"
template '/etc/init/statsite.conf' do
source 'upstart.statsite.erb'
mode '0644'
variables(
:conf => node[:statsite][:conf],
:path => node[:statsite][:path],
:user => node[:statsite][:owner],
:group => node[:statsite][:group]
conf: node['statsite']['conf'],
path: node['statsite']['path'],
user: node['statsite']['owner'],
group: node['statsite']['group']
)
end

service "statsite" do
service 'statsite' do
provider Chef::Provider::Service::Upstart
supports :restart => true, :status => true
supports restart: true, status: true
action [:enable, :start]
end
else
service_resource = 'runit_service[statsite]'

include_recipe "runit"
runit_service "statsite"
include_recipe 'runit'
runit_service 'statsite'
end

# template
template node[:statsite][:conf] do
owner node[:statsite][:owner]
notifies :restart, "service[statsite]", :delayed
template node['statsite']['conf'] do
owner node['statsite']['owner']
notifies :restart, 'service[statsite]', :delayed
end


Expand Down

0 comments on commit e903791

Please sign in to comment.