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
chef
Commits
04bdf715
Commit
04bdf715
authored
Oct 03, 2012
by
Chris Roberts
Committed by
Bryan McLellan
Oct 15, 2012
Browse files
Upfactor #run_chef_client into Chef::Application
parent
d95521e1
Changes
4
Hide whitespace changes
Inline
Side-by-side
chef/lib/chef/application.rb
View file @
04bdf715
...
...
@@ -127,6 +127,18 @@ class Chef::Application
raise
Chef
::
Exceptions
::
Application
,
"
#{
self
.
to_s
}
: you must override run_application"
end
# Initializes Chef::Client instance and runs it
def
run_chef_client
@chef_client
=
Chef
::
Client
.
new
(
@chef_client_json
,
:override_runlist
=>
config
[
:override_runlist
]
)
@chef_client_json
=
nil
@chef_client
.
run
@chef_client
=
nil
end
private
def
apply_config
(
config_file_path
)
...
...
@@ -134,7 +146,6 @@ class Chef::Application
Chef
::
Config
.
merge!
(
config
)
end
class
<<
self
def
debug_stacktrace
(
e
)
message
=
"
#{
e
.
class
}
:
#{
e
}
\n
#{
e
.
backtrace
.
join
(
"
\n
"
)
}
"
...
...
chef/lib/chef/application/client.rb
View file @
04bdf715
...
...
@@ -313,18 +313,6 @@ class Chef::Application::Client < Chef::Application
private
# Initializes Chef::Client instance and runs it
def
run_chef_client
@chef_client
=
Chef
::
Client
.
new
(
@chef_client_json
,
:override_runlist
=>
config
[
:override_runlist
]
)
@chef_client_json
=
nil
@chef_client
.
run
@chef_client
=
nil
end
def
client_sleep
(
sec
)
IO
.
select
([
SELF_PIPE
[
0
]
],
nil
,
nil
,
sec
)
or
return
SELF_PIPE
[
0
].
getc
...
...
chef/lib/chef/application/solo.rb
View file @
04bdf715
...
...
@@ -149,8 +149,8 @@ class Chef::Application::Solo < Chef::Application
def
initialize
super
@chef_
solo
=
nil
@chef_
solo
_json
=
nil
@chef_
client
=
nil
@chef_
client
_json
=
nil
end
def
reconfigure
...
...
@@ -182,7 +182,7 @@ class Chef::Application::Solo < Chef::Application
end
begin
@chef_
solo
_json
=
Chef
::
JSONCompat
.
from_json
(
json_io
.
read
)
@chef_
client
_json
=
Chef
::
JSONCompat
.
from_json
(
json_io
.
read
)
json_io
.
close
unless
json_io
.
closed?
rescue
JSON
::
ParserError
=>
error
Chef
::
Application
.
fatal!
(
"Could not parse the provided JSON file (
#{
Chef
::
Config
[
:json_attribs
]
}
)!: "
+
error
.
message
,
2
)
...
...
@@ -247,15 +247,4 @@ class Chef::Application::Solo < Chef::Application
end
end
private
# Initializes Chef::Client instance and runs it
def
run_chef_client
@chef_solo
=
Chef
::
Client
.
new
(
@chef_solo_json
,
:override_runlist
=>
config
[
:override_runlist
]
)
@chef_solo
.
run
@chef_solo
=
nil
end
end
chef/lib/chef/application/windows_service.rb
View file @
04bdf715
...
...
@@ -219,20 +219,6 @@ class Chef
end
end
private
# Initializes Chef::Client instance and runs it
def
run_chef_client
@chef_client
=
Chef
::
Client
.
new
(
@chef_client_json
,
:override_runlist
=>
config
[
:override_runlist
]
)
@chef_client_json
=
nil
@chef_client
.
run
@chef_client
=
nil
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