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

Cookbook removes scheduled task #221

Open
mbaitelman opened this issue Feb 11, 2021 · 5 comments
Open

Cookbook removes scheduled task #221

mbaitelman opened this issue Feb 11, 2021 · 5 comments

Comments

@mbaitelman
Copy link

I'm using the cookbook v3.11.1 on Windows Server and when running it's removing the chef-client task from the chef-client cookbook.

Below is the log of the run that called the update..
Please let me know what other data I can provide.

Thank you.

  * chef_client_updater[update chef-client] action update[2021-02-11T14:31:26-08:00] INFO: Processing chef_client_updater[update chef-client] action update (chef_client_updater::default line 20)
[2021-02-11T14:31:26-08:00] DEBUG: Found gem version 2.7.6. Desired version is >= 2.6.11
[2021-02-11T14:31:27-08:00] DEBUG: Platform detected as {:platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64"} by mixlib_install
[2021-02-11T14:31:27-08:00] DEBUG: Passing options to mixlib-install: {:product_name=>"chef", :platform_version_compatibility_mode=>true, :platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64", :channel=>:stable, :product_version=>"16.10", :install_command_options=>{}}
[2021-02-11T14:31:28-08:00] DEBUG: User specified version of 16.10. Looking up using mixlib-install as this is not X.Y.Z format. Value maps to 16.10.8.
[2021-02-11T14:31:28-08:00] DEBUG: The current chef version is 14.10.9 and the desired version is 16.10.8
[2021-02-11T14:31:28-08:00] DEBUG: A Chef Infra Client upgrade is necessary
[2021-02-11T14:31:28-08:00] DEBUG: Platform detected as {:platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64"} by mixlib_install
[2021-02-11T14:31:28-08:00] DEBUG: Passing options to mixlib-install: {:product_name=>"chef", :platform_version_compatibility_mode=>true, :platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64", :channel=>:stable, :product_version=>"16.10", :install_command_options=>{}}
[2021-02-11T14:31:28-08:00] DEBUG: User specified version of 16.10. Looking up using mixlib-install as this is not X.Y.Z format. Value maps to 16.10.8.
[2021-02-11T14:31:29-08:00] DEBUG: Platform detected as {:platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64"} by mixlib_install
[2021-02-11T14:31:29-08:00] DEBUG: Passing options to mixlib-install: {:product_name=>"chef", :platform_version_compatibility_mode=>true, :platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64", :channel=>:stable, :product_version=>"16.10", :install_command_options=>{}}

    * remote_file[C:\chef\cache/handle.zip] action create[2021-02-11T14:35:42-08:00] INFO: Processing remote_file[C:\chef\cache/handle.zip] action create (C:/chef/cache/cookbooks/chef_client_updater/providers/default.rb line 304)
[2021-02-11T14:35:42-08:00] INFO: remote_file[C:\chef\cache/handle.zip] created file C:\chef\cache/handle.zip

      - create new file C:\chef\cache/handle.zip[2021-02-11T14:35:42-08:00] INFO: remote_file[C:\chef\cache/handle.zip] updated file contents C:\chef\cache/handle.zip

      - update content in file C:\chef\cache/handle.zip from none to 524e61
      (new content is binary, diff output suppressed)
SUCCESS: The scheduled task "Chef_upgrade" has successfully been created.
[2021-02-11T14:35:43-08:00] DEBUG: Platform detected as {:platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64"} by mixlib_install
[2021-02-11T14:35:43-08:00] DEBUG: Passing options to mixlib-install: {:product_name=>"chef", :platform_version_compatibility_mode=>true, :platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64", :channel=>:stable, :product_version=>"16.10", :install_command_options=>{}}
[2021-02-11T14:35:43-08:00] DEBUG: User specified version of 16.10. Looking up using mixlib-install as this is not X.Y.Z format. Value maps to 16.10.8.
[2021-02-11T14:35:44-08:00] DEBUG: Platform detected as {:platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64"} by mixlib_install
[2021-02-11T14:35:44-08:00] DEBUG: Passing options to mixlib-install: {:product_name=>"chef", :platform_version_compatibility_mode=>true, :platform=>"windows", :platform_version=>"2019", :architecture=>"x86_64", :channel=>:stable, :product_version=>"16.10", :install_command_options=>{}}
[2021-02-11T14:35:44-08:00] DEBUG: User specified version of 16.10. Looking up using mixlib-install as this is not X.Y.Z format. Value maps to 16.10.8.
    * powershell_script[Chef Infra Client Upgrade Script] action run[2021-02-11T14:35:44-08:00] INFO: Processing powershell_script[Chef Infra Client Upgrade Script] action run (C:/chef/cache/cookbooks/chef_client_updater/providers/default.rb line 507)
[2021-02-11T14:35:45-08:00] INFO: powershell_script[Chef Infra Client Upgrade Script] ran successfully

      - execute "C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NonInteractive -NoProfile -ExecutionPolicy Bypass -InputFormat None -File "C:/Users/MBAITE~1/AppData/Local/Temp/chef-script20210211-4124-b7j3w0.ps1"
    - upgrade chef 14.10.9 to 16.10.8[2021-02-11T14:35:45-08:00] WARN: forcing "exec" to "kill" on windows.
[2021-02-11T14:35:45-08:00] WARN: New Chef Infra Client installed and client process exit is allowed and/or specified. Now forcing Chef Infra Client to exit. Disregard any failure messages.
[2021-02-11T14:35:45-08:00] INFO: Running queued delayed notifications before re-raising exception

  Running handlers:
[2021-02-11T14:35:45-08:00] ERROR: Running exception handlers
  Running handlers complete
[2021-02-11T14:35:45-08:00] ERROR: Exception handlers complete
  Chef Client failed. 2 resources updated in 04 minutes 59 seconds
[2021-02-11T14:35:45-08:00] FATAL: Stacktrace dumped to C:/chef/cache/chef-stacktrace.out
[2021-02-11T14:35:45-08:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2021-02-11T14:35:45-08:00] DEBUG: SystemExit: exit```
@mbaitelman
Copy link
Author

Interesting.
In that case, I would be ok closing out this issue though I would like to know what is the suggested flow for upgrading on windows when using both this and the chef-client cookbook.

@Aeternax
Copy link

Aeternax commented Jan 3, 2024

We ran into this when we upgraded from 17.10.3 to v17.10.95.
The task got removed, the new client succesfully installed, but thus no longer executed after that.

@pa-jberanek
Copy link

We've also just hit this...it looks like it would almost be a simple fix in the upgrade Powershell script to run the Chef client, but then the post_action will always be empty, as on Windows the only allowed value for post_install_action is kill.

https://github.com/chef-cookbooks/chef_client_updater/blob/main/providers/default.rb#L643

If the line mentioned above just ran the Chef client from the scheduled upgrade Powershell script, I believe the upgrade would work.

@pa-jberanek
Copy link

Thinking that changing the Windows-specific code in https://github.com/chef-cookbooks/chef_client_updater/blob/main/providers/default.rb#L548-L552

    post_action = if new_resource.post_install_action == 'exec'
                    new_resource.exec_command
                  else
                    ''
                  end

to just the following might work:

    post_action = new_resource.exec_command

@pa-jberanek
Copy link

Just tested the above upgrading a Cinc 18.2.7 installation to Cinc 18.4.2 and it worked, with Cinc being run from the upgrade scheduled task:

Starting upgrade at 05/07/2024 12:29:00
[*] Destroying open Chef handles.
[*] Completed destroying open Chef handles.
Running product install script...

ModuleType Version    Name                                ExportedCommands                                             
---------- -------    ----                                ----------------                                             
Script     0.0        Omnitruck                           {Get-ProjectMetadata, Install-Project, install}              
Install script finished
SUCCESS: The scheduled task "chef_upgrade" was successfully deleted.
Finished upgrade at 05/07/2024 12:33:04

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

No branches or pull requests

4 participants
@mbaitelman @Aeternax @pa-jberanek and others