Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
mirror
Dpkg Autostart
Commits
47688765
Commit
47688765
authored
Aug 11, 2013
by
Chris Roberts
Browse files
Add heavyweight resource/provider. Fix #2
parent
15bb4a67
Changes
2
Hide whitespace changes
Inline
Side-by-side
libraries/provider.rb
0 → 100644
View file @
47688765
require
'chef/provider'
class
Chef
class
Provider
class
DpkgAutostart
<
Chef
::
Provider
def
initialize
(
*
args
)
super
end
def
load_current_resource
end
def
action_run
Chef
::
Log
.
debug
'DpkgAutostart: Compat method. Action does nothing.'
end
def
action_create
template
=
Chef
::
Resource
::
Template
.
new
(
'dpkg_autostart_file'
,
run_context
)
template
.
cookbook
'dpkg_autostart'
template
.
source
'policy-rc.d.erb'
template
.
path
'/usr/sbin/policy-rc.d'
template
.
mode
0755
template
.
run_action
(
:create
)
# Force this to the front of the line
end
end
end
end
libraries/resource.rb
0 → 100644
View file @
47688765
require
'chef/resource'
class
Chef
class
Resource
class
DpkgAutostart
<
Chef
::
Resource
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
begin
node
.
run_context
.
resource_collection
.
lookup
(
'dpkg_autostart[bin_file]'
)
true
rescue
Chef
::
Exceptions
::
ResourceNotFound
bin
=
Chef
::
Resource
::
DpkgAutostart
.
new
(
'bin_file'
,
node
.
run_context
)
bin
.
action
:create
node
.
run_context
.
resource_collection
.
all_resources
.
unshift
(
bin
)
end
end
end
end
end
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment