Project

General

Profile

Bug #20691 » json_response.log

Elaad FURREEDAN, 2022-02-02 15:22

 
"documentation": "These methods manage packages using a package manager on the system.\n\n`package_present` and `package_absent` use a new package implementation, different from `package_install_*`,\n`package_remove_*` and `package_verify_*`. It should be more reliable, and handle upgrades better.\nIt is compatible though, and you can call generic methods from both implementations on the same host.\nThe only drawback is that the agent will have to maintain double caches for package lists, which\nmay cause a little unneeded overhead.\n\n#### Package parameters\n\nThere is only one mandatory parameter, which is the package name to install.\nWhen it should be installed from a local package, you need to specify the full path to the package as name.\n\nThe version parameter allows specifying a version you want installed.\nIt should be the complete versions string as used by the used package manager.\nThis parameter allows two special values:\n\n* *any* which is the default value, and is satisfied by any version of the given package\n* *latest* which will ensure, at each run, that the package is at the latest available version.\n\nThe last parameter is the provider, which is documented in the next section.\n\nYou can use [package_state_options](#_package_state_options) to pass options to the underlying package manager\n(currently only with *apt* package manager).\n\n#### Package providers\n\nThis method supports several package managers. You can specify the package manager\nyou want to use or let the method choose the default for the local system.\n\nThe package providers include a caching system for package information.\nThe package lists (installed, available and available updates) are only updated\nwhen the cache expires, or when an operation is made by the agent on packages.\n\n*Note*: The implementation of package operations is done in scripts called modules,\nwhich you can find in `${sys.workdir}/modules/packages/`.\n\n##### apt\n\nThis package provider uses *apt*/*dpkg* to manage packages on the system.\n*dpkg* will be used for all local actions, and *apt* is only needed to manage update and\ninstallation from a repository.\n\n##### rpm\n\nThis package provider uses *yum*/*rpm* to manage packages on the system. *rpm* will \nbe used for all local actions, and *yum* is only needed to manage update and\ninstallation from a repository.\n\nIt is able to downgrade packages when specifying an older version.\n\n##### zypper\n\nThis package provider uses *zypper*/*rpm* to manage packages on the system.\n*rpm* will be used for all local actions, and *zypper* is only needed to manage update and\ninstallation from a repository.\n\nNote: If the package version you want to install contains an epoch, you have to specify it\nin the version in the `epoch:version` form, like reported by `zypper info`.\n\n##### zypper_pattern\n\nThis package provider uses zypper with the `-t pattern` option to manage zypper patterns or\nmeta-packages on the system.\n\nSince a zypper pattern can be named differently than the rpm package name providing it, please\nalways use the exact pattern name (as listed in the output of `zypper patterns`)\nwhen using this provider.\n\nNote: When installing a pattern from a local rpm file, Rudder assumes that the pattern is built\nfollowing the \n[official zypper documentation](https://doc.opensuse.org/projects/libzypp/HEAD/zypp-pattern-packages.html).\n\nOlder implementations of zypper patterns may not be supported by this module.\n\n##### slackpkg\n\nThis package provider uses Slackware's `installpkg` and `upgradepkg` tools to manage \npackages on the system\n\n##### pkg\n\nThis package provider uses FreeBSD's *pkg* to manage packages on the system.\n\n#### Examples\n\n```\n# To install postgresql in version 9.1 for x86_64 architecture\npackage_present(\"postgresql\", \"9.1\", \"x86_64\", \"\");\n# To ensure postgresql is always in the latest available version\npackage_present(\"postgresql\", \"latest\", \"\", \"\");\n# To ensure installing postgresql in any version\npackage_present(\"postgresql\", \"\", \"\", \"\");\n# To ensure installing postgresql in any version, forcing the yum provider\npackage_present(\"postgresql\", \"\", \"\", \"yum\");\n# To ensure installing postgresql from a local package\npackage_present(\"/tmp/postgresql-9.1-1.x86_64.rpm\", \"\", \"\", \"\");\n# To remove postgresql\npackage_absent(\"postgresql\", \"\", \"\", \"\");\n```\n\nSee also : [package_present](#_package_present), [package_absent](#_package_absent), [package_state_options](#_package_state_options)"
(2-2/3)