From 3e5874284c49d371caf20f7304c05d66e2302e01 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 22 Aug 2022 18:24:27 -0400 Subject: [PATCH] Switch to https://github.com/coreos/rpmostree-client-go We have a lot of ad-hoc code in the MCO interacting with rpm-ostree. There's about 50% of it that uses this "NodeUpdaterClient" abstraction which I guess in theory could have tried to also support e.g. traditional dnf/apt systems or whatever, but never did - and its API has grown things that make no sense on those systems (e.g. "staged deployment" etc.) The other half of the code ignores that abstraction (sensibly) and just runs `rpm-ostree` via the CLI directly, crafting command line arguments. We now have https://github.com/coreos/rpmostree-client-go which is intending to be "official" Go bindings which for now just wrap the CLI, but do so in a more consistent way and offering a cleaner API. --- .../firstboot_complete_machineconfig.go | 2 +- cmd/machine-config-daemon/start.go | 1 - go.mod | 5 +- go.sum | 48 ++- pkg/daemon/daemon.go | 17 +- pkg/daemon/daemon_test.go | 2 +- pkg/daemon/rpm-ostree.go | 104 ++---- .../coreos/rpmostree-client-go/LICENSE | 201 ++++++++++++ .../rpmostree-client-go/pkg/client/client.go | 244 ++++++++++++++ .../test-fixtures/fcos-container-status.json | 82 +++++ .../test-fixtures/workstation-status.json | 303 ++++++++++++++++++ .../image-spec/specs-go/v1/descriptor.go | 5 - vendor/modules.txt | 9 +- 13 files changed, 917 insertions(+), 106 deletions(-) create mode 100644 vendor/github.com/coreos/rpmostree-client-go/LICENSE create mode 100644 vendor/github.com/coreos/rpmostree-client-go/pkg/client/client.go create mode 100644 vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/fcos-container-status.json create mode 100644 vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/workstation-status.json diff --git a/cmd/machine-config-daemon/firstboot_complete_machineconfig.go b/cmd/machine-config-daemon/firstboot_complete_machineconfig.go index 64baee9a2b..ee4a38ad0a 100644 --- a/cmd/machine-config-daemon/firstboot_complete_machineconfig.go +++ b/cmd/machine-config-daemon/firstboot_complete_machineconfig.go @@ -31,7 +31,7 @@ func runFirstBootCompleteMachineConfig(_ *cobra.Command, _ []string) error { exitCh := make(chan error) defer close(exitCh) - dn, err := daemon.New(daemon.NewNodeUpdaterClient(), exitCh) + dn, err := daemon.New(exitCh) if err != nil { return err } diff --git a/cmd/machine-config-daemon/start.go b/cmd/machine-config-daemon/start.go index f7bdefdbd1..a1f8e94880 100644 --- a/cmd/machine-config-daemon/start.go +++ b/cmd/machine-config-daemon/start.go @@ -147,7 +147,6 @@ func runStartCmd(cmd *cobra.Command, args []string) { defer close(exitCh) dn, err := daemon.New( - daemon.NewNodeUpdaterClient(), exitCh, ) if err != nil { diff --git a/go.mod b/go.mod index 6deec1fd5d..274389ecc5 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/coreos/ign-converter v0.0.0-20201123214124-8dac862888aa github.com/coreos/ignition v0.35.0 github.com/coreos/ignition/v2 v2.13.0 + github.com/coreos/rpmostree-client-go v0.0.0-20220922143538-78889752c880 github.com/davecgh/go-spew v1.1.1 github.com/fsnotify/fsnotify v1.5.4 github.com/ghodss/yaml v1.0.0 @@ -202,9 +203,9 @@ require ( github.com/nishanths/exhaustive v0.8.1 // indirect github.com/nishanths/predeclared v0.2.2 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect - github.com/opencontainers/image-spec v1.0.3-0.20220811233833-d265d74f4fad // indirect + github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 // indirect github.com/opencontainers/runc v1.1.3 // indirect - github.com/opencontainers/runtime-spec v1.0.3-0.20220809190508-9ee22abf867e // indirect + github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect github.com/pelletier/go-toml v1.9.5 // indirect github.com/pelletier/go-toml/v2 v2.0.2 // indirect github.com/peterbourgon/diskv v2.0.1+incompatible // indirect diff --git a/go.sum b/go.sum index 42b66a77b2..b6be1c56e6 100644 --- a/go.sum +++ b/go.sum @@ -111,6 +111,7 @@ github.com/Microsoft/hcsshim/test v0.0.0-20201218223536-d3e5debf77da/go.mod h1:5 github.com/Microsoft/hcsshim/test v0.0.0-20210227013316-43a75bb4edd3/go.mod h1:mw7qgWloBUl75W/gVH3cQszUg1+gUITj7D6NY7ywVnY= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= +github.com/OpenPeeDeeP/depguard v1.0.1/go.mod h1:xsIw86fROiiwelg+jB2uM9PiKihMMmUx/1V+TNhjQvM= github.com/OpenPeeDeeP/depguard v1.1.0 h1:pjK9nLPS1FwQYGGpPxoMYpe7qACHOhAWQMQzV71i49o= github.com/OpenPeeDeeP/depguard v1.1.0/go.mod h1:JtAMzWkmFEzDPyAd+W0NHl1lvpQKTvT9jnRVsohBKpc= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -145,8 +146,10 @@ github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5 github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/ashanbrown/forbidigo v1.2.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= github.com/ashanbrown/forbidigo v1.3.0 h1:VkYIwb/xxdireGAdJNZoo24O4lmnEWkactplBlWTShc= github.com/ashanbrown/forbidigo v1.3.0/go.mod h1:vVW7PEdqEFqapJe95xHkTfB1+XvZXBFg8t0sG2FIxmI= +github.com/ashanbrown/makezero v0.0.0-20210520155254-b6261585ddde/go.mod h1:oG9Dnez7/ESBqc4EdrdNlryeo7d0KcW1ftXHm7nU/UU= github.com/ashanbrown/makezero v1.1.1 h1:iCQ87C0V0vSyO+M9E/FZYbu65auqH0lnsOkf5FcB28s= github.com/ashanbrown/makezero v1.1.1/go.mod h1:i1bJLCRSCHOcOa9Y6MyF2FTfMZMFdHvxKHxgO5Z1axI= github.com/ashcrow/osrelease v0.0.0-20180626175927-9b292693c55c h1:icme0QhxrgZOxTBnT6K8dfGLwbKWSOVwPB95XTbo8Ws= @@ -171,6 +174,7 @@ github.com/blang/semver v3.5.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnweb github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/blizzy78/varnamelen v0.3.0/go.mod h1:hbwRdBvoBqxk34XyQ6HA0UH3G0/1TKuv5AC4eaBT0Ec= github.com/blizzy78/varnamelen v0.8.0 h1:oqSblyuQvFsW1hbBHh1zfwrKe3kcSj0rnXkKzsQ089M= github.com/blizzy78/varnamelen v0.8.0/go.mod h1:V9TzQZ4fLJ1DSrjVDfl89H7aMnTvKkApdHeyESmyR7k= github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4= @@ -178,6 +182,7 @@ github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx2 github.com/bombsimon/wsl/v3 v3.3.0 h1:Mka/+kRLoQJq7g2rggtgQsjuI/K5Efd87WX96EWFxjM= github.com/bombsimon/wsl/v3 v3.3.0/go.mod h1:st10JtZYLE4D5sC7b8xV4zTKZwAQjCH/Hy2Pm1FNZIc= github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b/go.mod h1:H0wQNHz2YrLsuXOZozoeDmnHXkNCRmMW0gwFWDfEZDA= +github.com/breml/bidichk v0.1.1/go.mod h1:zbfeitpevDUGI7V91Uzzuwrn4Vls8MoBMrwtt78jmso= github.com/breml/bidichk v0.2.3 h1:qe6ggxpTfA8E75hdjWPZ581sY3a2lnl0IRxLQFelECI= github.com/breml/bidichk v0.2.3/go.mod h1:8u2C6DnAy0g2cEq+k/A2+tr9O1s+vHGxWn0LTc70T2A= github.com/breml/errchkjson v0.3.0 h1:YdDqhfqMT+I1vIxPSas44P+9Z9HzJwCeAzjB8PxP1xw= @@ -355,6 +360,8 @@ github.com/coreos/ignition/v2 v2.13.0/go.mod h1:HO1HWYWcvAIbHu6xewoKxPGBTyZ32FLw github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180108230652-97fdf19511ea/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/coreos/rpmostree-client-go v0.0.0-20220922143538-78889752c880 h1:8Nwzb7xZKIKaDEwPtHw27k37wtBIcwv4cYS36zCeMs0= +github.com/coreos/rpmostree-client-go v0.0.0-20220922143538-78889752c880/go.mod h1:T6iJ0ibMfIB/4LagkckS90meGF3YrPzSPP4wLva+5PY= github.com/coreos/vcontext v0.0.0-20190529201340-22b159166068/go.mod h1:E+6hug9bFSe0KZ2ZAzr8M9F5JlArJjv5D1JS7KSkPKE= github.com/coreos/vcontext v0.0.0-20191017033345-260217907eb5/go.mod h1:E+6hug9bFSe0KZ2ZAzr8M9F5JlArJjv5D1JS7KSkPKE= github.com/coreos/vcontext v0.0.0-20211021162308-f1dbbca7bef4 h1:pfSsrvbjUFGINaPGy0mm2QKQKTdq7IcbUa+nQwsz2UM= @@ -385,6 +392,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/denis-tingaikin/go-header v0.4.3 h1:tEaZKAlqql6SKCY++utLmkPLd6K8IBM20Ha7UVm+mtU= github.com/denis-tingaikin/go-header v0.4.3/go.mod h1:0wOCWuN71D5qIgE2nz9KrKmuYBAC2Mra5RassOIQ2/c= +github.com/denis-tingajkin/go-header v0.4.2/go.mod h1:eLRHAVXzE5atsKAnNRDB90WHCFFnBUn4RN0nRcs1LJA= github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8lFg6daOBZbT6/BDGIz6Y3WFGn8juu6G+CQ6LHtl0= github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= @@ -436,6 +444,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.m github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.mod h1:hliV/p42l8fGbc6Y9bQ70uLwIvmJyVE5k4iMKlh8wCQ= github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go.mod h1:KJwIaB5Mv44NWtYuAOFCVOjcI94vtpEz2JU/D2v6IjE= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/esimonov/ifshort v1.0.3/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+M1LBpeZE= github.com/esimonov/ifshort v1.0.4 h1:6SID4yGWfRae/M7hkVDVVyppy8q/v9OuxNdmjLQStBA= github.com/esimonov/ifshort v1.0.4/go.mod h1:Pe8zjlRrJ80+q2CxHLfEOfTwxCZ4O+MuhcHcfgNWTk0= github.com/ettle/strcase v0.1.1 h1:htFueZyVeE1XNnMEfbqp5r67qAN/4r6ya1ysq8Q+Zcw= @@ -497,6 +506,8 @@ github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/zapr v1.2.3 h1:a9vnzlIBPQBBkeaR9IuMUfmVOrQlkoC4YfPoFkX3T7A= github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM= +github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= +github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= github.com/go-openapi/analysis v0.18.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= @@ -562,12 +573,15 @@ github.com/go-toolsmith/astequal v1.0.2 h1:+XvaV8zNxua+9+Oa4AHmgmpo4RYAbwr/qjNpp github.com/go-toolsmith/astequal v1.0.2/go.mod h1:9Ai4UglvtR+4up+bAD4+hCj7iTo4m/OXVTSLnCyTAx4= github.com/go-toolsmith/astfmt v1.0.0 h1:A0vDDXt+vsvLEdbMFJAUBI/uTbRw1ffOPnxsILnFL6k= github.com/go-toolsmith/astfmt v1.0.0/go.mod h1:cnWmsOAuq4jJY6Ct5YWlVLmcmLMn1JUPuQIHCY7CJDw= +github.com/go-toolsmith/astinfo v0.0.0-20180906194353-9809ff7efb21/go.mod h1:dDStQCHtmZpYOmjRP/8gHHnCCch3Zz3oEgCdZVdtweU= github.com/go-toolsmith/astp v1.0.0 h1:alXE75TXgcmupDsMK1fRAy0YUzLzqPVvBKoyWV+KPXg= github.com/go-toolsmith/astp v1.0.0/go.mod h1:RSyrtpVlfTFGDYRbrjyWP1pYu//tSFcvdYrA8meBmLI= +github.com/go-toolsmith/pkgload v1.0.0/go.mod h1:5eFArkbO80v7Z0kdngIxsRXRMTaX4Ilcwuh3clNrQJc= github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5 h1:eD9POs68PHkwrx7hAB78z1cb6PfGq/jyWn3wJywsH1o= github.com/go-toolsmith/pkgload v1.0.2-0.20220101231613-e814995d17c5/go.mod h1:3NAwwmD4uY/yggRxoEjk/S00MIV3A+H7rrE3i87eYxM= github.com/go-toolsmith/strparse v1.0.0 h1:Vcw78DnpCAKlM20kSbAyO4mPfJn/lyYA4BJUDxe2Jb4= github.com/go-toolsmith/strparse v1.0.0/go.mod h1:YI2nUKP9YGZnL/L1/DLFBfixrcjslWct4wyljWhSRy8= +github.com/go-toolsmith/typep v1.0.0/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-toolsmith/typep v1.0.2 h1:8xdsa1+FSIH/RhEkgnD1j2CJOy5mNllW1Q9tRiYwvlk= github.com/go-toolsmith/typep v1.0.2/go.mod h1:JSQCQMUPdRlMZFswiq3TGpNp1GMktqkR2Ns5AIQkATU= github.com/go-xmlfmt/xmlfmt v0.0.0-20191208150333-d5b6f63a941b h1:khEcpUM4yFcxg4/FHQWkvVRmgijNXRfzkIDHh23ggEo= @@ -630,6 +644,7 @@ github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2 h1:23T5iq8rbUYlhpt5 github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2/go.mod h1:k9Qvh+8juN+UKMCS/3jFtGICgW8O96FVaZsaxdzDkR4= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a h1:w8hkcTqaFpzKqonE9uMCefW1WDie15eSP/4MssdenaM= github.com/golangci/dupl v0.0.0-20180902072040-3e9179ac440a/go.mod h1:ryS0uhF+x9jgbj/N71xsEqODy9BN81/GonCZiOzirOk= +github.com/golangci/go-misc v0.0.0-20180628070357-927a3d87b613/go.mod h1:SyvUF2NxV+sN8upjjeVYr5W7tyxaT1JVtvhKhOn2ii8= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe h1:6RGUuS7EGotKx6J5HIP8ZtyMdiDscjMLfRBSPuzVVeo= github.com/golangci/go-misc v0.0.0-20220329215616-d24fe342adfe/go.mod h1:gjqyPShc/m8pEMpk0a3SeagVb0kaqvhscv+i9jI5ZhQ= github.com/golangci/gofmt v0.0.0-20190930125516-244bba706f1a h1:iR3fYXUjHCR97qWS8ch1y9zPNsgXThGwjKPrYfqMPks= @@ -721,18 +736,21 @@ github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad github.com/gostaticanalysis/analysisutil v0.0.0-20190318220348-4088753ea4d3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.0.3/go.mod h1:eEOZF4jCKGi+aprrirO9e7WKB3beBRtWgqGunKl6pKE= github.com/gostaticanalysis/analysisutil v0.1.0/go.mod h1:dMhHRU9KTiDcuLGdy87/2gTR8WruwYZrKdRq9m1O6uw= +github.com/gostaticanalysis/analysisutil v0.4.1/go.mod h1:18U/DLpRgIUd459wGxVHE0fRgmo1UgHDcbw7F5idXu0= github.com/gostaticanalysis/analysisutil v0.7.1 h1:ZMCjoue3DtDWQ5WyU16YbjbQEQ3VuzwxALrpYd+HeKk= github.com/gostaticanalysis/analysisutil v0.7.1/go.mod h1:v21E3hY37WKMGSnbsw2S/ojApNWb6C1//mXO48CXbVc= github.com/gostaticanalysis/comment v1.3.0/go.mod h1:xMicKDx7XRXYdVwY9f9wQpDJVnqWxw9wCauCMKp+IBI= github.com/gostaticanalysis/comment v1.4.1/go.mod h1:ih6ZxzTHLdadaiSnF5WY3dxUoXfXAlTaRzuaNDlSado= github.com/gostaticanalysis/comment v1.4.2 h1:hlnx5+S2fY9Zo9ePo4AhgYsYHbM2+eAv8m/s1JiCd6Q= github.com/gostaticanalysis/comment v1.4.2/go.mod h1:KLUTGDv6HOCotCH8h2erHKmpci2ZoR8VPu34YA2uzdM= +github.com/gostaticanalysis/forcetypeassert v0.0.0-20200621232751-01d4955beaa5/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= github.com/gostaticanalysis/forcetypeassert v0.1.0 h1:6eUflI3DiGusXGK6X7cCcIgVCpZ2CiZ1Q7jl6ZxNV70= github.com/gostaticanalysis/forcetypeassert v0.1.0/go.mod h1:qZEedyP/sY1lTGV1uJ3VhWZ2mqag3IkWsDHVbplHXak= github.com/gostaticanalysis/nilerr v0.1.1 h1:ThE+hJP0fEp4zWLkWHWcRyI2Od0p7DlgYG3Uqrmrcpk= github.com/gostaticanalysis/nilerr v0.1.1/go.mod h1:wZYb6YI5YAxxq0i1+VJbY0s2YONW0HU0GPE3+5PWN4A= github.com/gostaticanalysis/testutil v0.3.1-0.20210208050101-bfb5c8eec0e4/go.mod h1:D+FIZ+7OahH3ePw/izIEeH5I06eKs1IKI4Xr64/Am3M= github.com/gostaticanalysis/testutil v0.4.0 h1:nhdCmubdmDF6VEatUNjgUZBJKWRqugoISdUv3PPQgHY= +github.com/gostaticanalysis/testutil v0.4.0/go.mod h1:bLIoPefWXrRi/ssLFWX1dx7Repi5x3CuviD3dgAZaBU= github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 h1:+ngKgrYPPJrOjhax5N+uePQ0Fh1Z7PheYoUI/0nzkPA= github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= @@ -794,6 +812,7 @@ github.com/joefitzgerald/rainbow-reporter v0.1.0/go.mod h1:481CNgqmVHQZzdIbN52Cu github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/josharian/txtarfs v0.0.0-20210218200122-0702f000015a/go.mod h1:izVPOvVRsHiKkeGCT6tYBNWyDVuzj9wAaBb5R9qamfw= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/json-iterator/go v0.0.0-20180612202835-f2b4162afba3/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -809,6 +828,7 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/julz/importas v0.0.0-20210419104244-841f0c0fe66d/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/julz/importas v0.1.0 h1:F78HnrsjY3cR7j0etXy5+TU1Zuy7Xt08X/1aJnH5xXY= github.com/julz/importas v0.1.0/go.mod h1:oSFU2R4XK/P7kNBrnL/FEQlDGN1/6WoxXEjSSXO0DV0= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -820,6 +840,8 @@ github.com/kisielk/gotool v1.0.0 h1:AV2c/EiW3KqPNT9ZKl07ehoAGi4C5/01Cfbblndcapg= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.11.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.5/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk= github.com/klauspost/compress v1.15.7/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQanqjSY= github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= @@ -845,8 +867,10 @@ github.com/kunwardeep/paralleltest v1.0.6 h1:FCKYMF1OF2+RveWlABsdnmsvJrei5aoyZoa github.com/kunwardeep/paralleltest v1.0.6/go.mod h1:Y0Y0XISdZM5IKm3TREQMZ6iteqn1YuwCsJO/0kL9Zes= github.com/kyoh86/exportloopref v0.1.8 h1:5Ry/at+eFdkX9Vsdw3qU4YkvGtzuVfzT4X7S77LoN/M= github.com/kyoh86/exportloopref v0.1.8/go.mod h1:1tUcJeiioIs7VWe5gcOObrux3lb66+sBqGZrRkMwPgg= +github.com/ldez/gomoddirectives v0.2.2/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= github.com/ldez/gomoddirectives v0.2.3 h1:y7MBaisZVDYmKvt9/l1mjNCiSA1BVn34U0ObUcJwlhA= github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdBr6g8G04uz6d0= +github.com/ldez/tagliatelle v0.2.0/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/ldez/tagliatelle v0.3.1 h1:3BqVVlReVUZwafJUwQ+oxbx2BEX2vUG4Yu/NOfMiKiM= github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leonklingele/grouper v1.1.0 h1:tC2y/ygPbMFSBOs3DcyaEMKnnwH7eYKzohOtRrf0SAg= @@ -896,6 +920,7 @@ github.com/mattn/go-shellwords v1.0.3/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vq github.com/mattn/go-shellwords v1.0.6/go.mod h1:3xCvwCdWdlDJUrvuMn7Wuy9eWs4pE8vqg+NOMyg4B2o= github.com/mattn/go-shellwords v1.0.12/go.mod h1:EZzvwXDESEeg03EKmM+RmDnNOPKG4lLtQsUlTZDWQ8Y= github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -995,8 +1020,8 @@ github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3I github.com/opencontainers/image-spec v1.0.0/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/image-spec v1.0.3-0.20220811233833-d265d74f4fad h1:qowdM64wsSS85kue4GbaR0JeRDJTPkf01Y0Z1JfvXVM= -github.com/opencontainers/image-spec v1.0.3-0.20220811233833-d265d74f4fad/go.mod h1:K/JAU0m27RFhDRX4PcFdIKntROP6y5Ed6O91aZYDQfs= +github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 h1:+czc/J8SlhPKLOtVLMQc+xDCFBT73ZStMsRhSsUhsSg= +github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198/go.mod h1:j4h1pJW6ZcJTgMZWP3+7RlG3zTaP02aDZ/Qw0sppK7Q= github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc8.0.20190926000215-3e425f80a8c9/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= @@ -1100,6 +1125,7 @@ github.com/quasilyte/go-ruleguard v0.3.17/go.mod h1:sST5PvaR7yb/Az5ksX8oc88usJ4E github.com/quasilyte/go-ruleguard/dsl v0.3.0/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/dsl v0.3.21/go.mod h1:KeCP03KrjuSO0H1kTuZQCWlQPulDV6YMIXmpQss17rU= github.com/quasilyte/go-ruleguard/rules v0.0.0-20201231183845-9e62ed36efe1/go.mod h1:7JTjp89EGyU1d6XfBiXihJNG37wB2VRkd125Q1u7Plc= +github.com/quasilyte/go-ruleguard/rules v0.0.0-20210428214800-545e0d2e0bf7/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= github.com/quasilyte/go-ruleguard/rules v0.0.0-20211022131956-028d6511ab71/go.mod h1:4cgAphtvu7Ftv7vOT2ZOYhC6CvBxZixcasr8qIOTA50= github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5 h1:PDWGei+Rf2bBiuZIbZmM20J2ftEy9IeUCHA8HbQqed8= github.com/quasilyte/gogrep v0.0.0-20220120141003-628d8b3623b5/go.mod h1:wSEyW6O61xRV6zb6My3HxrQ5/8ke7NE2OayqCHa3xRM= @@ -1114,6 +1140,7 @@ github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6So github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-charset v0.0.0-20180617210344-2471d30d28b4/go.mod h1:qgYeAmZ5ZIpBWTGllZSQnw97Dj+woV0toclVaRGI8pc= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1 h1:geMPLpDpQOgVyCg5z5GoRwLHepNdb71NXb67XFkP+Eg= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday v1.6.0 h1:KqfZb0pUVN2lYqZUYRddxF4OR8ZMURnJIG5Y3VRLtww= @@ -1142,6 +1169,7 @@ github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c h1:W65qqJCIOVP4jpqPQ0YvHYKwcMEMVWIzWC5iNQQfBTU= github.com/shazow/go-diff v0.0.0-20160112020656-b6b7b6733b8c/go.mod h1:/PevMnwAxekIXwN8qQyfc5gl2NlkB3CQlkizAbOkeBs= github.com/shirou/gopsutil v2.18.12+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= +github.com/shirou/gopsutil/v3 v3.21.10/go.mod h1:t75NhzCZ/dYyPQjyQmrAYP6c8+LCdFANeBMdLPCNnew= github.com/shurcooL/go v0.0.0-20180423040247-9e1955d9fb6e/go.mod h1:TDJrrUr11Vxrven61rcy3hJMUqaf/CLWYhHNPmT14Lk= github.com/shurcooL/go-goon v0.0.0-20170922171312-37c2f522c041/go.mod h1:N5mDOmsrJOB+vfqUK+7DmDyjhSLIIBnXo9lvZJj3MWQ= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= @@ -1233,6 +1261,7 @@ github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 h1:kdXcSzyDtse github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= github.com/tchap/go-patricia v2.2.6+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= github.com/tchap/go-patricia v2.3.0+incompatible/go.mod h1:bmLyhP68RS6kStMGxByiQ23RP/odRBOTVjwp2cDyi6I= +github.com/tdakkota/asciicheck v0.0.0-20200416200610-e657995f937b/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tdakkota/asciicheck v0.1.1 h1:PKzG7JUTUmVspQTDqtkX9eSiLGossXTybutHwTXuO0A= github.com/tdakkota/asciicheck v0.1.1/go.mod h1:yHp0ai0Z9gUljN3o0xMhYJnH/IcvkdTBOX2fmJ93JEM= github.com/tenntenn/modver v1.0.1 h1:2klLppGhDgzJrScMpkj9Ujy3rXPUspSjAcev9tSEBgA= @@ -1244,12 +1273,15 @@ github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaE github.com/theupdateframework/go-tuf v0.3.1 h1:NkjMlCuLcDpHNtsWXY4lTmbbQQ5nOM7JSBbOKEEiI1c= github.com/theupdateframework/go-tuf v0.3.1/go.mod h1:lhHZ3Vt2pdAh15h0Cc6gWdlI+Okn2ZznD3q/cNjd5jw= github.com/tidwall/pretty v1.0.0/go.mod h1:XNkn88O1ChpSDQmQeStsy+sBenx6DDtFZJxhVysOjyk= +github.com/timakin/bodyclose v0.0.0-20200424151742-cb6215831a94/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144 h1:kl4KhGNsJIbDHS9/4U9yQo1UcPQM0kOMJHn29EoH/Ro= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/timonwong/logrlint v0.1.0 h1:phZCcypL/vtx6cGxObJgWZ5wexZF5SXFPLOM+ru0e/M= github.com/timonwong/logrlint v0.1.0/go.mod h1:Zleg4Gw+kRxNej+Ra7o+tEaW5k1qthTaYKU7rSD39LU= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399 h1:e/5i7d4oYZ+C1wj2THlRK+oAhjeS/TRQwMfkIuet3w0= github.com/titanous/rocacheck v0.0.0-20171023193734-afe73141d399/go.mod h1:LdwHTNJT99C5fTAzDz0ud328OgXz+gierycbcIx2fRs= +github.com/tklauser/go-sysconf v0.3.9/go.mod h1:11DU/5sG7UexIrp/O6g35hrWzu0JxlwQ3LSFUzyeuhs= +github.com/tklauser/numcpus v0.3.0/go.mod h1:yFGUr7TUHQRAhyqBcEg0Ge34zDBAsIvJJcyE6boqnA8= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tomarrell/wrapcheck/v2 v2.6.2 h1:3dI6YNcrJTQ/CJQ6M/DUkc0gnqYSIk6o0rChn9E/D0M= @@ -1262,6 +1294,7 @@ github.com/ulikunitz/xz v0.5.10 h1:t92gobL9l3HE202wg3rlk19F6X+JOxl9BBrCCMYEYd8= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ultraware/funlen v0.0.3 h1:5ylVWm8wsNwH5aWo9438pwvsK0QiqVuUrt9bn7S/iLA= github.com/ultraware/funlen v0.0.3/go.mod h1:Dp4UiAus7Wdb9KUZsYWZEWiRzGuM2kXM1lPbfaF6xhA= +github.com/ultraware/whitespace v0.0.4/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/ultraware/whitespace v0.0.5 h1:hh+/cpIcopyMYbZNVov9iSxvJU3OYQg78Sfaqzi/CzI= github.com/ultraware/whitespace v0.0.5/go.mod h1:aVMh/gQve5Maj9hQ/hg+F75lr/X5A89uZnzAmWSineA= github.com/urfave/cli v0.0.0-20171014202726-7bc6a0acffa5/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= @@ -1302,6 +1335,7 @@ github.com/xlab/treeprint v1.1.0/go.mod h1:gj5Gd3gPdKtR1ikdDK6fnFLdmIS0X30kTTuNd github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yagipy/maintidx v1.0.0 h1:h5NvIsCz+nRDapQ0exNv4aJ0yXSI0420omVANTv3GJM= github.com/yagipy/maintidx v1.0.0/go.mod h1:0qNf/I/CCZXSMhsRsrEPDZ+DkekpKLXAJfsTACwgXLk= +github.com/yeya24/promlinter v0.1.0/go.mod h1:rs5vtZzeBHqqMwXqFScncpCF6u06lezhZepno9AB1Oc= github.com/yeya24/promlinter v0.2.0 h1:xFKDQ82orCU5jQujdaD8stOHiv8UN68BSdn2a8u8Y3o= github.com/yeya24/promlinter v0.2.0/go.mod h1:u54lkmBOZrpEbQQ6gox2zWKKLKu2SGe+2KOiextY+IA= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1376,6 +1410,8 @@ golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa h1:zuSxTR4o9y82ebqCUJYNGJbGPo6sKVl54f/TVDObg1c= @@ -1421,6 +1457,7 @@ golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= @@ -1641,6 +1678,7 @@ golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGm golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181011042414-1f849cf54d09/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190110163146-51295c7ec13a/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190125232054-d66bd3c5d5a6/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1717,10 +1755,15 @@ golang.org/x/tools v0.0.0-20200916195026-c9a70fc28ce3/go.mod h1:z6u4i615ZeAfBE4X golang.org/x/tools v0.0.0-20201001104356-43ebab892c4c/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201002184944-ecd9fd270d5d/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/tools v0.0.0-20201023174141-c8cfbd0f21e6/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201028025901-8cd080b735b3/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201114224030-61ea331ec02b/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20201118003311-bd56c0adb394/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201230224404-63754364767c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210101214203-2dba1e4ea05c/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.0.0-20210104081019-d8d6ddbec6ee/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -2010,6 +2053,7 @@ modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk= modernc.org/mathutil v1.0.0/go.mod h1:wU0vUrJsVWBZ4P6e7xtFJEhFSNsfRLJ8H458uRjg03k= modernc.org/strutil v1.0.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs= modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I= +mvdan.cc/gofumpt v0.1.1/go.mod h1:yXG1r1WqZVKWbVRtBWKWX9+CxGYfA51nSomhM0woR48= mvdan.cc/gofumpt v0.3.1 h1:avhhrOmv0IuvQVK7fvwV91oFSGAk5/6Po8GXTzICeu8= mvdan.cc/gofumpt v0.3.1/go.mod h1:w3ymliuxvzVx8DAutBnVyDqYb1Niy/yCJt/lk821YCE= mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed h1:WX1yoOaKQfddO/mLzdV4wptyWgoH/6hwLs7QHTixo0I= diff --git a/pkg/daemon/daemon.go b/pkg/daemon/daemon.go index 4b38d4c482..eccc125811 100644 --- a/pkg/daemon/daemon.go +++ b/pkg/daemon/daemon.go @@ -33,6 +33,7 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/util/workqueue" + rpmostreeclient "github.com/coreos/rpmostree-client-go/pkg/client" configv1 "github.com/openshift/api/config/v1" mcoResourceRead "github.com/openshift/machine-config-operator/lib/resourceread" mcfgv1 "github.com/openshift/machine-config-operator/pkg/apis/machineconfiguration.openshift.io/v1" @@ -55,8 +56,11 @@ type Daemon struct { // mock is set if we're running as non-root, probably under unit tests mock bool - // NodeUpdaterClient an instance of the client which interfaces with host content deployments - NodeUpdaterClient NodeUpdaterClient + // NodeUpdaterClient wraps rpm-ostree and will eventually be removed with a direct rpmostreeclient value + NodeUpdaterClient *RpmOstreeClient + + // rpmostree is set if the host is an rpm-ostree based system + rpmostree *rpmostreeclient.Client // bootID is a unique value per boot (generated by the kernel) bootID string @@ -202,7 +206,6 @@ func getBootID() (string, error) { // New sets up the systemd and kubernetes connections needed to update the // machine. func New( - nodeUpdaterClient NodeUpdaterClient, exitCh chan<- error, ) (*Daemon, error) { mock := false @@ -226,8 +229,12 @@ func New( } } + var nodeUpdaterClient *RpmOstreeClient + // Only pull the osImageURL from OSTree when we are on RHCOS or FCOS if hostos.IsCoreOSVariant() { + nodeUpdaterClientVal := NewNodeUpdaterClient() + nodeUpdaterClient = &nodeUpdaterClientVal err := nodeUpdaterClient.Initialize() if err != nil { return nil, fmt.Errorf("error initializing rpm-ostree: %w", err) @@ -1289,11 +1296,11 @@ func (dn *Daemon) getStateAndConfigs(pendingConfigName string) (*stateAndConfigs func (dn *Daemon) LogSystemData() { // Print status if available if dn.os.IsCoreOSVariant() { - status, err := dn.NodeUpdaterClient.GetStatus() + out, err := runGetOut("rpm-ostree", "status") if err != nil { glog.Fatalf("unable to get rpm-ostree status: %s", err) } - glog.Info(status) + glog.Info(out) logProvisioningInformation() } diff --git a/pkg/daemon/daemon_test.go b/pkg/daemon/daemon_test.go index 991c551e45..8a46cd90a3 100644 --- a/pkg/daemon/daemon_test.go +++ b/pkg/daemon/daemon_test.go @@ -144,7 +144,7 @@ func (f *fixture) newController() *Daemon { i := informers.NewSharedInformerFactory(f.client, noResyncPeriodFunc()) k8sI := kubeinformers.NewSharedInformerFactory(f.kubeclient, noResyncPeriodFunc()) - d, err := New(NewNodeUpdaterClient(), nil) + d, err := New(nil) if err != nil { f.t.Fatalf("can't bring up daemon: %v", err) } diff --git a/pkg/daemon/rpm-ostree.go b/pkg/daemon/rpm-ostree.go index bca0ad4e17..53d55e7f2e 100644 --- a/pkg/daemon/rpm-ostree.go +++ b/pkg/daemon/rpm-ostree.go @@ -11,6 +11,7 @@ import ( "time" "github.com/containers/image/v5/types" + rpmostreeclient "github.com/coreos/rpmostree-client-go/pkg/client" "github.com/golang/glog" "github.com/opencontainers/go-digest" pivotutils "github.com/openshift/machine-config-operator/pkg/daemon/pivot/utils" @@ -24,31 +25,6 @@ const ( kubeletAuthFile = "/var/lib/kubelet/config.json" ) -// rpmOstreeState houses zero or more RpmOstreeDeployments -// Subset of `rpm-ostree status --json` -// https://github.com/projectatomic/rpm-ostree/blob/bce966a9812df141d38e3290f845171ec745aa4e/src/daemon/rpmostreed-deployment-utils.c#L227 -type rpmOstreeState struct { - Deployments []RpmOstreeDeployment - Transaction *[]string -} - -// RpmOstreeDeployment represents a single deployment on a node -type RpmOstreeDeployment struct { - ID string `json:"id"` - OSName string `json:"osname"` - Serial int32 `json:"serial"` - Checksum string `json:"checksum"` - BaseChecksum string `json:"base-checksum,omitempty"` - Version string `json:"version"` - Timestamp uint64 `json:"timestamp"` - Booted bool `json:"booted"` - Staged bool `json:"staged"` - LiveReplaced string `json:"live-replaced,omitempty"` - Origin string `json:"origin"` - CustomOrigin []string `json:"custom-origin"` - ContainerImageReference string `json:"container-image-reference"` -} - // imageInspection is a public implementation of // https://github.com/containers/skopeo/blob/82186b916faa9c8c70cfa922229bafe5ae024dec/cmd/skopeo/inspect.go#L20-L31 type imageInspection struct { @@ -64,27 +40,19 @@ type imageInspection struct { Layers []string } -// NodeUpdaterClient is an interface describing how to interact with the host -// around content deployment -type NodeUpdaterClient interface { - Initialize() error - GetStatus() (string, error) - GetBootedOSImageURL() (string, string, string, error) - Rebase(string, string) (bool, error) - RebaseLayered(string) error - IsBootableImage(string) (bool, error) - GetBootedAndStagedDeployment() (*RpmOstreeDeployment, *RpmOstreeDeployment, error) -} - // RpmOstreeClient provides all RpmOstree related methods in one structure. // This structure implements DeploymentClient // // TODO(runcom): make this private to pkg/daemon!!! -type RpmOstreeClient struct{} +type RpmOstreeClient struct { + client rpmostreeclient.Client +} -// NewNodeUpdaterClient returns a new instance of the default DeploymentClient (RpmOstreeClient) -func NewNodeUpdaterClient() NodeUpdaterClient { - return &RpmOstreeClient{} +// NewNodeUpdaterClient is a wrapper to create an RpmOstreeClient +func NewNodeUpdaterClient() RpmOstreeClient { + return RpmOstreeClient{ + client: rpmostreeclient.NewClient("machine-config-daemon"), + } } // Synchronously invoke rpm-ostree, writing its stdout to our stdout, @@ -94,20 +62,6 @@ func runRpmOstree(args ...string) error { return runCmdSync("rpm-ostree", args...) } -func (r *RpmOstreeClient) loadStatus() (*rpmOstreeState, error) { - var rosState rpmOstreeState - output, err := runGetOut("rpm-ostree", "status", "--json") - if err != nil { - return nil, err - } - - if err := json.Unmarshal(output, &rosState); err != nil { - return nil, fmt.Errorf("failed to parse `rpm-ostree status --json` output (%s): %w", truncate(string(output), 30), err) - } - - return &rosState, nil -} - // See https://bugzilla.redhat.com/show_bug.cgi?id=2111817 func bug2111817Workaround() error { targetUnit := "/run/systemd/system/rpm-ostreed.service.d/bug2111817.conf" @@ -147,15 +101,19 @@ func (r *RpmOstreeClient) Initialize() error { return nil } +func (r *RpmOstreeClient) Peel() *rpmostreeclient.Client { + return &r.client +} + // GetBootedDeployment returns the current deployment found -func (r *RpmOstreeClient) GetBootedAndStagedDeployment() (booted, staged *RpmOstreeDeployment, err error) { - status, err := r.loadStatus() +func (r *RpmOstreeClient) GetBootedAndStagedDeployment() (booted, staged *rpmostreeclient.Deployment, err error) { + status, err := r.client.QueryStatus() if err != nil { return nil, nil, err } - booted, err = status.getBootedDeployment() - staged = status.getStagedDeployment() + booted, err = status.GetBootedDeployment() + staged = status.GetStagedDeployment() return } @@ -201,13 +159,7 @@ func (r *RpmOstreeClient) GetBootedOSImageURL() (string, string, string, error) } } - // BaseChecksum is populated if the system has been modified in a way that changes the base checksum - // (like via an RPM install) so prefer BaseCheksum that if it's present, otherwise just use Checksum. - baseChecksum := bootedDeployment.Checksum - if bootedDeployment.BaseChecksum != "" { - baseChecksum = bootedDeployment.BaseChecksum - } - + baseChecksum := bootedDeployment.GetBaseChecksum() return osImageURL, bootedDeployment.Version, baseChecksum, nil } @@ -457,23 +409,3 @@ func runGetOut(command string, args ...string) ([]byte, error) { } return rawOut, nil } - -func (state *rpmOstreeState) getBootedDeployment() (*RpmOstreeDeployment, error) { - for num := range state.Deployments { - deployment := state.Deployments[num] - if deployment.Booted { - return &deployment, nil - } - } - return &RpmOstreeDeployment{}, fmt.Errorf("not currently booted in a deployment") -} - -func (state *rpmOstreeState) getStagedDeployment() *RpmOstreeDeployment { - for num := range state.Deployments { - deployment := state.Deployments[num] - if deployment.Staged { - return &deployment - } - } - return &RpmOstreeDeployment{} -} diff --git a/vendor/github.com/coreos/rpmostree-client-go/LICENSE b/vendor/github.com/coreos/rpmostree-client-go/LICENSE new file mode 100644 index 0000000000..261eeb9e9f --- /dev/null +++ b/vendor/github.com/coreos/rpmostree-client-go/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/vendor/github.com/coreos/rpmostree-client-go/pkg/client/client.go b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/client.go new file mode 100644 index 0000000000..cd77af7892 --- /dev/null +++ b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/client.go @@ -0,0 +1,244 @@ +package client + +import ( + "encoding/json" + "fmt" + "os/exec" + "strconv" + "strings" + + "github.com/containers/image/v5/docker/reference" + yaml "gopkg.in/yaml.v3" +) + +// Status summarizes the current worldview of the rpm-ostree daemon. +// The deployment list is the primary data. +type Status struct { + // Deployments is the list of bootable filesystem trees. + Deployments []Deployment + // Transaction is the active transaction, if any. + Transaction *[]string +} + +// Deployment represents a bootable filesystem tree +type Deployment struct { + ID string `json:"id"` + OSName string `json:"osname"` + Serial int32 `json:"serial"` + BaseChecksum *string `json:"base-checksum"` + Checksum string `json:"checksum"` + Version string `json:"version"` + Timestamp uint64 `json:"timestamp"` + Booted bool `json:"booted"` + Staged bool `json:"staged"` + LiveReplaced string `json:"live-replaced,omitempty"` + Origin string `json:"origin"` + CustomOrigin []string `json:"custom-origin"` + ContainerImageReference string `json:"container-image-reference"` +} + +// Client is a handle for interacting with an rpm-ostree based system. +type Client struct { + clientid string +} + +// NewClient creates a new rpm-ostree client. The client identifier should be a short, unique and ideally machine-readable string. +// This could be as simple as `examplecorp-management-agent`. +// If you want to be more verbose, you could use a URL, e.g. `https://gitlab.com/examplecorp/management-agent`. +func NewClient(id string) Client { + return Client{ + clientid: id, + } +} + +func (client *Client) newCmd(args ...string) *exec.Cmd { + r := exec.Command("rpm-ostree", args...) + r.Env = append(r.Env, "RPMOSTREE_CLIENT_ID", client.clientid) + return r +} + +func (client *Client) run(args ...string) error { + c := client.newCmd(args...) + return c.Run() +} + +// VersionData represents the static information about rpm-ostree. +type VersionData struct { + Version string `yaml:"Version"` + Features []string `yaml:"Features"` + Git string `yaml:"Git"` +} + +type rpmOstreeVersionData struct { + Root VersionData `yaml:"rpm-ostree"` +} + +// RpmOstreeVersion returns the running rpm-ostree version number +func (client *Client) RpmOstreeVersion() (*VersionData, error) { + c := client.newCmd("--version") + buf, err := c.Output() + if err != nil { + return nil, err + } + + var q rpmOstreeVersionData + if err := yaml.Unmarshal(buf, &q); err != nil { + return nil, fmt.Errorf("failed to parse `rpm-ostree --version` output: %w", err) + } + + return &q.Root, nil +} + +func compareVersionStrings(required, actual string) (bool, error) { + verparts := strings.Split(actual, ".") + verlen := len(verparts) + requiredparts := strings.Split(required, ".") + for i, req := range requiredparts { + if i >= verlen { + break + } + reqv, err := strconv.Atoi(req) + if err != nil { + return false, err + } + actualv, err := strconv.Atoi(verparts[i]) + if err != nil { + return false, err + } + if actualv < reqv { + return false, nil + } + } + return true, nil +} + +// RpmOstreeVersionEqualOrGreater checks whether the version of rpm-ostree is new enough. +func (client *Client) RpmOstreeVersionEqualOrGreater(required string) (bool, error) { + vdata, err := client.RpmOstreeVersion() + if err != nil { + return false, err + } + + return compareVersionStrings(required, vdata.Version) +} + +// QueryStatus loads the current system state. +func (client *Client) QueryStatus() (*Status, error) { + var q Status + c := client.newCmd("status", "--json") + buf, err := c.Output() + if err != nil { + return nil, err + } + + if err := json.Unmarshal(buf, &q); err != nil { + return nil, fmt.Errorf("failed to parse `rpm-ostree status --json` output: %w", err) + } + + return &q, nil +} + +// GetBootedDeployment finds the booted deployment, or returns an error if none is found. +func (s *Status) GetBootedDeployment() (*Deployment, error) { + for num := range s.Deployments { + deployment := s.Deployments[num] + if deployment.Booted { + return &deployment, nil + } + } + return nil, fmt.Errorf("no booted deployment found") +} + +// GetStagedDeployment finds the staged deployment, or returns nil if none is found. +func (s *Status) GetStagedDeployment() *Deployment { + for num := range s.Deployments { + deployment := s.Deployments[num] + if deployment.Staged { + return &deployment + } + } + return nil +} + +// GetBaseChecksum returns the ostree commit used as a base. +func (s *Deployment) GetBaseChecksum() string { + if s.BaseChecksum != nil { + return *s.BaseChecksum + } + return s.Checksum +} + +// Remove the pending deployment. +func (client *Client) RemovePendingDeployment() error { + return client.run("cleanup", "-p") +} + +// Remove the rollback deployment. +func (client *Client) RemoveRollbackDeployment() error { + return client.run("cleanup", "-r") +} + +// ChangeKernelArguments adjusts the kernel arguments. +func (client *Client) ChangeKernelArguments(toAdd []string, toRemove []string) error { + args := []string{"kargs"} + for _, arg := range toRemove { + args = append(args, "--delete="+arg) + } + for _, arg := range toAdd { + args = append(args, "--append="+arg) + } + return client.run(args...) +} + +// ChangePackages installs or removes packages. +func (client *Client) ChangePackages(toAdd []string, toRemove []string) error { + args := []string{} + if len(toAdd) == 0 { + args = append(args, "uninstall") + args = append(args, toRemove...) + for _, pkg := range toAdd { + args = append(args, "--install") + args = append(args, pkg) + } + } else { + args = append(args, "install") + args = append(args, toAdd...) + for _, pkg := range toRemove { + args = append(args, "--uninstall") + args = append(args, pkg) + } + } + return client.run(args...) +} + +// OverrideRemove uninstalls base packages, optionally installing new ones at the same time. +func (client *Client) OverrideRemove(toRemove []string, toInstall []string) error { + args := []string{"override", "remove"} + args = append(args, toRemove...) + for _, pkg := range toInstall { + args = append(args, "--install") + args = append(args, pkg) + } + return client.run(args...) +} + +// OverrideRemove drops overrides, optionally uninstalling new ones at the same time. +func (client *Client) OverrideReset(toReset []string, toUninstall []string) error { + args := []string{"override", "reset"} + args = append(args, toReset...) + for _, pkg := range toUninstall { + args = append(args, "--uninstall") + args = append(args, pkg) + } + return client.run(args...) +} + +// RebaseToContainerImage switches to the target container image +func (client *Client) RebaseToContainerImage(target reference.Reference) error { + return client.run("rebase", "--experimental", fmt.Sprintf("ostree-image-signed:docker://%s", target.String())) +} + +// RebaseToContainerImageAllowUnsigned switches to the target container image, ignoring lack of image signatures. +func (client *Client) RebaseToContainerImageAllowUnsigned(target reference.Reference) error { + return client.run("rebase", "--experimental", fmt.Sprintf("ostree-unverified-registry:%s", target.String())) +} diff --git a/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/fcos-container-status.json b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/fcos-container-status.json new file mode 100644 index 0000000000..857cf9aa08 --- /dev/null +++ b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/fcos-container-status.json @@ -0,0 +1,82 @@ +{ + "deployments": [ + { + "unlocked": "none", + "requested-local-packages": [], + "base-removals": [], + "requested-modules": [], + "requested-modules-enabled": [], + "pinned": false, + "osname": "fedora-coreos", + "base-remote-replacements": {}, + "regenerate-initramfs": false, + "checksum": "7239c56aa4fe6208008fa2800e16e2ccc68179f776674c3a90b1d4c71f2b80ca", + "container-image-reference-digest": "sha256:25d3a07d53835c6c738fb4dcba149dc0b64a9bc4ec9c3431750cabd3596ab233", + "requested-base-local-replacements": [], + "id": "fedora-coreos-7239c56aa4fe6208008fa2800e16e2ccc68179f776674c3a90b1d4c71f2b80ca.0", + "modules": [], + "requested-local-fileoverride-packages": [], + "requested-base-removals": [], + "requested-packages": [], + "serial": 0, + "timestamp": 1663794115, + "staged": true, + "booted": false, + "container-image-reference": "ostree-unverified-registry:quay.io/fedora/fedora-coreos:testing-devel", + "packages": [], + "base-local-replacements": [] + }, + { + "unlocked": "none", + "requested-local-packages": [], + "base-removals": [], + "requested-modules": [], + "requested-modules-enabled": [], + "pinned": false, + "osname": "fedora-coreos", + "base-remote-replacements": {}, + "origin": "fedora:fedora/x86_64/coreos/stable", + "regenerate-initramfs": false, + "checksum": "a465c49fef185f8339d3cd5857e28386cfdc6516f68206912917c9dc3192d809", + "gpg-enabled": true, + "requested-base-local-replacements": [], + "id": "fedora-coreos-a465c49fef185f8339d3cd5857e28386cfdc6516f68206912917c9dc3192d809.0", + "version": "36.20220820.3.0", + "requested-local-fileoverride-packages": [], + "requested-base-removals": [], + "signatures": [ + [ + true, + false, + false, + false, + false, + "53DED2CB922D8B8D9E63FD18999F7CBF38AB71F4", + 1662489044, + 0, + "RSA", + "SHA256", + "Fedora", + "fedora-36-primary@fedoraproject.org", + "53DED2CB922D8B8D9E63FD18999F7CBF38AB71F4", + 0, + 0 + ] + ], + "requested-packages": [], + "serial": 0, + "timestamp": 1662488373, + "staged": false, + "booted": true, + "packages": [], + "base-local-replacements": [], + "modules": [] + } + ], + "transaction": null, + "cached-update": null, + "update-driver": { + "driver-name": "Zincati", + "driver-sd-unit": "zincati.service" + } +} \ No newline at end of file diff --git a/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/workstation-status.json b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/workstation-status.json new file mode 100644 index 0000000000..b1754080b5 --- /dev/null +++ b/vendor/github.com/coreos/rpmostree-client-go/pkg/client/test-fixtures/workstation-status.json @@ -0,0 +1,303 @@ +{ + "deployments": [ + { + "unlocked": "none", + "base-commit-meta": { + "coreos-assembler.config-gitrev": "80966f951c766846da070b4c168b9170c61513e2", + "coreos-assembler.config-dirty": "false", + "rpmostree.inputhash": "06539cc4a4265eec2045a349fe80de451a61628c1b117e171d80663d3e3f42eb", + "coreos-assembler.basearch": "x86_64", + "version": "33.21", + "rpmostree.initramfs-args": [ + "--add=ignition", + "--no-hostonly", + "--omit=nfs", + "--omit=lvm", + "--omit=iscsi" + ], + "rpmostree.rpmmd-repos": [ + { + "id": "fedora-coreos-pool", + "timestamp": 1053029086517002240 + }, + { + "id": "fedora", + "timestamp": -2945197617627267072 + }, + { + "id": "fedora-updates", + "timestamp": -389530169125109760 + } + ] + }, + "requested-local-packages": [], + "base-removals": [], + "gpg-enabled": false, + "origin": "fedora/33/x86_64/silverblue", + "osname": "fedora-silverblue", + "pinned": false, + "requested-base-local-replacements": [ + "rpm-ostree-2021.1-2.fc33.x86_64", + "rpm-ostree-libs-2021.1-2.fc33.x86_64" + ], + "checksum": "63335a77f9853618ba1a5f139c5805e82176a2a040ef5e34d7402e12263af5bb", + "regenerate-initramfs": false, + "id": "fedora-silverblue-63335a77f9853618ba1a5f139c5805e82176a2a040ef5e34d7402e12263af5bb.0", + "version": "33.21", + "base-version": "33.21", + "requested-base-removals": [], + "base-checksum": "229387d3c0bb8ad698228ca5702eca72aed8b298a7c800be1dc72bab160a9f7f", + "requested-packages": [ + "xsel", + "gdb", + "ykclient", + "krb5-workstation", + "ykpers", + "git-evtag", + "fish", + "qemu-system-aarch64", + "strace", + "qemu-kvm", + "virt-manager", + "opensc", + "tmux", + "pcsc-lite-ccid", + "tilix", + "libvirt" + ], + "base-timestamp": 1612554510, + "serial": 0, + "layered-commit-meta": { + "rpmostree.clientlayer": true, + "version": "33.21", + "rpmostree.clientlayer_version": 4, + "rpmostree.state-sha512": "8b037fba282e3773ef17d4c396ee958765c01e85c7a6a29ec9df1bb2213022cf599da15ec4df982c4f0904012b165c4370a9f14b12c48d0684a66928c4f34b34", + "rpmostree.rpmmd-repos": [ + { + "id": "fedora-cisco-openh264", + "timestamp": 1598382634 + }, + { + "id": "updates", + "timestamp": 1612486906 + }, + { + "id": "fedora", + "timestamp": 1603150039 + } + ] + }, + "base-local-replacements": [ + [ + [ + "rpm-ostree-2021.1-2.fc33.x86_64", + "rpm-ostree", + 0, + "2021.1", + "2.fc33", + "x86_64" + ], + [ + "rpm-ostree-2021.1-3.fc33.x86_64", + "rpm-ostree", + 0, + "2021.1", + "3.fc33", + "x86_64" + ] + ], + [ + [ + "rpm-ostree-libs-2021.1-2.fc33.x86_64", + "rpm-ostree-libs", + 0, + "2021.1", + "2.fc33", + "x86_64" + ], + [ + "rpm-ostree-libs-2021.1-3.fc33.x86_64", + "rpm-ostree-libs", + 0, + "2021.1", + "3.fc33", + "x86_64" + ] + ] + ], + "timestamp": 1612555369, + "packages": [ + "fish", + "gdb", + "git-evtag", + "krb5-workstation", + "libvirt", + "opensc", + "pcsc-lite-ccid", + "qemu-kvm", + "qemu-system-aarch64", + "strace", + "tilix", + "tmux", + "virt-manager", + "xsel", + "ykclient", + "ykpers" + ], + "booted": true, + "initramfs-etc": [] + }, + { + "unlocked": "none", + "pending-base-version": "33.21", + "base-commit-meta": { + "coreos-assembler.config-gitrev": "bbd5282b507c5b29e3a5f12e9da21f3aaa0f0e00", + "coreos-assembler.config-dirty": "false", + "rpmostree.inputhash": "f33469d0f6c5d5ce5e30345fa5b002a8e4ebf5ea397caad000bdc32cd74897a6", + "coreos-assembler.basearch": "x86_64", + "version": "33.17", + "rpmostree.initramfs-args": [ + "--add=ignition", + "--no-hostonly", + "--omit=nfs", + "--omit=lvm", + "--omit=iscsi" + ], + "rpmostree.rpmmd-repos": [ + { + "id": "fedora-coreos-pool", + "timestamp": 7926905303512121344 + }, + { + "id": "fedora", + "timestamp": -2945197617627267072 + }, + { + "id": "fedora-updates", + "timestamp": -6611277243593261056 + } + ] + }, + "requested-local-packages": [], + "base-removals": [], + "gpg-enabled": false, + "osname": "fedora-silverblue", + "origin": "fedora/33/x86_64/silverblue", + "packages": [ + "fish", + "gdb", + "git-evtag", + "krb5-workstation", + "libvirt", + "opensc", + "pcsc-lite-ccid", + "qemu-kvm", + "qemu-system-aarch64", + "strace", + "tilix", + "tmux", + "virt-manager", + "xsel", + "ykclient", + "ykpers" + ], + "pinned": false, + "requested-base-local-replacements": [ + "rpm-ostree-2021.1-2.fc33.x86_64", + "rpm-ostree-libs-2021.1-2.fc33.x86_64" + ], + "checksum": "775d54e89bc74731ec27db04f12510c0269c8cbab3ad5e39e0a4d693231ef072", + "regenerate-initramfs": false, + "id": "fedora-silverblue-775d54e89bc74731ec27db04f12510c0269c8cbab3ad5e39e0a4d693231ef072.0", + "version": "33.17", + "base-version": "33.17", + "base-checksum": "deea0555cb7d3eb042df9a85d4efcbb9f70d778a9a9557715c0e398978233cd7", + "requested-base-removals": [], + "requested-packages": [ + "xsel", + "gdb", + "ykclient", + "krb5-workstation", + "ykpers", + "git-evtag", + "fish", + "qemu-system-aarch64", + "strace", + "qemu-kvm", + "virt-manager", + "opensc", + "tmux", + "pcsc-lite-ccid", + "tilix", + "libvirt" + ], + "base-timestamp": 1611079148, + "serial": 0, + "layered-commit-meta": { + "rpmostree.clientlayer": true, + "version": "33.17", + "rpmostree.clientlayer_version": 4, + "rpmostree.state-sha512": "684f72c2b63379ee17a8f3055ccdfb3d54d255ed5bf1965788be21e804a0aff9e08620519dacaa34cc8cbad038474e8b0abbc68ee98988c547ad599f93ddcfa1", + "rpmostree.rpmmd-repos": [ + { + "id": "fedora-cisco-openh264", + "timestamp": 1598382634 + }, + { + "id": "updates", + "timestamp": 1611022500 + }, + { + "id": "fedora", + "timestamp": 1603150039 + } + ] + }, + "base-local-replacements": [ + [ + [ + "rpm-ostree-2021.1-2.fc33.x86_64", + "rpm-ostree", + 0, + "2021.1", + "2.fc33", + "x86_64" + ], + [ + "rpm-ostree-2020.10-1.fc33.x86_64", + "rpm-ostree", + 0, + "2020.10", + "1.fc33", + "x86_64" + ] + ], + [ + [ + "rpm-ostree-libs-2021.1-2.fc33.x86_64", + "rpm-ostree-libs", + 0, + "2021.1", + "2.fc33", + "x86_64" + ], + [ + "rpm-ostree-libs-2020.10-1.fc33.x86_64", + "rpm-ostree-libs", + 0, + "2020.10", + "1.fc33", + "x86_64" + ] + ] + ], + "timestamp": 1611081986, + "pending-base-timestamp": 1612554510, + "booted": false, + "pending-base-checksum": "229387d3c0bb8ad698228ca5702eca72aed8b298a7c800be1dc72bab160a9f7f", + "initramfs-etc": [] + } + ], + "transaction": null, + "cached-update": null +} \ No newline at end of file diff --git a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go index 94f19be628..6e442a0853 100644 --- a/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go +++ b/vendor/github.com/opencontainers/image-spec/specs-go/v1/descriptor.go @@ -35,11 +35,6 @@ type Descriptor struct { // Annotations contains arbitrary metadata relating to the targeted content. Annotations map[string]string `json:"annotations,omitempty"` - // Data is an embedding of the targeted content. This is encoded as a base64 - // string when marshalled to JSON (automatically, by encoding/json). If - // present, Data can be used directly to avoid fetching the targeted content. - Data []byte `json:"data,omitempty"` - // Platform describes the platform which the image in the manifest runs on. // // This should only be used when referring to a manifest. diff --git a/vendor/modules.txt b/vendor/modules.txt index da55f29b24..2fe471d9d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -237,6 +237,9 @@ github.com/coreos/ignition/v2/config/v3_2 github.com/coreos/ignition/v2/config/v3_2/translate github.com/coreos/ignition/v2/config/v3_2/types github.com/coreos/ignition/v2/config/validate +# github.com/coreos/rpmostree-client-go v0.0.0-20220922143538-78889752c880 +## explicit; go 1.17 +github.com/coreos/rpmostree-client-go/pkg/client # github.com/coreos/vcontext v0.0.0-20211021162308-f1dbbca7bef4 ## explicit; go 1.15 github.com/coreos/vcontext/json @@ -746,14 +749,14 @@ github.com/olekukonko/tablewriter # github.com/opencontainers/go-digest v1.0.0 ## explicit; go 1.13 github.com/opencontainers/go-digest -# github.com/opencontainers/image-spec v1.0.3-0.20220811233833-d265d74f4fad -## explicit; go 1.16 +# github.com/opencontainers/image-spec v1.0.3-0.20220114050600-8b9d41f48198 +## explicit; go 1.11 github.com/opencontainers/image-spec/specs-go github.com/opencontainers/image-spec/specs-go/v1 # github.com/opencontainers/runc v1.1.3 ## explicit; go 1.16 github.com/opencontainers/runc/libcontainer/user -# github.com/opencontainers/runtime-spec v1.0.3-0.20220809190508-9ee22abf867e => github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48 +# github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 => github.com/opencontainers/runtime-spec v0.1.2-0.20190408193819-a1b50f621a48 ## explicit github.com/opencontainers/runtime-spec/specs-go # github.com/openshift/api v0.0.0-20220915134421-1265e9925688