-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MSYS-548 - Fixed failing extension for service startmode is disabled. #217
MSYS-548 - Fixed failing extension for service startmode is disabled. #217
Conversation
9ea2237
to
fd776c4
Compare
Signed-off-by: piyushawasthi <piyush.awasthi@msystechnologies.com>
fd776c4
to
1bf48b0
Compare
lib/chef/azure/service.rb
Outdated
@@ -117,6 +117,7 @@ def is_running? | |||
def start_service(bootstrap_directory, log_location) | |||
puts "#{Time.now} Starting chef-client service ...." | |||
params = " -c #{bootstrap_directory}\\client.rb -L #{log_location}\\chef-client.log " | |||
set_startup_type = %x{powershell.exe -Command "Set-Service -Name 'chef-client' -StartupType automatic"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check if we can use shell_out
instead of %x
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mixlib-shellout library basically for subprocess management and output collection. Here, we aren't collecting any output so that shell_out is not required for this.
spec/unit/service_spec.rb
Outdated
@@ -335,6 +335,21 @@ | |||
end | |||
end | |||
|
|||
context 'service start successful for startup type is disable' do | |||
before do | |||
allow(instance).to receive(%x{powershell.exe -Command "Set-Service -Name 'chef-client' -StartupType Disabled"}).and_return(true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line doesn't execute as we are not calling %x{powershell.exe -Command "Set-Service -Name 'chef-client' -StartupType Disabled"}
in the code.
spec/unit/service_spec.rb
Outdated
allow(instance).to receive(%x{powershell.exe -Command "Set-Service -Name 'chef-client' -StartupType Disabled"}).and_return(true) | ||
end | ||
it 'does not report any error' do | ||
allow(instance).to receive(%x{powershell.exe -Command "Set-Service -Name 'chef-client' -StartupType automatic"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be expect
?
c6bec69
to
5d73e5c
Compare
This PR will make sure that Azure Chef extension start the chef-client service, If service StartMode is disabled.