![]() Python b.py 3,07s user 0,09s system 75% cpu 4,205 total Python a.py 0,04s user 0,01s system 58% cpu 0,075 total And the "simple" script is faster than the script that uses apt module. It creates dependencies (I do not like that). I think that use modules for some problems is unnecessary. Exec: "man dpkg" and go to "INFORMATION ABOUT PACKAGES" section. You have to read about dpkg packages status. ![]() Packages_installed = re.findall("Package: (.*)\nStatus: install ok installed", status) ![]() With open("/var/lib/dpkg/status", "r") as f: Print 'Upgradeable version of ' + package_name + ' :', Ĭon.execute("update ansible_packagelist set upgradeable_version = %s where package_name = %s", (, package_name)) Print host, package_name + ' is not installed on this system.\n' Print 'Current ' + package_name + ' installed:', Ĭon.execute("insert into ansible_packagelist(date, host, package_name, installed_version) values (current_timestamp,%s,%s,%s)", (host, package_name, ,)) Host = subprocess.Popen('hostname', stdout=subprocess.PIPE, universal_newlines=True).stdout.read().strip() Here is the code I have currently: # For finding the package version and using the package name -i Is there a way for python to show all apt/yum packages installed on a server? I have a program that can only grab one package that I specify but I'd like to know if there is a apt-show-versions/yum check-update like module in python since python-yum and python-apt only do single packages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |