В puppet написал ф-ю
Puppet::Functions.create_function(:get_package_version) do
dispatch :get_package_version do
param 'String', :package_name
end
require 'shellwords'
def get_package_version(package_name)
`/usr/bin/dpkg-query -W -f='${Version}' #{Shellwords.escape(package_name)}`
end
end
, но некоторые пакеты она не видит
меняю
`/usr/bin/dpkg-query -W -f='${Version}'`
/usr/bin/dpkg-query -W -f='${Version}'
diff -yB ruby system
> adduser 3.115
apt 1.4.8 apt 1.4.8
> aptitude 0.8.7-1
> aptitude-common 0.8.7-1
base-files 9.9+deb9u1 base-files 9.9+deb9u1
base-passwd 3.5.43 base-passwd 3.5.43
bash 4.4-5 bash 4.4-5
bsdutils 1:2.29.2-1 bsdutils 1:2.29.2-1
ca-certificates 20161130+nmu1 ca-certificates 20161130+nmu1
ca-certificates-java 20170531+nmu1 <
coreutils 8.26-3 coreutils 8.26-3
dash 0.5.8-2.4 dash 0.5.8-2.4
dbus 1.10.22-0+deb9u1 dbus 1.10.22-0+deb9u1
debconf 1.5.61 debconf 1.5.61
debian-archive-keyring 2017.5 debian-archive-keyring 2017.5
debianutils 4.8.1.1 debianutils 4.8.1.1
dialog 1.3-20160828-2 dialog 1.3-20160828-2
diffutils 1:3.5-3 diffutils 1:3.5-3
> dmidecode 3.0-4
dmsetup 2:1.02.137-2 dmsetup 2:1.02.137-2
dpkg 1.18.24 dpkg 1.18.24
e2fslibs 1.43.4-2 e2fslibs 1.43.4-2
e2fsprogs 1.43.4-2 e2fsprogs 1.43.4-2
> ejabberd 16.09-4
> erlang-asn1 1:19.2.1+dfsg-2
> erlang-base 1:19.2.1+dfsg-2
> erlang-crypto 1:19.2.1+dfsg-2
> erlang-edoc 1:19.2.1+dfsg-2
> erlang-eunit 1:19.2.1+dfsg-2
> erlang-goldrush 0.1.9-2
> erlang-inets 1:19.2.1+dfsg-2
> erlang-jiffy 0.14.8+dfsg-1
> erlang-lager 3.2.4-1
> erlang-mnesia 1:19.2.1+dfsg-2
> erlang-odbc 1:19.2.1+dfsg-2
> erlang-p1-cache-tab 1.0.4-2
> erlang-p1-iconv 1.0.2-2
> erlang-p1-stringprep 1.0.6-2
> erlang-p1-stun 1.0.7-2
> erlang-p1-tls 1.0.7-2+deb9u1
> erlang-p1-utils 1.0.5-3
> erlang-p1-xml 1.1.15-2
> erlang-p1-yaml 1.0.6-2
> erlang-p1-zlib 1.0.1-4
> erlang-proper 1.2+dfsg-1
> erlang-public-key 1:19.2.1+dfsg-2
> erlang-runtime-tools 1:19.2.1+dfsg-2
> erlang-ssl 1:19.2.1+dfsg-2
> erlang-syntax-tools 1:19.2.1+dfsg-2
> erlang-xmerl 1:19.2.1+dfsg-2
findutils 4.6.0+git+20161106-2 findutils 4.6.0+git+20161106-2
fontconfig-config 2.11.0-6.7 <
fonts-dejavu-core 2.37-1 <
gcc-6-base 6.3.0-18 gcc-6-base 6.3.0-18
git 1:2.11.0-3+deb9u2 | gettext 0.19.8.1-2
git-core 1:2.11.0-3+deb9u2 | gettext-base 0.19.8.1-2
git-man 1:2.11.0-3+deb9u2 <
gpgv 2.1.18-8~deb9u1 gpgv 2.1.18-8~deb9u1
grep 2.27-2 grep 2.27-2
gzip 1.6-5+b1 gzip 1.6-5+b1
> hdparm 9.51+ds-1
hostname 3.18+b1 hostname 3.18+b1
ifupdown 0.8.19 ifupdown 0.8.19
init 1.48 init 1.48
init-system-helpers 1.48 init-system-helpers 1.48
> intltool-debian 0.35.0+20060710.4
iproute 1:4.9.0-1 iproute 1:4.9.0-1
iproute2 4.9.0-1 iproute2 4.9.0-1
isc-dhcp-client 4.3.5-3 isc-dhcp-client 4.3.5-3
java-common 0.58 <
less 481-2.1 <
libacl1 2.2.52-3+b1 libacl1 2.2.52-3+b1
libapparmor1 2.11.0-3 libapparmor1 2.11.0-3
libapt-pkg5.0 1.4.8 libapt-pkg5.0 1.4.8
libattr1 1:2.4.47-2+b2 libattr1 1:2.4.47-2+b2
libaudit-common 1:2.6.7-2 libaudit-common 1:2.6.7-2
libaudit1 1:2.6.7-2 libaudit1 1:2.6.7-2
libavahi-client3 0.6.32-2 | libauthen-sasl-perl 2.1600-1
libavahi-common-data 0.6.32-2 <
libavahi-common3 0.6.32-2 <
libblkid1 2.29.2-1 libblkid1 2.29.2-1
> libboost-filesystem1.62.0 1.62.0+dfsg-4
> libboost-iostreams1.62.0 1.62.0+dfsg-4
> libboost-system1.62.0 1.62.0+dfsg-4
libbsd0 0.8.3-1 libbsd0 0.8.3-1
libbz2-1.0 1.0.6-8.1 libbz2-1.0 1.0.6-8.1
libc-bin 2.24-11+deb9u1 libc-bin 2.24-11+deb9u1
libc-l10n 2.24-11+deb9u1 libc-l10n 2.24-11+deb9u1
libc6 2.24-11+deb9u1 libc6 2.24-11+deb9u1
libcap-ng0 0.7.7-3+b1 libcap-ng0 0.7.7-3+b1
libcap2 1:2.25-1 libcap2 1:2.25-1
> libcgi-fast-perl 1:2.12-1
> libcgi-pm-perl 4.35-1
> libclass-accessor-perl 0.34-1
libcomerr2 1.43.4-2 libcomerr2 1.43.4-2
> libcroco3 0.6.11-3
libcryptsetup4 2:1.7.3-4 libcryptsetup4 2:1.7.3-4
libcups2 2.2.1-8 | libcwidget3v5 0.5.17-4+b1
libcurl3-gnutls 7.52.1-5+deb9u2 <
libdb5.3 5.3.28-12+deb9u1 libdb5.3 5.3.28-12+deb9u1
libdbus-1-3 1.10.22-0+deb9u1 libdbus-1-3 1.10.22-0+deb9u1
libdebconfclient0 0.227 libdebconfclient0 0.227
libdevmapper1.02.1 2:1.02.137-2 libdevmapper1.02.1 2:1.02.137-2
libdns-export162 1:9.10.3.dfsg.P4-12.3+deb9u3 libdns-export162 1:9.10.3.dfsg.P4-12.3+deb9u3
libedit2 3.1-20160903-3 libedit2 3.1-20160903-3
libelf1 0.168-1 libelf1 0.168-1
liberror-perl 0.17024-1 | libencode-locale-perl 1.05-1
libexpat1 2.2.0-2+deb9u1 libexpat1 2.2.0-2+deb9u1
> libfcgi-perl 0.78-2
libfdisk1 2.29.2-1 libfdisk1 2.29.2-1
libffi6 3.2.1-6 libffi6 3.2.1-6
libfontconfig1 2.11.0-6.7+b1 | libfile-listing-perl 6.04-1
libfreetype6 2.6.3-3.2 | libfont-afm-perl 1.20-2
libgcc1 1:6.3.0-18 libgcc1 1:6.3.0-18
libgcrypt20 1.7.6-2+deb9u2 libgcrypt20 1.7.6-2+deb9u2
libgdbm3 1.8.3-14 libgdbm3 1.8.3-14
> libglib2.0-0 2.50.3-2
> libglib2.0-data 2.50.3-2
libgmp10 2:6.1.2+dfsg-1 libgmp10 2:6.1.2+dfsg-1
libgnutls30 3.5.8-5+deb9u3 libgnutls30 3.5.8-5+deb9u3
> libgomp1 6.3.0-18
libgpg-error0 1.26-2 libgpg-error0 1.26-2
libgssapi-krb5-2 1.15-1+deb9u1 libgssapi-krb5-2 1.15-1+deb9u1
libhogweed4 3.3-1+b2 libhogweed4 3.3-1+b2
> libhtml-form-perl 6.03-1
> libhtml-format-perl 2.12-1
> libhtml-parser-perl 3.72-3
> libhtml-tagset-perl 3.20-3
> libhtml-tree-perl 5.03-2
> libhttp-cookies-perl 6.01-1
> libhttp-daemon-perl 6.01-1
> libhttp-date-perl 6.02-1
> libhttp-message-perl 6.11-1
> libhttp-negotiate-perl 6.00-2
> libicu57 57.1-6
libidn11 1.33-1 libidn11 1.33-1
libidn2-0 0.16-1+deb9u1 libidn2-0 0.16-1+deb9u1
> libio-html-perl 1.001-1
> libio-socket-ssl-perl 2.044-1
> libio-string-perl 1.08-3
libip4tc0 1.6.0+snapshot20161117-6 libip4tc0 1.6.0+snapshot20161117-6
libisc-export160 1:9.10.3.dfsg.P4-12.3+deb9u3 libisc-export160 1:9.10.3.dfsg.P4-12.3+deb9u3
libjpeg62-turbo 1:1.5.1-2 <
libk5crypto3 1.15-1+deb9u1 libk5crypto3 1.15-1+deb9u1
libkeyutils1 1.5.9-9 libkeyutils1 1.5.9-9
libkmod2 23-2 libkmod2 23-2
libkrb5-3 1.15-1+deb9u1 libkrb5-3 1.15-1+deb9u1
libkrb5support0 1.15-1+deb9u1 libkrb5support0 1.15-1+deb9u1
liblcms2-2 2.8-4 | liblocale-gettext-perl 1.07-3+b1
libldap-2.4-2 2.4.44+dfsg-5+deb9u1 | libltdl7 2.4.6-2
libldap-common 2.4.44+dfsg-5+deb9u1 | liblwp-mediatypes-perl 6.02-1
> liblwp-protocol-https-perl 6.06-2
liblz4-1 0.0~r131-2+b1 liblz4-1 0.0~r131-2+b1
liblzma5 5.2.2-1.2+b1 liblzma5 5.2.2-1.2+b1
> libmail-sendmail-perl 0.79.16-2
> libmailtools-perl 2.18-1
libmnl0 1.0.4-2 libmnl0 1.0.4-2
libmount1 2.29.2-1 libmount1 2.29.2-1
libncurses5 6.0+20161126-1+deb9u1 libncurses5 6.0+20161126-1+deb9u1
libncursesw5 6.0+20161126-1+deb9u1 libncursesw5 6.0+20161126-1+deb9u1
> libnet-http-perl 6.12-1
> libnet-ip-perl 1.26-1
> libnet-smtp-ssl-perl 1.04-1
> libnet-ssleay-perl 1.80-1
libnettle6 3.3-1+b2 libnettle6 3.3-1+b2
libnghttp2-14 1.18.1-1 | libodbc1 2.3.4-1
libnspr4 2:4.12-6 | libopts25 1:5.18.12-3
libnss3 2:3.26.2-1.1+deb9u1 <
libp11-kit0 0.23.3-2 libp11-kit0 0.23.3-2
libpam-modules 1.1.8-3.6 libpam-modules 1.1.8-3.6
libpam-modules-bin 1.1.8-3.6 libpam-modules-bin 1.1.8-3.6
libpam-runtime 1.1.8-3.6 libpam-runtime 1.1.8-3.6
libpam-systemd 232-25+deb9u1 libpam-systemd 232-25+deb9u1
libpam0g 1.1.8-3.6 libpam0g 1.1.8-3.6
> libparse-debianchangelog-perl 1.2.0-12
> libpci3 1:3.5.2-1
libpcre3 2:8.39-3 libpcre3 2:8.39-3
libpcsclite1 1.8.20-1 <
libperl5.24 5.24.1-3+deb9u2 libperl5.24 5.24.1-3+deb9u2
libpng16-16 1.6.28-1 | libproc-daemon-perl 0.23-1
libpopt0 1.16-10+b2 | libproc-processtable-perl 0.53-2
libprocps6 2:3.3.12-3 libprocps6 2:3.3.12-3
libpsl5 0.17.0-3 libpsl5 0.17.0-3
libreadline7 7.0-3 libreadline7 7.0-3
librtmp1 2.4+20151223.gitfa8646d.1-1+b1 | libsctp1 1.0.17+dfsg-1+b1
libsasl2-2 2.1.27~101-g0780600+dfsg-3 <
libsasl2-modules 2.1.27~101-g0780600+dfsg-3 <
libsasl2-modules-db 2.1.27~101-g0780600+dfsg-3 <
libseccomp2 2.3.1-2.1 libseccomp2 2.3.1-2.1
libselinux1 2.6-3+b3 libselinux1 2.6-3+b3
libsemanage-common 2.6-2 libsemanage-common 2.6-2
libsemanage1 2.6-2 libsemanage1 2.6-2
libsepol1 2.6-2 libsepol1 2.6-2
> libsigc++-2.0-0v5 2.10.0-1
libsmartcols1 2.29.2-1 libsmartcols1 2.29.2-1
libsqlite3-0 3.16.2-5 libsqlite3-0 3.16.2-5
libss2 1.43.4-2 libss2 1.43.4-2
libssh2-1 1.7.0-1 <
libssl1.0.2 1.0.2l-2 libssl1.0.2 1.0.2l-2
libssl1.1 1.1.0f-3+deb9u1 | libssl1.1 1.1.0f-3
libstdc++6 6.3.0-18 libstdc++6 6.3.0-18
> libsub-name-perl 0.21-1
> libsys-hostname-long-perl 1.5-1
libsystemd0 232-25+deb9u1 libsystemd0 232-25+deb9u1
libtasn1-6 4.10-1.1 libtasn1-6 4.10-1.1
> libtimedate-perl 2.3000-2
libtinfo5 6.0+20161126-1+deb9u1 libtinfo5 6.0+20161126-1+deb9u1
libudev1 232-25+deb9u1 libudev1 232-25+deb9u1
libunistring0 0.9.6+really0.9.3-0.1 libunistring0 0.9.6+really0.9.3-0.1
> liburi-perl 1.71-1
libustr-1.0-1 1.0.4-6 libustr-1.0-1 1.0.4-6
libuuid1 2.29.2-1 libuuid1 2.29.2-1
libwrap0 7.6.q-26 libwrap0 7.6.q-26
> libwww-perl 6.15-1
> libwww-robotrules-perl 6.01-1
libx11-6 2:1.6.4-3 libx11-6 2:1.6.4-3
libx11-data 2:1.6.4-3 libx11-data 2:1.6.4-3
> libxapian30 1.4.3-2
libxau6 1:1.0.8-1 libxau6 1:1.0.8-1
libxcb1 1.12-1 libxcb1 1.12-1
libxdmcp6 1:1.1.2-3 libxdmcp6 1:1.1.2-3
libxext6 2:1.3.3-1+b2 libxext6 2:1.3.3-1+b2
libxi6 2:1.7.9-1 | libxml-libxml-perl 2.0128+dfsg-1+deb9u1
> libxml-namespacesupport-perl 1.11-1
> libxml-parser-perl 2.44-2+b1
> libxml-sax-base-perl 1.07-1
> libxml-sax-expat-perl 0.40-2
> libxml-sax-perl 0.99+dfsg-2
> libxml-simple-perl 2.22-1
> libxml2 2.9.4+dfsg1-2.2+deb9u1
libxmuu1 2:1.1.2-2 libxmuu1 2:1.1.2-2
libxrender1 1:0.9.10-1 | libyaml-0-2 0.1.7-2
libxtst6 2:1.2.3-1 <
locales 2.24-11+deb9u1 locales 2.24-11+deb9u1
login 1:4.4-4.1 login 1:4.4-4.1
lsb-base 9.20161125 lsb-base 9.20161125
mawk 1.3.3-17+b3 mawk 1.3.3-17+b3
mount 2.29.2-1 mount 2.29.2-1
multiarch-support 2.24-11+deb9u1 multiarch-support 2.24-11+deb9u1
nano 2.7.4-1 nano 2.7.4-1
ncurses-base 6.0+20161126-1+deb9u1 ncurses-base 6.0+20161126-1+deb9u1
ncurses-bin 6.0+20161126-1+deb9u1 ncurses-bin 6.0+20161126-1+deb9u1
ncurses-term 6.0+20161126-1+deb9u1 ncurses-term 6.0+20161126-1+deb9u1
net-tools 1.60+git20161116.90da8a0-1 net-tools 1.60+git20161116.90da8a0-1
netbase 5.4 netbase 5.4
openjdk-8-jre-headless 8u151-b12-1~deb9u1 | ntp 1:4.2.8p10+dfsg-3+deb9u1
> ocsinventory-agent 2:2.0.5-1.2
openssh-client 1:7.4p1-10+deb9u1 openssh-client 1:7.4p1-10+deb9u1
openssh-server 1:7.4p1-10+deb9u1 openssh-server 1:7.4p1-10+deb9u1
openssh-sftp-server 1:7.4p1-10+deb9u1 openssh-sftp-server 1:7.4p1-10+deb9u1
openssl 1.1.0f-3+deb9u1 | openssl 1.1.0f-3
passwd 1:4.4-4.1 passwd 1:4.4-4.1
patch 2.7.5-1+b2 | pciutils 1:3.5.2-1
perl 5.24.1-3+deb9u2 perl 5.24.1-3+deb9u2
perl-base 5.24.1-3+deb9u2 perl-base 5.24.1-3+deb9u2
perl-modules-5.24 5.24.1-3+deb9u2 perl-modules-5.24 5.24.1-3+deb9u2
> perl-openssl-defaults 3
> po-debconf 1.0.20
> powermgmt-base 1.31+nmu1
procps 2:3.3.12-3 procps 2:3.3.12-3
publicsuffix 20170424.0717-1 publicsuffix 20170424.0717-1
puppet-agent 5.3.3-1stretch puppet-agent 5.3.3-1stretch
puppet5-release 5.0.0-1stretch puppet5-release 5.0.0-1stretch
puppetserver 5.1.4-1stretch <
readline-common 7.0-3 readline-common 7.0-3
rename 0.20-4 rename 0.20-4
rsync 3.1.2-1 <
sed 4.4-1 sed 4.4-1
sensible-utils 0.0.9 sensible-utils 0.0.9
> sgml-base 1.29
> shared-mime-info 1.8-1
ssh 1:7.4p1-10+deb9u1 ssh 1:7.4p1-10+deb9u1
systemd 232-25+deb9u1 systemd 232-25+deb9u1
systemd-sysv 232-25+deb9u1 systemd-sysv 232-25+deb9u1
sysvinit-utils 2.88dsf-59.9 sysvinit-utils 2.88dsf-59.9
tar 1.29b-1.1 tar 1.29b-1.1
tzdata 2017b-1 tzdata 2017b-1
ucf 3.0036 ucf 3.0036
util-linux 2.29.2-1 util-linux 2.29.2-1
wget 1.18-5+deb9u1 | wget 1.18-5
x11-common 1:7.7+19 <
xauth 1:1.0.9-1+b2 xauth 1:1.0.9-1+b2
> xdg-user-dirs 0.15-2+b1
> xml-core 0.17
zlib1g 1:1.2.8.dfsg-5 zlib1g 1:1.2.8.dfsg-5