Commit bb5ec1b7 authored by Tim Smith's avatar Tim Smith
Browse files

Resolve several cookstyle warnings


Signed-off-by: default avatarTim Smith <tsmith@chef.io>
parent 0c0a46ab
......@@ -20,7 +20,7 @@ class Chef
template.source 'policy-rc.d.erb'
template.path '/usr/sbin/policy-rc.d'
template.mode 0755
template.only_if{ node.platform_family?('debian') }
template.only_if { node.platform_family?('debian') }
template.run_action(:create)
# Force this to the front of the line
end
......
......@@ -3,27 +3,28 @@ require 'chef/resource'
class Chef
class Resource
class DpkgAutostart < Chef::Resource
allowed_actions [:nothing, :create]
def initialize(name, run_context=nil)
resource_name :dpkg_autostart
default_action :nothing
def initialize(name, run_context = nil)
super
@resource_name = :dpkg_autostart
@provider = Chef::Provider::DpkgAutostart
@action = :nothing
@allowed_actions = [:nothing, :create]
end
def allow(val)
node.run_state[:dpkg_autostart_disabled] ||= []
node.run_state[:dpkg_autostart_disabled].push(name) unless val
chef_version = Gem::Version.new(Chef::VERSION)
context = chef_version < Gem::Version.new('11.0.0') ? run_context : node.run_context
context = node.run_context
begin
context.resource_collection.lookup('dpkg_autostart[bin_file]')
true
rescue Chef::Exceptions::ResourceNotFound
bin = Chef::Resource::DpkgAutostart.new('bin_file', context)
bin.action :create
if(context.resource_collection.respond_to?(:insert))
if context.resource_collection.respond_to?(:insert)
context.resource_collection.insert(bin)
else
context.resource_collection.push(bin)
......
......@@ -3,4 +3,4 @@ version '0.2.0'
maintainer 'Chris Roberts'
maintainer_email 'chrisroberts.code@gmail.com'
description 'Control service actions initialized from dpkg'
license 'Apache 2.0'
license 'Apache-2.0'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment