Skip to content
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

Conversation

piyushawasthi
Copy link
Contributor

@piyushawasthi piyushawasthi commented Jun 22, 2017

This PR will make sure that Azure Chef extension start the chef-client service, If service StartMode is disabled.

@piyushawasthi piyushawasthi changed the title MSYS-548 - Fixed failing extension for service startmode is disabled [In-progress] MSYS-548 - Fixed failing extension for service startmode is disabled Jun 23, 2017
@piyushawasthi piyushawasthi force-pushed the piyush/fixed_for_disabled_mode branch 3 times, most recently from 9ea2237 to fd776c4 Compare June 23, 2017 09:46
Signed-off-by: piyushawasthi <piyush.awasthi@msystechnologies.com>
@piyushawasthi piyushawasthi force-pushed the piyush/fixed_for_disabled_mode branch from fd776c4 to 1bf48b0 Compare June 23, 2017 09:49
@piyushawasthi piyushawasthi changed the title [In-progress] MSYS-548 - Fixed failing extension for service startmode is disabled MSYS-548 - Fixed failing extension for service startmode is disabled. Jun 23, 2017
@@ -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"}

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.

Copy link
Contributor Author

@piyushawasthi piyushawasthi Jun 29, 2017

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.

@@ -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)

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.

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"})

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be expect?

@piyushawasthi piyushawasthi force-pushed the piyush/fixed_for_disabled_mode branch from c6bec69 to 5d73e5c Compare July 3, 2017 06:46
@NimishaS NimishaS merged commit 087a7c9 into chef-partners:master Jul 3, 2017
@NimishaS NimishaS deleted the piyush/fixed_for_disabled_mode branch July 3, 2017 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants