Skip to content

Commit

Permalink
Add 'available' as an argument to apk.upgrade (#660)
Browse files Browse the repository at this point in the history
* Add 'available' as an argument to apk.upgrade

* Add documentation on 'available' parameter

* Add `apk.upgrade` available test.

Co-authored-by: Nick Barrett <[email protected]>
  • Loading branch information
lun-4 and Fizzadar committed Sep 25, 2021
1 parent 0309c3e commit 4eac293
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pyinfra/operations/apk.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,17 @@


@operation
def upgrade(state=None, host=None):
def upgrade(available=False, state=None, host=None):
'''
Upgrades all apk packages.
+ available: force all packages to be upgraded (recommended on whole Alpine version upgrades)
'''

yield 'apk upgrade'
if available:
yield 'apk upgrade --available'
else:
yield 'apk upgrade'

_upgrade = upgrade # noqa: E305

Expand Down
11 changes: 11 additions & 0 deletions tests/operations/apk.upgrade/upgrade_available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"args": [],
"kwargs": {
"available": true
},
"commands": [
"apk upgrade --available"
],
"idempotent": false,
"disable_itempotent_warning_reason": "package upgrades are always executed"
}

0 comments on commit 4eac293

Please sign in to comment.