Skip to main content

Updatepackages

The updates the package index has for the host. osapi behavior get --name updatepackages and osapi behavior method get show the same.

Behavior​

Nameupdatepackages
DescriptionThe updates the package index has for the host
Placementnode
Internalno
APIyes
CLIyes
Nextno
Platformsdebian
Sudonone
Runsnone
Writesnone
Keeps stateno
Usesnone
Used bynone

Methods (2)​

NAMEVERBHTTPROUTEPERMISSIONDESCRIPTION
listreadGET/api/node/{hostname}/updatepackagesupdatepackages:readList the packages the index has newer versions of
updatewritePUT/api/node/{hostname}/updatepackagesupdatepackages:writeRefresh the package index

Types (2)​

NAMEINPUTOUTPUT
listListInput[]Available { name, current_version, new_version }
updateUpdateInputResult { changed }

Settings (0)​

None. Declare them with behavior.Config.

Telemetry​

Spanbehavior.updatepackages.<method>
Child spansexec apt-get, exec apt
Metricsosapi_behavior_calls_total, osapi_behavior_duration_seconds, osapi_behavior_changes_total
Attributesosapi.behavior.name, osapi.behavior.method, osapi.behavior.verb, osapi.behavior.outcome, osapi.behavior.changed
Recorded inputsnone

Method list​

Namelist
Verbread
DescriptionList the packages the index has newer versions of
DetailRuns apt list --upgradable: each package with its installed version and the version the index has. Refresh the index first for what the repositories have now.
HTTPGET
Route/api/node/{hostname}/updatepackages
Permissionupdatepackages:read
Commandosapi client node updatepackages list
Input typeListInput
Output type[]Available

Input (0)​

None. The method takes no input; its command needs only --target.

Output (3)​

FIELDTYPEDESCRIPTION
namestringThe package
current_versionstringThe installed version
new_versionstringThe version the index has

Examples (1)​

EXAMPLEINPUTOUTPUT
Two updates(none)[current_version=8.5.0-2ubuntu10, name=curl, new_version=8.5.0-2ubuntu10.1] [current_version=3.0.13-0ubuntu3, name=openssl, new_version=3.0.13-0ubuntu3.1]

Method update​

Nameupdate
Verbwrite
DescriptionRefresh the package index
DetailRuns apt-get update. It reports changed: true when the Release file of a repository under /var/lib/apt/lists changed, and changed: false when each repository was unchanged.
HTTPPUT
Route/api/node/{hostname}/updatepackages
Permissionupdatepackages:write
Commandosapi client node updatepackages update
Input typeUpdateInput
Output typeResult

Input (0)​

None. The method takes no input; its command needs only --target.

Output (1)​

FIELDTYPEDESCRIPTION
changedbooleanWhether the refresh got new index data

Examples (1)​

EXAMPLEINPUTOUTPUT
The repositories are unchanged since the last refresh(none)changed=false