Skip to content

Commit 28f80d9

Browse files
GerardoGRkarlicoss
authored andcommitted
feat: fetch held deb packages' version (#618)
* propagate return value from @Deploy decorator e.g. this allows writing code like: @Deploy def ripgrep(**kwargs): return apt.packages('ripgrep', **kwargs) res = ripgrep() if res.changed: # do something else * feat: support held deb packages It would be useful to fetch the version number of held deb packages to have scripts that manually unhold them to be able to upgrade if the need be. Co-authored-by: Dima Gerasimov <[email protected]>
1 parent ddf87d9 commit 28f80d9

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

pyinfra/facts/deb.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class DebPackages(FactBase):
2525

2626
default = dict
2727

28-
regex = r'^ii\s+([a-zA-Z0-9\+\-\.]+):?[a-zA-Z0-9]*\s+([a-zA-Z0-9:~\.\-\+]+).+$'
28+
regex = r'^[i|h]i\s+([a-zA-Z0-9\+\-\.]+):?[a-zA-Z0-9]*\s+([a-zA-Z0-9:~\.\-\+]+).+$'
2929

3030
def process(self, output):
3131
return parse_packages(self.regex, output)
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"command": "dpkg -l",
3+
"output": [
4+
"hi matrix-synapse-py3 1.37.1+bionic1 amd64 Open federated Instant Messaging and VoIP server",
5+
"hi miniflux 2.0.31 amd64 Minimalist Feed Reader",
6+
"hi wireguard 1.0.20200513-1~18.04.2 all fast, modern, secure kernel VPN tunnel (metapackage)"
7+
],
8+
"fact": {
9+
"matrix-synapse-py3": ["1.37.1+bionic1"],
10+
"miniflux": ["2.0.31"],
11+
"wireguard": ["1.0.20200513-1~18.04.2"]
12+
}
13+
}

0 commit comments

Comments
 (0)