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

(MODULES-11255) Add basic tasks to manage packages #273

Merged
merged 1 commit into from
Feb 21, 2022

Conversation

smortex
Copy link
Collaborator

@smortex smortex commented Jan 14, 2022

Add a task to list current packages:

C:\> bolt task run chocolatey::status -t localhost
Started on localhost...
Finished on localhost:
{"status":[{"package":"chocolatey","version":"0.11.3"},{"package":"puppet-bolt","version":"3.20.0"}]}
Successful on 1 target: localhost
Ran on 1 target in 2.6 sec
C:\>

Add tasks to install, upgrade and uninstall packages:

C:\> bolt task run chocolatey action=install package=pdk version=2.0.0.0 -t localhost
C:\> bolt task run chocolatey action=upgrade package=pdk -t localhost
C:\> bolt task run chocolatey action=uninstall package=pdk -t localhost

Add a task to pin/unpin packages:

C:\> bolt task run chocolatey::pin action=add package=puppet-bolt -t localhost
C:\> bolt task run chocolatey::pin action=list -t localhost
Started on localhost...
Finished on localhost:
{"status":[{"package":"puppet-bolt","version":"3.20.0"}]}
Successful on 1 target: localhost
Ran on 1 target in 2.6 sec
C:\> bolt task run chocolatey::pin action=remove package=pdk -t localhost

Add a task to list outdated packages:

C:\> bolt task run chocolatey::outdated -t localhost
Started on localhost...
Finished on localhost:
{"status":[{"package":"puppet-bolt","version":"3.20.0","available_version":"3.21.0","pinned":false}]}
Successful on 1 target: localhost
Ran on 1 target in 10.14 sec
C:\>

@smortex
Copy link
Collaborator Author

smortex commented Jan 14, 2022

This is currently a draft to allow the community to provide feedback on the interface of the tasks. Cc @neomilium, @bastelfreak, @mtancoigne 😁

bastelfreak
bastelfreak previously approved these changes Jan 14, 2022
tasks/outdated.rb Outdated Show resolved Hide resolved
tasks/status.rb Outdated Show resolved Hide resolved
tasks/status.rb Outdated Show resolved Hide resolved
@smortex smortex marked this pull request as draft January 24, 2022 18:28
bastelfreak
bastelfreak previously approved these changes Jan 25, 2022
@michaeltlombardi
Copy link

Given that this is a Windows-only module and task, is there a reason to write it to require the Puppet Agent/Ruby instead of using PowerShell?

@smortex
Copy link
Collaborator Author

smortex commented Jan 26, 2022

@michaeltlombardi as a POSIX system user who does a lot of Ruby and has to manage a few windows nodes, I have not even though about using powershell 🤣 I jumped directly on the tools I am used to and master.

@michaeltlombardi
Copy link

I only ask because the primary drawback is that using ruby means these tasks can only be executed against nodes with the agent installed. Not a huge deal just wanted to check!

bastelfreak
bastelfreak previously approved these changes Jan 26, 2022
bastelfreak
bastelfreak previously approved these changes Jan 28, 2022
@smortex
Copy link
Collaborator Author

smortex commented Feb 15, 2022

I think this has settled so I squashed the commits and updated the PR description accordingly. I have been using these tasks for some time now and consider this ready for merging 🎉

Add a task to list current packages:

C:\> bolt task run chocolatey::status -t localhost
Started on localhost...
Finished on localhost:
  {"status":[{"package":"chocolatey","version":"0.11.3"},{"package":"puppet-bolt","version":"3.20.0"}]}
Successful on 1 target: localhost
Ran on 1 target in 2.6 sec
C:\>

Add tasks to install, upgrade and uninstall packages:

C:\> bolt task run chocolatey action=install package=pdk version=2.0.0.0 -t localhost
C:\> bolt task run chocolatey action=upgrade package=pdk -t localhost
C:\> bolt task run chocolatey action=uninstall package=pdk -t localhost

Add a task to pin/unpin packages:

C:\> bolt task run chocolatey::pin action=add package=puppet-bolt -t localhost
C:\> bolt task run chocolatey::pin action=list -t localhost
Started on localhost...
Finished on localhost:
  {"status":[{"package":"puppet-bolt","version":"3.20.0"}]}
Successful on 1 target: localhost
Ran on 1 target in 2.6 sec
C:\> bolt task run chocolatey::pin action=remove package=pdk -t localhost

Add a task to list outdated packages:

C:\> bolt task run chocolatey::outdated -t localhost
Started on localhost...
Finished on localhost:
  {"status":[{"package":"puppet-bolt","version":"3.20.0","available_version":"3.21.0","pinned":false}]}
Successful on 1 target: localhost
Ran on 1 target in 10.14 sec
C:\>
@LukasAud LukasAud merged commit a694bef into puppetlabs:main Feb 21, 2022
@smortex smortex deleted the tasks branch February 21, 2022 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants