From a24037c4d46234d3feea7e1d2d4e373593b525da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:35:52 -0400 Subject: [PATCH 01/17] global: Use incus repository MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- distrobuilder/main.go | 2 +- distrobuilder/main_lxd.go | 8 ++++---- distrobuilder/main_repack-windows.go | 2 +- distrobuilder/vm.go | 2 +- generators/cloud-init.go | 4 ++-- generators/cloud-init_test.go | 2 +- generators/copy.go | 2 +- generators/hostname.go | 4 ++-- generators/hosts.go | 4 ++-- generators/lxd-agent.go | 2 +- generators/template.go | 2 +- image/lxc.go | 2 +- image/lxd.go | 2 +- managers/apt.go | 2 +- managers/luet.go | 2 +- managers/pacman.go | 2 +- managers/yum.go | 2 +- shared/archive_linux.go | 2 +- shared/chroot.go | 2 +- shared/definition.go | 4 ++-- shared/definition_test.go | 2 +- shared/osarch.go | 2 +- shared/util.go | 2 +- sources/common.go | 4 ++-- sources/common_test.go | 2 +- sources/debootstrap.go | 2 +- sources/oraclelinux-http.go | 2 +- sources/plamolinux-http.go | 2 +- sources/rhel-common.go | 2 +- sources/utils.go | 2 +- 30 files changed, 38 insertions(+), 38 deletions(-) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index 7624d120..8eef008b 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -65,7 +65,7 @@ import ( "strings" "time" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "gopkg.in/yaml.v2" diff --git a/distrobuilder/main_lxd.go b/distrobuilder/main_lxd.go index 1ee36048..6f8f4fbe 100644 --- a/distrobuilder/main_lxd.go +++ b/distrobuilder/main_lxd.go @@ -8,9 +8,9 @@ import ( "os/exec" "path/filepath" - client "github.com/canonical/lxd/client" - lxd "github.com/canonical/lxd/shared" - "github.com/canonical/lxd/shared/api" + client "github.com/lxc/incus/client" + lxd "github.com/lxc/incus/shared" + "github.com/lxc/incus/shared/api" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/sys/unix" @@ -456,7 +456,7 @@ func (c *cmdLXD) run(cmd *cobra.Command, args []string, overlayDir string) error path = "/var/snap/lxd/common/lxd/unix.socket" } - server, err := client.ConnectLXDUnix(path, nil) + server, err := client.ConnectIncusUnix(path, nil) if err != nil { return fmt.Errorf("Failed to connect to LXD: %w", err) } diff --git a/distrobuilder/main_repack-windows.go b/distrobuilder/main_repack-windows.go index 05676029..ce6a1be7 100644 --- a/distrobuilder/main_repack-windows.go +++ b/distrobuilder/main_repack-windows.go @@ -14,8 +14,8 @@ import ( "strconv" "strings" - lxd "github.com/canonical/lxd/shared" "github.com/flosch/pongo2" + lxd "github.com/lxc/incus/shared" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/sys/unix" diff --git a/distrobuilder/vm.go b/distrobuilder/vm.go index 9158d993..01b86da3 100644 --- a/distrobuilder/vm.go +++ b/distrobuilder/vm.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "github.com/lxc/distrobuilder/shared" diff --git a/generators/cloud-init.go b/generators/cloud-init.go index c041a9c9..9f278073 100644 --- a/generators/cloud-init.go +++ b/generators/cloud-init.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" - "github.com/canonical/lxd/shared/api" + lxd "github.com/lxc/incus/shared" + "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go index 261fa312..1ad75be6 100644 --- a/generators/cloud-init_test.go +++ b/generators/cloud-init_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/stretchr/testify/require" "github.com/lxc/distrobuilder/image" diff --git a/generators/copy.go b/generators/copy.go index 5d8aa525..9ec57f80 100644 --- a/generators/copy.go +++ b/generators/copy.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/generators/hostname.go b/generators/hostname.go index 0ef259d7..0e813f6a 100644 --- a/generators/hostname.go +++ b/generators/hostname.go @@ -5,8 +5,8 @@ import ( "os" "path/filepath" - lxd "github.com/canonical/lxd/shared" - "github.com/canonical/lxd/shared/api" + lxd "github.com/lxc/incus/shared" + "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/generators/hosts.go b/generators/hosts.go index b62a655a..0cf651eb 100644 --- a/generators/hosts.go +++ b/generators/hosts.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" - "github.com/canonical/lxd/shared/api" + lxd "github.com/lxc/incus/shared" + "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/generators/lxd-agent.go b/generators/lxd-agent.go index 6f20c44c..5af75b56 100644 --- a/generators/lxd-agent.go +++ b/generators/lxd-agent.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/generators/template.go b/generators/template.go index 78055a67..c91380be 100644 --- a/generators/template.go +++ b/generators/template.go @@ -6,8 +6,8 @@ import ( "path/filepath" "strings" - "github.com/canonical/lxd/shared/api" "github.com/flosch/pongo2" + "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" diff --git a/image/lxc.go b/image/lxc.go index a399e0d2..65ad221f 100644 --- a/image/lxc.go +++ b/image/lxc.go @@ -8,7 +8,7 @@ import ( "strings" "time" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/image/lxd.go b/image/lxd.go index 6346a753..72ecc6e9 100644 --- a/image/lxd.go +++ b/image/lxd.go @@ -8,7 +8,7 @@ import ( "strconv" "time" - "github.com/canonical/lxd/shared/api" + "github.com/lxc/incus/shared/api" "gopkg.in/yaml.v2" "github.com/lxc/distrobuilder/shared" diff --git a/managers/apt.go b/managers/apt.go index dde70c3a..0e6f41de 100644 --- a/managers/apt.go +++ b/managers/apt.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/managers/luet.go b/managers/luet.go index db928b2d..04e042df 100644 --- a/managers/luet.go +++ b/managers/luet.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/managers/pacman.go b/managers/pacman.go index 2504294c..1e298b52 100644 --- a/managers/pacman.go +++ b/managers/pacman.go @@ -6,7 +6,7 @@ import ( "path/filepath" "runtime" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/managers/yum.go b/managers/yum.go index c200c584..59b268f1 100644 --- a/managers/yum.go +++ b/managers/yum.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/shared/archive_linux.go b/shared/archive_linux.go index 0de7670e..bdc5b39d 100644 --- a/shared/archive_linux.go +++ b/shared/archive_linux.go @@ -8,7 +8,7 @@ import ( "os" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "golang.org/x/sys/unix" ) diff --git a/shared/chroot.go b/shared/chroot.go index c004879d..f91a448e 100644 --- a/shared/chroot.go +++ b/shared/chroot.go @@ -7,7 +7,7 @@ import ( "regexp" "strconv" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "golang.org/x/sys/unix" ) diff --git a/shared/definition.go b/shared/definition.go index 8a154b35..069c6734 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -8,8 +8,8 @@ import ( "strings" "time" - "github.com/canonical/lxd/shared" - lxdarch "github.com/canonical/lxd/shared/osarch" + "github.com/lxc/incus/shared" + lxdarch "github.com/lxc/incus/shared/osarch" ) // ImageTarget represents the image target. diff --git a/shared/definition_test.go b/shared/definition_test.go index 35cfb0b4..b2092208 100644 --- a/shared/definition_test.go +++ b/shared/definition_test.go @@ -4,7 +4,7 @@ import ( "log" "testing" - "github.com/canonical/lxd/shared" + "github.com/lxc/incus/shared" "github.com/stretchr/testify/require" yaml "gopkg.in/yaml.v2" ) diff --git a/shared/osarch.go b/shared/osarch.go index 22b4cc20..ec43758f 100644 --- a/shared/osarch.go +++ b/shared/osarch.go @@ -3,7 +3,7 @@ package shared import ( "fmt" - "github.com/canonical/lxd/shared/osarch" + "github.com/lxc/incus/shared/osarch" ) var alpineLinuxArchitectureNames = map[int]string{ diff --git a/shared/util.go b/shared/util.go index f34380a6..64d91e98 100644 --- a/shared/util.go +++ b/shared/util.go @@ -12,7 +12,7 @@ import ( "strings" "time" - "github.com/canonical/lxd/shared" + "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "gopkg.in/flosch/pongo2.v3" yaml "gopkg.in/yaml.v2" diff --git a/sources/common.go b/sources/common.go index 7e290029..f1644476 100644 --- a/sources/common.go +++ b/sources/common.go @@ -13,8 +13,8 @@ import ( "strings" "time" - lxd "github.com/canonical/lxd/shared" - "github.com/canonical/lxd/shared/ioprogress" + lxd "github.com/lxc/incus/shared" + "github.com/lxc/incus/shared/ioprogress" "github.com/sirupsen/logrus" "github.com/lxc/distrobuilder/shared" diff --git a/sources/common_test.go b/sources/common_test.go index 6bbf4da0..a253f277 100644 --- a/sources/common_test.go +++ b/sources/common_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/stretchr/testify/require" "github.com/lxc/distrobuilder/shared" diff --git a/sources/debootstrap.go b/sources/debootstrap.go index d84ece15..294b99d9 100644 --- a/sources/debootstrap.go +++ b/sources/debootstrap.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) diff --git a/sources/oraclelinux-http.go b/sources/oraclelinux-http.go index 634b3cf5..4f66585c 100644 --- a/sources/oraclelinux-http.go +++ b/sources/oraclelinux-http.go @@ -10,7 +10,7 @@ import ( "sort" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "gopkg.in/antchfx/htmlquery.v1" diff --git a/sources/plamolinux-http.go b/sources/plamolinux-http.go index 3c3e2dbf..686a8711 100644 --- a/sources/plamolinux-http.go +++ b/sources/plamolinux-http.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "gopkg.in/antchfx/htmlquery.v1" "github.com/lxc/distrobuilder/shared" diff --git a/sources/rhel-common.go b/sources/rhel-common.go index f88c72c0..73c6ceab 100644 --- a/sources/rhel-common.go +++ b/sources/rhel-common.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "github.com/lxc/distrobuilder/shared" diff --git a/sources/utils.go b/sources/utils.go index f6d60a0b..a8729f96 100644 --- a/sources/utils.go +++ b/sources/utils.go @@ -15,7 +15,7 @@ import ( "regexp" "strings" - lxd "github.com/canonical/lxd/shared" + lxd "github.com/lxc/incus/shared" ) // downloadChecksum downloads or opens URL, and matches fname against the From 8c9e97d69a677e9ecf281b60e424b0d94668af84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:36:02 -0400 Subject: [PATCH 02/17] Update gomod MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- go.mod | 56 +++++++++------------ go.sum | 154 +++++++++++++++++++++++++-------------------------------- 2 files changed, 91 insertions(+), 119 deletions(-) diff --git a/go.mod b/go.mod index 8daa5367..412a71a3 100644 --- a/go.mod +++ b/go.mod @@ -8,95 +8,87 @@ exclude ( ) require ( - github.com/canonical/lxd v0.0.0-20230706083320-ad459653e514 github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 + github.com/lxc/incus v0.0.0-20230905193531-cb7877bcaa4f github.com/mudler/docker-companion v0.4.6-0.20211015133729-bd4704fad372 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/stretchr/testify v1.8.4 - golang.org/x/sys v0.10.0 - golang.org/x/text v0.11.0 + golang.org/x/sys v0.12.0 + golang.org/x/text v0.13.0 gopkg.in/antchfx/htmlquery.v1 v1.2.2 gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 gopkg.in/yaml.v2 v2.4.0 ) require ( - github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 // indirect + github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect - github.com/Microsoft/hcsshim v0.10.0-rc.9 // indirect + github.com/Microsoft/hcsshim v0.10.0 // indirect github.com/antchfx/xpath v1.2.4 // indirect github.com/apex/log v1.9.0 // indirect - github.com/containerd/cgroups v1.1.0 // indirect - github.com/containerd/containerd v1.7.2 // indirect - github.com/containerd/continuity v0.4.1 // indirect + github.com/containerd/cgroups/v3 v3.0.2 // indirect + github.com/containerd/containerd v1.7.5 // indirect + github.com/containerd/continuity v0.4.2 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/cyphar/filepath-securejoin v0.2.3 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/docker/distribution v2.8.2+incompatible // indirect - github.com/docker/docker v24.0.2+incompatible // indirect + github.com/docker/docker v24.0.5+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/docker/libtrust v0.0.0-20160708172513-aabc10ec26b7 // indirect - github.com/frankban/quicktest v1.14.0 // indirect - github.com/fsouza/go-dockerclient v1.9.7 // indirect - github.com/go-macaroon-bakery/macaroon-bakery/v3 v3.0.1 // indirect - github.com/go-macaroon-bakery/macaroonpb v1.0.0 // indirect + github.com/fsouza/go-dockerclient v1.9.8 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect - github.com/google/uuid v1.3.0 // indirect + github.com/google/uuid v1.3.1 // indirect github.com/gorilla/schema v1.2.0 // indirect github.com/gorilla/securecookie v1.1.1 // indirect github.com/gorilla/websocket v1.5.0 // indirect github.com/heroku/docker-registry-client v0.0.0-20211012143308-9463674c8930 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/juju/webbrowser v1.0.0 // indirect - github.com/julienschmidt/httprouter v1.3.0 // indirect github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 // indirect github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/pgzip v1.2.6 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/moby/patternmatcher v0.5.0 // indirect + github.com/moby/patternmatcher v0.6.0 // indirect github.com/moby/sys/sequential v0.5.0 // indirect github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/muhlemmer/gu v0.3.1 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc4 // indirect - github.com/opencontainers/runc v1.1.7 // indirect - github.com/opencontainers/runtime-spec v1.1.0-rc.3 // indirect + github.com/opencontainers/runc v1.1.9 // indirect + github.com/opencontainers/runtime-spec v1.1.0 // indirect github.com/opencontainers/umoci v0.4.8-0.20211009121349-9c76304c034d // indirect github.com/pborman/uuid v1.2.1 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/pkg/sftp v1.13.5 // indirect + github.com/pkg/sftp v1.13.6 // indirect github.com/pkg/xattr v0.4.9 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect github.com/robfig/cron/v3 v3.0.1 // indirect - github.com/rogpeppe/fastuuid v1.2.0 // indirect + github.com/rogpeppe/go-internal v1.6.1 // indirect github.com/rootless-containers/proto/go-proto v0.0.0-20230421021042-4cd87ebadd67 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/urfave/cli v1.22.14 // indirect github.com/vbatts/go-mtree v0.5.3 // indirect - github.com/zitadel/oidc/v2 v2.6.4 // indirect + github.com/zitadel/oidc/v2 v2.10.0 // indirect go.opencensus.io v0.24.0 // indirect - golang.org/x/crypto v0.11.0 // indirect + golang.org/x/crypto v0.13.0 // indirect golang.org/x/mod v0.12.0 // indirect - golang.org/x/net v0.12.0 // indirect - golang.org/x/oauth2 v0.10.0 // indirect + golang.org/x/net v0.15.0 // indirect + golang.org/x/oauth2 v0.12.0 // indirect golang.org/x/sync v0.3.0 // indirect - golang.org/x/term v0.10.0 // indirect - golang.org/x/tools v0.11.0 // indirect + golang.org/x/term v0.12.0 // indirect + golang.org/x/tools v0.13.0 // indirect google.golang.org/appengine v1.6.7 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 // indirect - google.golang.org/grpc v1.56.1 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.57.0 // indirect google.golang.org/protobuf v1.31.0 // indirect - gopkg.in/errgo.v1 v1.0.1 // indirect - gopkg.in/httprequest.v1 v1.2.1 // indirect - gopkg.in/macaroon.v2 v2.1.0 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.0 // indirect diff --git a/go.sum b/go.sum index f13cac73..24cbaae6 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ bazil.org/fuse v0.0.0-20160811212531-371fbbdaa898/go.mod h1:Xbm+BRKSBEpa4q4hTSxohYNQpsxXPbPry4JJWOB3LB8= cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/AdaLogics/go-fuzz-headers v0.0.0-20210401092550-0a8691dafd0d/go.mod h1:CzsSbkDixRphAF5hS6wbMKq0eI6ccJRb7/A0M6JBnwg= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1 h1:EKPd1INOIyr5hWOWhvpmQpY6tKjeG0hT1s3AMC/9fic= -github.com/AdaLogics/go-fuzz-headers v0.0.0-20230106234847-43070de90fa1/go.mod h1:VzwV+t+dZ9j/H867F1M2ziD+yLHtB46oM35FxxMJ4d0= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 h1:bvDV9vkmnHYOMsOr4WLk+Vo07yKIzd94sVoIqshQ4bU= +github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24/go.mod h1:8o94RPi1/7XTJvwPpRSzSUedZrtlirdB3r9Z20bi2f8= github.com/AdamKorcz/go-fuzz-headers v0.0.0-20210312213058-32f4d319f0d2/go.mod h1:VPevheIvXETHZT/ddjwarP3POR5p/cnH9Hy5yoFnQjc= github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= @@ -14,8 +14,8 @@ github.com/Microsoft/go-winio v0.4.15-0.20200113171025-3fe6c5262873/go.mod h1:tT github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Microsoft/hcsshim v0.8.7/go.mod h1:OHd7sQqRFrYd3RmSgbgji+ctCwkbq2wbEYNSzOYtcBQ= -github.com/Microsoft/hcsshim v0.10.0-rc.9 h1:B4mguSolFL2yOHl0JjQxo0Si2Vwipj/Cbib4pyJ4pKA= -github.com/Microsoft/hcsshim v0.10.0-rc.9/go.mod h1:1g6+xpige+npSTrEkdm8JOZxOjJ9McQiT0JkEpzyZqA= +github.com/Microsoft/hcsshim v0.10.0 h1:PbvoxdUGgXxyirmN5Oncp3POLkxEG5LbWCEBfWmHTGA= +github.com/Microsoft/hcsshim v0.10.0/go.mod h1:3j1trOamcUdi86J5Tr5+1BpqMjSv/QeRWkX2whBF6dY= github.com/OpenPeeDeeP/depguard v1.0.0/go.mod h1:7/4sitnI9YlQgTLLk734QlzXT8DuHVnAyztLplQjk+o= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/antchfx/xpath v1.2.4 h1:dW1HB/JxKvGtJ9WyVGJ0sIoEcqftV3SqIstujI+B9XY= @@ -31,26 +31,24 @@ github.com/aws/aws-sdk-go v1.20.6/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aybabtme/rgbterm v0.0.0-20170906152045-cc83f3b3ce59/go.mod h1:q/89r3U2H7sSsE2t6Kca0lfwTK8JdoNGS/yzM/4iH5I= github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA= github.com/blang/semver v3.1.0+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= -github.com/canonical/lxd v0.0.0-20230706083320-ad459653e514 h1:ZST0t1xzDpUhE1pQwrjD9ieyWYcdoos/yuqKTDvbUes= -github.com/canonical/lxd v0.0.0-20230706083320-ad459653e514/go.mod h1:iRepjqZoVVmu2NXI55FgUAnCgoqggPTKTYMqTA4P6Qk= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/checkpoint-restore/go-criu/v5 v5.0.0/go.mod h1:cfwC0EG7HMUenopBsUf9d89JlCLQIfgVcNsNN0t6T2M= github.com/cilium/ebpf v0.6.2/go.mod h1:4tRaxcgiL706VnOzHOdBlY8IEAIdxINsQBcU4xJJXRs= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/containerd/cgroups v0.0.0-20190919134610-bf292b21730f/go.mod h1:OApqhQ4XNSNC13gXIwDjhOQxjWa/NxkwZXJ1EvqT0ko= -github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= -github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= +github.com/containerd/cgroups/v3 v3.0.2 h1:f5WFqIVSgo5IZmtTT3qVBo6TzI1ON6sycSBKkymb9L0= +github.com/containerd/cgroups/v3 v3.0.2/go.mod h1:JUgITrzdFqp42uI2ryGA+ge0ap/nxzYgkGmIcetmErE= github.com/containerd/console v0.0.0-20180822173158-c12b1e7919c1/go.mod h1:Tj/on1eG8kiEhd0+fhSDzsPAFESxzBBvdyEgyryXffw= github.com/containerd/console v1.0.2/go.mod h1:ytZPjGgY2oeTkAONYafi2kSj0aYggsf8acV1PGKCbzQ= github.com/containerd/containerd v1.3.0-beta.2.0.20190828155532-0293cbd26c69/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= github.com/containerd/containerd v1.3.0/go.mod h1:bC6axHOhabU15QhwfG7w5PipXdVtMXFTttgp+kVtyUA= -github.com/containerd/containerd v1.7.2 h1:UF2gdONnxO8I6byZXDi5sXWiWvlW3D/sci7dTQimEJo= -github.com/containerd/containerd v1.7.2/go.mod h1:afcz74+K10M/+cjGHIVQrCt3RAQhUSCAjJ9iMYhhkuI= +github.com/containerd/containerd v1.7.5 h1:i9T9XpAWMe11BHMN7pu1BZqOGjXaKTPyz2v+KYOZgkY= +github.com/containerd/containerd v1.7.5/go.mod h1:ieJNCSzASw2shSGYLHx8NAE7WsZ/gEigo5fQ78W5Zvw= github.com/containerd/continuity v0.0.0-20190426062206-aaeac12a7ffc/go.mod h1:GL3xCUCBDV3CZiTSEKksMWbLE66hEyuu9qyDOOqM47Y= github.com/containerd/continuity v0.0.0-20200228182428-0f16d7a0959c/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= -github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= -github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= +github.com/containerd/continuity v0.4.2 h1:v3y/4Yz5jwnvqPKJJ+7Wf93fyWoCB3F5EclWG023MDM= +github.com/containerd/continuity v0.4.2/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/containerd/fifo v0.0.0-20190226154929-a9fb20d87448/go.mod h1:ODA38xgv3Kuk8dQz2ZQXpnv/UZZUHUCL7pnLehbXgQI= github.com/containerd/go-runc v0.0.0-20180907222934-5a6d9f37cfa3/go.mod h1:IV7qH3hrUgRmyYrtgEeGWJfWbgcHL9CSRruz2Vqcph0= github.com/containerd/ttrpc v0.0.0-20190828154514-0e0f228740de/go.mod h1:PvCDdDGpgqzQIzDW1TphrGLssLDZp2GuS+X5DkEJB8o= @@ -74,8 +72,8 @@ github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4Kfc github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20191101170500-ac7306503d23/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.5+incompatible h1:WmgcE4fxyI6EEXxBRxsHnZXrO1pQ3smi0k/jho4HLeY= +github.com/docker/docker v24.0.5+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c/go.mod h1:Uw6UezgYA44ePAFQYUehOuCzmy5zmg/+nl2ZfMWGkpA= @@ -94,24 +92,16 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3 h1:fmFk0Wt3bBxxwZnu48jqMdaOR/IZ4vdtJFuaFV8MpIE= github.com/flosch/pongo2 v0.0.0-20200913210552-0d938eb266f3/go.mod h1:bJWSKrZyQvfTnb2OudyUjurSG4/edverV7n82+K3JiM= -github.com/frankban/quicktest v1.0.0/go.mod h1:R98jIehRai+d1/3Hv2//jOVCTJhW1VBavT6B6CuGq2k= -github.com/frankban/quicktest v1.2.2/go.mod h1:Qh/WofXFeiAFII1aEBu529AtJo6Zg2VHscnEsbBnJ20= -github.com/frankban/quicktest v1.7.2/go.mod h1:jaStnuzAqU1AJdCO0l53JDCJrVDKcS03DbaAcR7Ks/o= -github.com/frankban/quicktest v1.10.0/go.mod h1:ui7WezCLWMWxVWr1GETZY3smRy0G4KWq9vcPtJmFl7Y= github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM0I9ntUbOk+k= -github.com/frankban/quicktest v1.14.0 h1:+cqqvzZV87b4adx/5ayVOaYZ2CrvM4ejQvUdBzPPUss= -github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsouza/go-dockerclient v1.6.4/go.mod h1:GOdftxWLWIbIWKbIMDroKFJzPdg6Iw7r+jX1DDZdVsA= -github.com/fsouza/go-dockerclient v1.9.7 h1:FlIrT71E62zwKgRvCvWGdxRD+a/pIy+miY/n3MXgfuw= -github.com/fsouza/go-dockerclient v1.9.7/go.mod h1:vx9C32kE2D15yDSOMCDaAEIARZpDQDFBHeqL3MgQy/U= +github.com/fsouza/go-dockerclient v1.9.8 h1:UdfyV4/w8VthS2VS0muJqUSPL/e6XSj49jqPnbuUOWA= +github.com/fsouza/go-dockerclient v1.9.8/go.mod h1:74lNReDQxrOaogajs51IvZgkDME4qe9yPJAUEUTJtHw= github.com/go-critic/go-critic v0.3.5-0.20190526074819-1df300866540/go.mod h1:+sE8vrLDS2M0pZkBk0wy6+nLdKexVDrl/jBqQOTDThA= github.com/go-lintpack/lintpack v0.5.2/go.mod h1:NwZuYi2nUHho8XEIZ6SIxihrnPoqBTDqfpXvXAN0sXM= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-macaroon-bakery/macaroon-bakery/v3 v3.0.1 h1:uvQJoKTHrFFu8zxoaopNKedRzwdy3+8H72we4T/5cGs= -github.com/go-macaroon-bakery/macaroon-bakery/v3 v3.0.1/go.mod h1:H59IYeChwvD1po3dhGUPvq5na+4NVD7SJlbhGKvslr0= -github.com/go-macaroon-bakery/macaroonpb v1.0.0 h1:It9exBaRMZ9iix1iJ6gwzfwsDE6ExNuwtAJ9e09v6XE= -github.com/go-macaroon-bakery/macaroonpb v1.0.0/go.mod h1:UzrGOcbiwTXISFP2XDLDPjfhMINZa+fX/7A2lMd31zc= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-toolsmith/astcast v1.0.0/go.mod h1:mt2OdQTeAQcY4DQgPSArJjHCcOwlX+Wl/kwN+LbLGQ4= github.com/go-toolsmith/astcopy v1.0.0/go.mod h1:vrgyG+5Bxrnz4MZWPF+pI4R8h3qKRjjyvV/DSez4WVQ= @@ -140,7 +130,6 @@ github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= github.com/golang/mock v1.0.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -174,7 +163,6 @@ github.com/golangci/prealloc v0.0.0-20180630174525-215b22d4de21/go.mod h1:tf5+bz github.com/golangci/revgrep v0.0.0-20180526074752-d9c87f5ffaf0/go.mod h1:qOQCunEYvmd/TLamH+7LlVccLvUH5kZNhbCgTHoBbp4= github.com/golangci/unconvert v0.0.0-20180507085042-28b1c447d1f4/go.mod h1:Izgrg8RkN3rCIMLGE9CyYmU9pY2Jer6DgANEnZ/L/cQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.2.1-0.20190312032427-6f77996f0c42/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= @@ -182,13 +170,12 @@ github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= -github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= +github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= @@ -213,12 +200,6 @@ github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLf github.com/jeremija/gosubmit v0.2.7 h1:At0OhGCFGPXyjPYAsCchoBUhE099pcBXmsb4iZqROIc= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7/go.mod h1:2iMrUgbbvHEiQClaW2NsSzMyGHqN+rDFqY705q49KG0= -github.com/juju/qthttptest v0.1.1/go.mod h1:aTlAv8TYaflIiTDIQYzxnl1QdPjAg8Q8qJMErpKy6A4= -github.com/juju/qthttptest v0.1.3 h1:M0HdpwsK/UTHRGRcIw5zvh5z+QOgdqyK+ecDMN+swwM= -github.com/juju/webbrowser v1.0.0 h1:JLdmbFtCGY6Qf2jmS6bVaenJFGIFkdF1/BjUm76af78= -github.com/juju/webbrowser v1.0.0/go.mod h1:RwVlbBcF91Q4vS+iwlkJ6bZTE3EwlrjbYlM3WMVD6Bc= -github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= -github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= @@ -246,12 +227,13 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= -github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= +github.com/lxc/incus v0.0.0-20230905193531-cb7877bcaa4f h1:ipiedRUikIDlSxPIsbv9VEUaPe/1QgIbgjhhieA/8L8= +github.com/lxc/incus v0.0.0-20230905193531-cb7877bcaa4f/go.mod h1:LxNz8WtfcjqnS/3odAVu/KCVq3accg6axiUGvv7eBS8= github.com/magiconair/properties v1.7.6/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ= @@ -268,8 +250,8 @@ github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyex github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-ps v0.0.0-20170309133038-4fdf99ab2936/go.mod h1:r1VsdOzOPt1ZSrGZWFoNhsAedKnEd6r9Np1+5blZCWk= github.com/mitchellh/mapstructure v0.0.0-20180220230111-00c29f56e238/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/moby/patternmatcher v0.5.0 h1:YCZgJOeULcxLw1Q+sVR636pmS7sPEn1Qo2iAN6M7DBo= -github.com/moby/patternmatcher v0.5.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= +github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= +github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/sys/mountinfo v0.4.1/go.mod h1:rEr8tzG/lsIZHBtN/JjGG+LMYx9eXgW2JI+6q0qou+A= github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= @@ -307,13 +289,13 @@ github.com/opencontainers/runc v0.0.0-20190115041553-12f6a991201f/go.mod h1:qT5X github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.0-rc90/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= github.com/opencontainers/runc v1.0.2/go.mod h1:aTaHFFwQXuA71CiyxOdFFIorAoemI04suvGRQFzWTD0= -github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= -github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= +github.com/opencontainers/runc v1.1.9 h1:XR0VIHTGce5eWPkaPesqTBrhW2yAcaraWfsEalNwQLM= +github.com/opencontainers/runc v1.1.9/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= -github.com/opencontainers/runtime-spec v1.1.0-rc.3 h1:l04uafi6kxByhbxev7OWiuUv0LZxEsYUfDWZ6bztAuU= -github.com/opencontainers/runtime-spec v1.1.0-rc.3/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= +github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/opencontainers/selinux v1.8.2/go.mod h1:MUIHuUEvKB1wtJjQdOyYRgOnLD2xAPP8dBsCoU0KuF8= github.com/opencontainers/umoci v0.4.7/go.mod h1:lgJ4bnwJezsN1o/5d7t/xdRPvmf8TvBko5kKYJsYvgo= @@ -326,8 +308,8 @@ github.com/pkg/errors v0.8.1-0.20171018195549-f15c970de5b7/go.mod h1:bwawxfHBFNV github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/sftp v1.13.5 h1:a3RLUqkyjYRtBTZJZ1VRrKbN3zhuPLlUc3sphVz81go= -github.com/pkg/sftp v1.13.5/go.mod h1:wHDZ0IZX6JcBYRK1TH9bcVq8G7TLpVHYIGJRFnmPfxg= +github.com/pkg/sftp v1.13.6 h1:JFZT4XbOU7l77xGSpOdW+pwIMqP044IyjXX6FGyEKFo= +github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= github.com/pkg/xattr v0.4.9 h1:5883YPCtkSd8LFbs13nXplj9g9tlrwoJRjgpgMu1/fE= github.com/pkg/xattr v0.4.9/go.mod h1:di8WF84zAKk8jzR1UBTEWh9AUlIZZ7M/JNt8e9B6ktU= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -339,8 +321,6 @@ github.com/quasilyte/go-consistent v0.0.0-20190521200055-c6f3937de18c/go.mod h1: github.com/robfig/cron/v3 v3.0.1 h1:WdRxkvbJztn8LMz/QEvLN5sBU+xKpSqwwUO1Pjr4qDs= github.com/robfig/cron/v3 v3.0.1/go.mod h1:eQICP3HwyT7UooqI/z+Ov+PtYAWygg1TEWWzGIFLtro= github.com/rogpeppe/fastuuid v1.1.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= -github.com/rogpeppe/fastuuid v1.2.0 h1:Ppwyp6VYCF1nvBTXL3trRso7mXMlRrw9ooo375wvi2s= -github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.1.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -430,14 +410,17 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1: github.com/xeipuuv/gojsonschema v0.0.0-20180618132009-1d523034197f/go.mod h1:5yf86TLmAcydyeJq5YvxkGPE2fm/u4myDekKRoLuqhs= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zitadel/oidc/v2 v2.6.4 h1:bruA+KOFHcGpxr++WgtvR82ZlH54kKituu5xE4wpF7o= -github.com/zitadel/oidc/v2 v2.6.4/go.mod h1:owrsdzRqGvIZjBCY9LY1ZUYJ0mRUbGkQpZ3OskXL4wM= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/zitadel/oidc/v2 v2.10.0 h1:mKCOA1SF7R+XmKmicbOAMY2wxp3szZMuM3IzrkBGplQ= +github.com/zitadel/oidc/v2 v2.10.0/go.mod h1:rEM7F10FKuieuQUlQf9fRoSiTkSs8rx5Dj4SgfsMPWU= go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4= go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/otel v1.17.0 h1:MW+phZ6WZ5/uk2nd93ANk/6yJ+dVrvNWUjGhnnFU5jM= +go.opentelemetry.io/otel/metric v1.17.0 h1:iG6LGVz5Gh+IuO0jmgvpTB6YVrCGngi8QGm+pMd8Pdc= +go.opentelemetry.io/otel/trace v1.17.0 h1:/SWhSRHmDPOImIAetP1QAeMnZYiQXrTy4fMMYOdSKWQ= golang.org/x/crypto v0.0.0-20171113213409-9f005a07e0d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20180723164146-c126467f60eb/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= @@ -446,15 +429,17 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20200220183623-bac4c82f6975/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= -golang.org/x/crypto v0.11.0 h1:6Ewdq3tDic1mg5xRO4milcWCfMVQhI4NkqWWvqejpuA= -golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= +golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck= +golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20170915142106-8351a756f30f/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -470,16 +455,17 @@ golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190912160710-24e19bdeb0f2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200505041828-1ed23360d12c/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201224014010-6772e930b67b/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.12.0 h1:cfawfvKITfUsFCeJIHJrbSxpeu/E81khclypR0GVT50= -golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= +golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8= +golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.10.0 h1:zHCpF2Khkwy4mMB4bv0U37YtJdTGW8jI0glAApi0Kh8= -golang.org/x/oauth2 v0.10.0/go.mod h1:kTpgurOux7LqtuxjuyZa4Gj2gdezIt/jQtGnNFfypQI= +golang.org/x/oauth2 v0.12.0 h1:smVPGxink+n1ZI5pkQa8y6fZT0RW0MgCO5bFpepy4B4= +golang.org/x/oauth2 v0.12.0/go.mod h1:A74bZ3aGXgCY0qaIC9Ahg6Lglin4AMAco8cIv9baba4= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -487,6 +473,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20171026204733-164713f0dfce/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -506,32 +493,35 @@ golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200923182605-d9f96fdee20d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210426230700-d19ff857e887/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220408201424-a24fb2fb8a0f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.10.0 h1:SqMFp9UcQJZa+pmYuAKjd9xq1f0j5rLcDIk0mj4qAsA= -golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.10.0 h1:3R7pNqamzBraeqj/Tj8qt1aQ2HpmlC+Cx/qL/7hn4/c= -golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU= +golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/text v0.0.0-20170915090833-1cbadb444a80/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20170915040203-e531a2a1c15f/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -547,11 +537,11 @@ golang.org/x/tools v0.0.0-20190322203728-c1a832b0ad89/go.mod h1:LCzVGOaR6xXOjkQ3 golang.org/x/tools v0.0.0-20190521203540-521d6ed310dd/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200505023115-26f46d2f7ef8/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.11.0 h1:EMCa6U9S2LtZXLAMoWiR/R8dAQFRqbAitmbJ2UKhoi8= -golang.org/x/tools v0.11.0/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -564,8 +554,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529 h1:DEH99RbiLZhMxrpEJCZ0A+wdTe0EOgou/poSLx9vWf4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20230629202037-9506855d4529/go.mod h1:66JfowdXAEgad5O9NnYcsNPLCPZJD++2L9X0PCMODrA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= @@ -573,8 +563,8 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= -google.golang.org/grpc v1.56.1 h1:z0dNfjIl0VpaZ9iSVjA6daGatAYwPGstTjt5vkRMFkQ= -google.golang.org/grpc v1.56.1/go.mod h1:I9bI3vqKfayGqPUAwGdOSu7kt6oIJLixfffKrpXqQ9s= +google.golang.org/grpc v1.57.0 h1:kfzNeI/klCGD2YPMUlaGNT3pxvYfga7smW3Vth8Zsiw= +google.golang.org/grpc v1.57.0/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -599,27 +589,17 @@ gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20200902074654-038fdea0a05b/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= -gopkg.in/errgo.v1 v1.0.0/go.mod h1:CxwszS/Xz1C49Ucd2i6Zil5UToP1EmyrFhKaMVbg1mk= -gopkg.in/errgo.v1 v1.0.1 h1:oQFRXzZ7CkBGdm1XZm/EbQYaYNNEElNBOd09M6cqNso= -gopkg.in/errgo.v1 v1.0.1/go.mod h1:3NjfXwocQRYAPTq4/fzX+CwUhPRcR/azYRhj8G+LqMo= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4 h1:eyQQg/uGuZ3ndaBhqteakHpVW+dSOPalilfC9RpM2TA= gopkg.in/flosch/pongo2.v3 v3.0.0-20141028000813-5e81b817a0c4/go.mod h1:bJkYqV5pg6+Z7MsSu/hSb1zsPT955hBW2QHLE1jm4wA= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKWaSkCsqBpgog8nAV2xsGOxlo= -gopkg.in/httprequest.v1 v1.2.1 h1:pEPLMdF/gjWHnKxLpuCYaHFjc8vAB2wrYjXrqDVC16E= -gopkg.in/httprequest.v1 v1.2.1/go.mod h1:x2Otw96yda5+8+6ZeWwHIJTFkEHWP/qP8pJOzqEtWPM= -gopkg.in/macaroon.v2 v2.1.0 h1:HZcsjBCzq9t0eBPMKqTN/uSN6JOm78ZJ2INbqcBQOUI= -gopkg.in/macaroon.v2 v2.1.0/go.mod h1:OUb+TQP/OP0WOerC2Jp/3CwhIKyIa9kQjuc7H24e6/o= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= -gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.7/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= From dcf18b479f24b5a2dc759f52ff55b9ebc5416de3 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Mon, 7 Aug 2023 21:43:31 +0200 Subject: [PATCH 03/17] global: Rename files lxd -> incus Signed-off-by: Thomas Hipp --- distrobuilder/{main_lxd.go => main_incus.go} | 0 generators/{lxd-agent.go => incus-agent.go} | 0 image/{lxd.go => incus.go} | 0 image/{lxd_test.go => incus_test.go} | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename distrobuilder/{main_lxd.go => main_incus.go} (100%) rename generators/{lxd-agent.go => incus-agent.go} (100%) rename image/{lxd.go => incus.go} (100%) rename image/{lxd_test.go => incus_test.go} (100%) diff --git a/distrobuilder/main_lxd.go b/distrobuilder/main_incus.go similarity index 100% rename from distrobuilder/main_lxd.go rename to distrobuilder/main_incus.go diff --git a/generators/lxd-agent.go b/generators/incus-agent.go similarity index 100% rename from generators/lxd-agent.go rename to generators/incus-agent.go diff --git a/image/lxd.go b/image/incus.go similarity index 100% rename from image/lxd.go rename to image/incus.go diff --git a/image/lxd_test.go b/image/incus_test.go similarity index 100% rename from image/lxd_test.go rename to image/incus_test.go From 09899ca6cf8950534336922a494ccc12ab4c46b4 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Mon, 7 Aug 2023 22:00:23 +0200 Subject: [PATCH 04/17] main: Rename {build,pack}-lxd to {build,pack}-incus Signed-off-by: Thomas Hipp --- distrobuilder/main.go | 10 ++++----- distrobuilder/main_incus.go | 44 ++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index 8eef008b..30326c75 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -125,7 +125,7 @@ func main() { app := &cobra.Command{ Use: "distrobuilder", - Short: "System container and VM image builder for LXC and LXD", + Short: "System container and VM image builder for LXC and Incus", PersistentPreRun: func(cmd *cobra.Command, args []string) { // Quick checks if os.Geteuid() != 0 { @@ -205,10 +205,10 @@ func main() { app.AddCommand(LXCCmd.commandBuild()) app.AddCommand(LXCCmd.commandPack()) - // LXD sub-commands - LXDCmd := cmdLXD{global: &globalCmd} - app.AddCommand(LXDCmd.commandBuild()) - app.AddCommand(LXDCmd.commandPack()) + // Incus sub-commands + IncusCmd := cmdIncus{global: &globalCmd} + app.AddCommand(IncusCmd.commandBuild()) + app.AddCommand(IncusCmd.commandPack()) // build-dir sub-command buildDirCmd := cmdBuildDir{global: &globalCmd} diff --git a/distrobuilder/main_incus.go b/distrobuilder/main_incus.go index 6f8f4fbe..8f7977e0 100644 --- a/distrobuilder/main_incus.go +++ b/distrobuilder/main_incus.go @@ -21,22 +21,23 @@ import ( "github.com/lxc/distrobuilder/shared" ) -type cmdLXD struct { +type cmdIncus struct { cmdBuild *cobra.Command cmdPack *cobra.Command global *cmdGlobal - flagType string - flagCompression string - flagVM bool - flagImportIntoLXD string + flagType string + flagCompression string + flagVM bool + flagImportIntoIncus string } -func (c *cmdLXD) commandBuild() *cobra.Command { +func (c *cmdIncus) commandBuild() *cobra.Command { c.cmdBuild = &cobra.Command{ - Use: "build-lxd [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-lxd]", - Short: "Build LXD image from scratch", - Long: fmt.Sprintf(`Build LXD image from scratch + Use: "build-incus [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-incus]", + Aliases: []string{"build-lxd"}, + Short: "Build Incus image from scratch", + Long: fmt.Sprintf(`Build Incus image from scratch %s @@ -93,19 +94,18 @@ func (c *cmdLXD) commandBuild() *cobra.Command { c.cmdBuild.Flags().StringVar(&c.flagType, "type", "split", "Type of tarball to create"+"``") c.cmdBuild.Flags().StringVar(&c.flagCompression, "compression", "xz", "Type of compression to use"+"``") c.cmdBuild.Flags().BoolVar(&c.flagVM, "vm", false, "Create a qcow2 image for VMs"+"``") - c.cmdBuild.Flags().StringVar(&c.flagImportIntoLXD, "import-into-lxd", "", "Import built image into LXD"+"``") - c.cmdBuild.Flags().Lookup("import-into-lxd").NoOptDefVal = "-" - c.cmdBuild.Flags().StringVar(&c.global.flagSourcesDir, "sources-dir", filepath.Join(os.TempDir(), "distrobuilder"), "Sources directory for distribution tarballs"+"``") + c.cmdBuild.Flags().StringVar(&c.flagImportIntoIncus, "import-into-incus", "", "Import built image into Incus"+"``") c.cmdBuild.Flags().BoolVar(&c.global.flagKeepSources, "keep-sources", true, "Keep sources after build"+"``") return c.cmdBuild } -func (c *cmdLXD) commandPack() *cobra.Command { +func (c *cmdIncus) commandPack() *cobra.Command { c.cmdPack = &cobra.Command{ - Use: "pack-lxd [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-lxd]", - Short: "Create LXD image from existing rootfs", - Long: fmt.Sprintf(`Create LXD image from existing rootfs + Use: "pack-incus [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-incus]", + Aliases: []string{"pack-lxd"}, + Short: "Create Incus image from existing rootfs", + Long: fmt.Sprintf(`Create Incus image from existing rootfs %s @@ -171,13 +171,13 @@ func (c *cmdLXD) commandPack() *cobra.Command { c.cmdPack.Flags().StringVar(&c.flagType, "type", "split", "Type of tarball to create") c.cmdPack.Flags().StringVar(&c.flagCompression, "compression", "xz", "Type of compression to use") c.cmdPack.Flags().BoolVar(&c.flagVM, "vm", false, "Create a qcow2 image for VMs"+"``") - c.cmdPack.Flags().StringVar(&c.flagImportIntoLXD, "import-into-lxd", "", "Import built image into LXD"+"``") - c.cmdPack.Flags().Lookup("import-into-lxd").NoOptDefVal = "-" + c.cmdPack.Flags().StringVar(&c.flagImportIntoIncus, "import-into-incus", "", "Import built image into Incus"+"``") + c.cmdPack.Flags().Lookup("import-into-incus").NoOptDefVal = "-" return c.cmdPack } -func (c *cmdLXD) runPack(cmd *cobra.Command, args []string, overlayDir string) error { +func (c *cmdIncus) runPack(cmd *cobra.Command, args []string, overlayDir string) error { // Setup the mounts and chroot into the rootfs exitChroot, err := shared.SetupChroot(overlayDir, *c.global.definition, nil) if err != nil { @@ -253,7 +253,7 @@ func (c *cmdLXD) runPack(cmd *cobra.Command, args []string, overlayDir string) e return nil } -func (c *cmdLXD) run(cmd *cobra.Command, args []string, overlayDir string) error { +func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) error { img := image.NewLXDImage(c.global.ctx, overlayDir, c.global.targetDir, c.global.flagCacheDir, *c.global.definition) @@ -447,7 +447,7 @@ func (c *cmdLXD) run(cmd *cobra.Command, args []string, overlayDir string) error return fmt.Errorf("Failed to create LXD image: %w", err) } - importFlag := cmd.Flags().Lookup("import-into-lxd") + importFlag := cmd.Flags().Lookup("import-into-incus") if importFlag.Changed { path := "" @@ -539,7 +539,7 @@ func (c *cmdLXD) run(cmd *cobra.Command, args []string, overlayDir string) error return nil } -func (c *cmdLXD) checkVMDependencies() error { +func (c *cmdIncus) checkVMDependencies() error { dependencies := []string{"btrfs", "mkfs.ext4", "mkfs.vfat", "qemu-img", "rsync", "sgdisk"} for _, dep := range dependencies { From 14c15e78e5687a921eed465c4f2d357678fe553d Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Mon, 7 Aug 2023 22:11:45 +0200 Subject: [PATCH 05/17] generators,image: Rename LXD to Incus Signed-off-by: Thomas Hipp --- distrobuilder/main_incus.go | 4 ++-- generators/cloud-init.go | 4 ++-- generators/cloud-init_test.go | 4 ++-- generators/copy.go | 4 ++-- generators/dump.go | 4 ++-- generators/dump_test.go | 4 ++-- generators/fstab.go | 4 ++-- generators/generators.go | 2 +- generators/hostname.go | 4 ++-- generators/hostname_test.go | 4 ++-- generators/hosts.go | 4 ++-- generators/hosts_test.go | 4 ++-- generators/incus-agent.go | 4 ++-- generators/remove.go | 4 ++-- generators/template.go | 4 ++-- generators/template_test.go | 10 +++++----- image/incus.go | 18 +++++++++--------- image/incus_test.go | 8 ++++---- 18 files changed, 47 insertions(+), 47 deletions(-) diff --git a/distrobuilder/main_incus.go b/distrobuilder/main_incus.go index 8f7977e0..05429a26 100644 --- a/distrobuilder/main_incus.go +++ b/distrobuilder/main_incus.go @@ -254,7 +254,7 @@ func (c *cmdIncus) runPack(cmd *cobra.Command, args []string, overlayDir string) } func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) error { - img := image.NewLXDImage(c.global.ctx, overlayDir, c.global.targetDir, + img := image.NewIncusImage(c.global.ctx, overlayDir, c.global.targetDir, c.global.flagCacheDir, *c.global.definition) imageTargets := shared.ImageTargetUndefined | shared.ImageTargetAll @@ -277,7 +277,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err c.global.logger.WithField("generator", file.Generator).Info("Running generator") - err = generator.RunLXD(img, c.global.definition.Targets.LXD) + err = generator.RunIncus(img, c.global.definition.Targets.LXD) if err != nil { return fmt.Errorf("Failed to create LXD data: %w", err) } diff --git a/generators/cloud-init.go b/generators/cloud-init.go index 9f278073..b96b4c89 100644 --- a/generators/cloud-init.go +++ b/generators/cloud-init.go @@ -66,8 +66,8 @@ func (g *cloudInit) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLX return nil } -// RunLXD creates cloud-init template files. -func (g *cloudInit) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus creates cloud-init template files. +func (g *cloudInit) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { templateDir := filepath.Join(g.cacheDir, "templates") err := os.MkdirAll(templateDir, 0755) diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go index 1ad75be6..019000c7 100644 --- a/generators/cloud-init_test.go +++ b/generators/cloud-init_test.go @@ -76,7 +76,7 @@ func TestCloudInitGeneratorRunLXD(t *testing.T) { }, } - image := image.NewLXDImage(context.TODO(), cacheDir, "", cacheDir, definition) + image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) tests := []struct { name string @@ -148,7 +148,7 @@ config: require.IsType(t, &cloudInit{}, generator) require.NoError(t, err) - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) if !tt.shouldFail { require.NoError(t, err) diff --git a/generators/copy.go b/generators/copy.go index 9ec57f80..40bd8305 100644 --- a/generators/copy.go +++ b/generators/copy.go @@ -21,8 +21,8 @@ func (g *copy) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) er return g.Run() } -// RunLXD copies a file to the container. -func (g *copy) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus copies a file to the container. +func (g *copy) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { return g.Run() } diff --git a/generators/dump.go b/generators/dump.go index a2ac0d3a..84bc9375 100644 --- a/generators/dump.go +++ b/generators/dump.go @@ -33,8 +33,8 @@ func (g *dump) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) er return nil } -// RunLXD dumps content to a file. -func (g *dump) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus dumps content to a file. +func (g *dump) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { content := g.defFile.Content return g.run(content) diff --git a/generators/dump_test.go b/generators/dump_test.go index 80bb1306..98c8da73 100644 --- a/generators/dump_test.go +++ b/generators/dump_test.go @@ -102,7 +102,7 @@ func TestDumpGeneratorRunLXD(t *testing.T) { require.IsType(t, &dump{}, generator) require.NoError(t, err) - err = generator.RunLXD(nil, shared.DefinitionTargetLXD{ + err = generator.RunIncus(nil, shared.DefinitionTargetLXD{ VM: shared.DefinitionTargetLXDVM{ Filesystem: "ext4", }}) @@ -129,7 +129,7 @@ func TestDumpGeneratorRunLXD(t *testing.T) { require.IsType(t, &dump{}, generator) require.NoError(t, err) - err = generator.RunLXD(nil, shared.DefinitionTargetLXD{ + err = generator.RunIncus(nil, shared.DefinitionTargetLXD{ VM: shared.DefinitionTargetLXDVM{ Filesystem: "ext4", }}) diff --git a/generators/fstab.go b/generators/fstab.go index fef16f39..474daa0d 100644 --- a/generators/fstab.go +++ b/generators/fstab.go @@ -19,8 +19,8 @@ func (g *fstab) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) e return errors.New("fstab generator not supported for LXC") } -// RunLXD writes to /etc/fstab. -func (g *fstab) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus writes to /etc/fstab. +func (g *fstab) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { f, err := os.Create(filepath.Join(g.sourceDir, "etc/fstab")) if err != nil { return fmt.Errorf("Failed to create file %q: %w", filepath.Join(g.sourceDir, "etc/fstab"), err) diff --git a/generators/generators.go b/generators/generators.go index 6254f8a2..d14df40b 100644 --- a/generators/generators.go +++ b/generators/generators.go @@ -24,7 +24,7 @@ type generator interface { // Generator interface. type Generator interface { RunLXC(*image.LXCImage, shared.DefinitionTargetLXC) error - RunLXD(*image.LXDImage, shared.DefinitionTargetLXD) error + RunIncus(*image.IncusImage, shared.DefinitionTargetLXD) error Run() error } diff --git a/generators/hostname.go b/generators/hostname.go index 0e813f6a..23aa460d 100644 --- a/generators/hostname.go +++ b/generators/hostname.go @@ -46,8 +46,8 @@ func (g *hostname) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC return nil } -// RunLXD creates a hostname template. -func (g *hostname) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus creates a hostname template. +func (g *hostname) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { // Skip if the file doesn't exist if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil diff --git a/generators/hostname_test.go b/generators/hostname_test.go index e4192b03..6152bcce 100644 --- a/generators/hostname_test.go +++ b/generators/hostname_test.go @@ -61,14 +61,14 @@ func TestHostnameGeneratorRunLXD(t *testing.T) { }, } - image := image.NewLXDImage(context.TODO(), cacheDir, "", cacheDir, definition) + image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) err = os.MkdirAll(filepath.Join(cacheDir, "rootfs", "etc"), 0755) require.NoError(t, err) createTestFile(t, filepath.Join(cacheDir, "rootfs", "etc", "hostname"), "hostname") - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "hostname.tpl"), "{{ container.name }}\n") diff --git a/generators/hosts.go b/generators/hosts.go index 0cf651eb..83b9f881 100644 --- a/generators/hosts.go +++ b/generators/hosts.go @@ -60,8 +60,8 @@ func (g *hosts) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) e return nil } -// RunLXD creates a hosts template. -func (g *hosts) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus creates a hosts template. +func (g *hosts) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { // Skip if the file doesn't exist if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil diff --git a/generators/hosts_test.go b/generators/hosts_test.go index 992f2eff..d53266f5 100644 --- a/generators/hosts_test.go +++ b/generators/hosts_test.go @@ -63,7 +63,7 @@ func TestHostsGeneratorRunLXD(t *testing.T) { }, } - image := image.NewLXDImage(context.TODO(), cacheDir, "", cacheDir, definition) + image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) err = os.MkdirAll(filepath.Join(cacheDir, "rootfs", "etc"), 0755) require.NoError(t, err) @@ -71,7 +71,7 @@ func TestHostsGeneratorRunLXD(t *testing.T) { createTestFile(t, filepath.Join(cacheDir, "rootfs", "etc", "hosts"), "127.0.0.1\tlocalhost\n127.0.0.1\tdistrobuilder\n") - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "hosts.tpl"), diff --git a/generators/incus-agent.go b/generators/incus-agent.go index 5af75b56..57bc9f2e 100644 --- a/generators/incus-agent.go +++ b/generators/incus-agent.go @@ -64,8 +64,8 @@ func (g *lxdAgent) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC return ErrNotSupported } -// RunLXD creates systemd unit files for the lxd-agent. -func (g *lxdAgent) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus creates systemd unit files for the lxd-agent. +func (g *lxdAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { initFile := filepath.Join(g.sourceDir, "sbin", "init") fi, err := os.Lstat(initFile) diff --git a/generators/remove.go b/generators/remove.go index d7ad2376..f943d2d1 100644 --- a/generators/remove.go +++ b/generators/remove.go @@ -17,8 +17,8 @@ func (g *remove) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) return g.Run() } -// RunLXD removes a path. -func (g *remove) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus removes a path. +func (g *remove) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { return g.Run() } diff --git a/generators/template.go b/generators/template.go index c91380be..4e50e79d 100644 --- a/generators/template.go +++ b/generators/template.go @@ -23,8 +23,8 @@ func (g *template) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC return nil } -// RunLXD dumps content to a file. -func (g *template) RunLXD(img *image.LXDImage, target shared.DefinitionTargetLXD) error { +// RunIncus dumps content to a file. +func (g *template) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { templateDir := filepath.Join(g.cacheDir, "templates") err := os.MkdirAll(templateDir, 0755) diff --git a/generators/template_test.go b/generators/template_test.go index 587366f8..865fe8b7 100644 --- a/generators/template_test.go +++ b/generators/template_test.go @@ -35,14 +35,14 @@ func TestTemplateGeneratorRunLXD(t *testing.T) { require.IsType(t, &template{}, generator) require.NoError(t, err) - image := image.NewLXDImage(context.TODO(), cacheDir, "", cacheDir, definition) + image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) err = os.MkdirAll(filepath.Join(cacheDir, "rootfs", "root"), 0755) require.NoError(t, err) createTestFile(t, filepath.Join(cacheDir, "rootfs", "root", "template"), "--test--") - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "template.tpl"), "==test==\n") @@ -72,9 +72,9 @@ func TestTemplateGeneratorRunLXDDefaultWhen(t *testing.T) { require.IsType(t, &template{}, generator) require.NoError(t, err) - image := image.NewLXDImage(context.TODO(), cacheDir, "", cacheDir, definition) + image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) require.NoError(t, err) generator, err = Load("template", nil, cacheDir, rootfsDir, shared.DefinitionFile{ @@ -89,7 +89,7 @@ func TestTemplateGeneratorRunLXDDefaultWhen(t *testing.T) { require.IsType(t, &template{}, generator) require.NoError(t, err) - err = generator.RunLXD(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) require.NoError(t, err) testvalue := []string{"create", "copy"} diff --git a/image/incus.go b/image/incus.go index 72ecc6e9..aa089490 100644 --- a/image/incus.go +++ b/image/incus.go @@ -14,8 +14,8 @@ import ( "github.com/lxc/distrobuilder/shared" ) -// A LXDImage represents a LXD image. -type LXDImage struct { +// An IncusImage represents an Incus image. +type IncusImage struct { sourceDir string targetDir string cacheDir string @@ -24,10 +24,10 @@ type LXDImage struct { ctx context.Context } -// NewLXDImage returns a LXDImage. -func NewLXDImage(ctx context.Context, sourceDir, targetDir, cacheDir string, - definition shared.Definition) *LXDImage { - return &LXDImage{ +// NewIncusImage returns an IncusImage. +func NewIncusImage(ctx context.Context, sourceDir, targetDir, cacheDir string, + definition shared.Definition) *IncusImage { + return &IncusImage{ sourceDir, targetDir, cacheDir, @@ -40,8 +40,8 @@ func NewLXDImage(ctx context.Context, sourceDir, targetDir, cacheDir string, } } -// Build creates a LXD image. -func (l *LXDImage) Build(unified bool, compression string, vm bool) (string, string, error) { +// Build creates an Incus image. +func (l *IncusImage) Build(unified bool, compression string, vm bool) (string, string, error) { err := l.createMetadata() if err != nil { return "", "", fmt.Errorf("Failed to create metadata: %w", err) @@ -171,7 +171,7 @@ func (l *LXDImage) Build(unified bool, compression string, vm bool) (string, str return imageFile, rootfsFile, nil } -func (l *LXDImage) createMetadata() error { +func (l *IncusImage) createMetadata() error { var err error l.Metadata.Architecture = l.definition.Image.Architecture diff --git a/image/incus_test.go b/image/incus_test.go index 5dfa2765..5a53a4d6 100644 --- a/image/incus_test.go +++ b/image/incus_test.go @@ -34,7 +34,7 @@ var lxdDef = shared.Definition{ }, } -func setupLXD(t *testing.T) *LXDImage { +func setupLXD(t *testing.T) *IncusImage { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") err := os.MkdirAll(filepath.Join(cacheDir, "rootfs"), 0755) @@ -43,7 +43,7 @@ func setupLXD(t *testing.T) *LXDImage { err = os.MkdirAll(filepath.Join(cacheDir, "templates"), 0755) require.NoError(t, err) - image := NewLXDImage(context.TODO(), cacheDir, "", cacheDir, lxdDef) + image := NewIncusImage(context.TODO(), cacheDir, "", cacheDir, lxdDef) fail := true defer func() { @@ -77,7 +77,7 @@ func TestLXDBuild(t *testing.T) { testLXDBuildUnifiedImage(t, image) } -func testLXDBuildSplitImage(t *testing.T, image *LXDImage) { +func testLXDBuildSplitImage(t *testing.T, image *IncusImage) { // Create split tarball and squashfs. imageFile, rootfsFile, err := image.Build(false, "xz", false) require.NoError(t, err) @@ -100,7 +100,7 @@ func testLXDBuildSplitImage(t *testing.T, image *LXDImage) { os.Remove("rootfs.squashfs") } -func testLXDBuildUnifiedImage(t *testing.T, image *LXDImage) { +func testLXDBuildUnifiedImage(t *testing.T, image *IncusImage) { // Create unified tarball with custom name. _, _, err := image.Build(true, "xz", false) require.NoError(t, err) From 1cbeeb70b6a2eb288678ba08cfc5ccb67edaa02f Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Mon, 7 Aug 2023 22:31:03 +0200 Subject: [PATCH 06/17] definition: Rename targets.lxd to targets.incus Signed-off-by: Thomas Hipp --- distrobuilder/main_incus.go | 4 ++-- generators/cloud-init.go | 2 +- generators/cloud-init_test.go | 2 +- generators/copy.go | 2 +- generators/dump.go | 2 +- generators/dump_test.go | 18 +++++++++--------- generators/fstab.go | 2 +- generators/generators.go | 2 +- generators/hostname.go | 2 +- generators/hostname_test.go | 2 +- generators/hosts.go | 2 +- generators/hosts_test.go | 2 +- generators/incus-agent.go | 2 +- generators/remove.go | 2 +- generators/template.go | 2 +- generators/template_test.go | 6 +++--- shared/definition.go | 16 ++++++++-------- 17 files changed, 35 insertions(+), 35 deletions(-) diff --git a/distrobuilder/main_incus.go b/distrobuilder/main_incus.go index 05429a26..e8f99218 100644 --- a/distrobuilder/main_incus.go +++ b/distrobuilder/main_incus.go @@ -277,7 +277,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err c.global.logger.WithField("generator", file.Generator).Info("Running generator") - err = generator.RunIncus(img, c.global.definition.Targets.LXD) + err = generator.RunIncus(img, c.global.definition.Targets.Incus) if err != nil { return fmt.Errorf("Failed to create LXD data: %w", err) } @@ -303,7 +303,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err imgFile := filepath.Join(c.global.flagCacheDir, imgFilename) - vm, err = newVM(c.global.ctx, imgFile, vmDir, c.global.definition.Targets.LXD.VM.Filesystem, c.global.definition.Targets.LXD.VM.Size) + vm, err = newVM(c.global.ctx, imgFile, vmDir, c.global.definition.Targets.Incus.VM.Filesystem, c.global.definition.Targets.Incus.VM.Size) if err != nil { return fmt.Errorf("Failed to instantiate VM: %w", err) } diff --git a/generators/cloud-init.go b/generators/cloud-init.go index b96b4c89..6f2460c4 100644 --- a/generators/cloud-init.go +++ b/generators/cloud-init.go @@ -67,7 +67,7 @@ func (g *cloudInit) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLX } // RunIncus creates cloud-init template files. -func (g *cloudInit) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *cloudInit) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { templateDir := filepath.Join(g.cacheDir, "templates") err := os.MkdirAll(templateDir, 0755) diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go index 019000c7..a9790b86 100644 --- a/generators/cloud-init_test.go +++ b/generators/cloud-init_test.go @@ -148,7 +148,7 @@ config: require.IsType(t, &cloudInit{}, generator) require.NoError(t, err) - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) if !tt.shouldFail { require.NoError(t, err) diff --git a/generators/copy.go b/generators/copy.go index 40bd8305..5af2fbb0 100644 --- a/generators/copy.go +++ b/generators/copy.go @@ -22,7 +22,7 @@ func (g *copy) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) er } // RunIncus copies a file to the container. -func (g *copy) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *copy) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { return g.Run() } diff --git a/generators/dump.go b/generators/dump.go index 84bc9375..9b27fb80 100644 --- a/generators/dump.go +++ b/generators/dump.go @@ -34,7 +34,7 @@ func (g *dump) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) er } // RunIncus dumps content to a file. -func (g *dump) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *dump) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { content := g.defFile.Content return g.run(content) diff --git a/generators/dump_test.go b/generators/dump_test.go index 98c8da73..f1277754 100644 --- a/generators/dump_test.go +++ b/generators/dump_test.go @@ -86,8 +86,8 @@ func TestDumpGeneratorRunLXD(t *testing.T) { def := shared.Definition{ Targets: shared.DefinitionTarget{ - LXD: shared.DefinitionTargetLXD{ - VM: shared.DefinitionTargetLXDVM{ + Incus: shared.DefinitionTargetIncus{ + VM: shared.DefinitionTargetIncusVM{ Filesystem: "ext4", }, }, @@ -96,14 +96,14 @@ func TestDumpGeneratorRunLXD(t *testing.T) { generator, err := Load("dump", nil, cacheDir, rootfsDir, shared.DefinitionFile{ Path: "/hello/world", - Content: "hello {{ targets.lxd.vm.filesystem }}", + Content: "hello {{ targets.incus.vm.filesystem }}", Pongo: true, }, def) require.IsType(t, &dump{}, generator) require.NoError(t, err) - err = generator.RunIncus(nil, shared.DefinitionTargetLXD{ - VM: shared.DefinitionTargetLXDVM{ + err = generator.RunIncus(nil, shared.DefinitionTargetIncus{ + VM: shared.DefinitionTargetIncusVM{ Filesystem: "ext4", }}) require.NoError(t, err) @@ -124,13 +124,13 @@ func TestDumpGeneratorRunLXD(t *testing.T) { generator, err = Load("dump", nil, cacheDir, rootfsDir, shared.DefinitionFile{ Path: "/hello/world", - Content: "hello {{ targets.lxd.vm.filesystem }}", + Content: "hello {{ targets.incus.vm.filesystem }}", }, def) require.IsType(t, &dump{}, generator) require.NoError(t, err) - err = generator.RunIncus(nil, shared.DefinitionTargetLXD{ - VM: shared.DefinitionTargetLXDVM{ + err = generator.RunIncus(nil, shared.DefinitionTargetIncus{ + VM: shared.DefinitionTargetIncusVM{ Filesystem: "ext4", }}) require.NoError(t, err) @@ -145,5 +145,5 @@ func TestDumpGeneratorRunLXD(t *testing.T) { _, err = io.Copy(&buffer, file) require.NoError(t, err) - require.Equal(t, "hello {{ targets.lxd.vm.filesystem }}\n", buffer.String()) + require.Equal(t, "hello {{ targets.incus.vm.filesystem }}\n", buffer.String()) } diff --git a/generators/fstab.go b/generators/fstab.go index 474daa0d..6199575c 100644 --- a/generators/fstab.go +++ b/generators/fstab.go @@ -20,7 +20,7 @@ func (g *fstab) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) e } // RunIncus writes to /etc/fstab. -func (g *fstab) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *fstab) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { f, err := os.Create(filepath.Join(g.sourceDir, "etc/fstab")) if err != nil { return fmt.Errorf("Failed to create file %q: %w", filepath.Join(g.sourceDir, "etc/fstab"), err) diff --git a/generators/generators.go b/generators/generators.go index d14df40b..707fef41 100644 --- a/generators/generators.go +++ b/generators/generators.go @@ -24,7 +24,7 @@ type generator interface { // Generator interface. type Generator interface { RunLXC(*image.LXCImage, shared.DefinitionTargetLXC) error - RunIncus(*image.IncusImage, shared.DefinitionTargetLXD) error + RunIncus(*image.IncusImage, shared.DefinitionTargetIncus) error Run() error } diff --git a/generators/hostname.go b/generators/hostname.go index 23aa460d..5e0c9079 100644 --- a/generators/hostname.go +++ b/generators/hostname.go @@ -47,7 +47,7 @@ func (g *hostname) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC } // RunIncus creates a hostname template. -func (g *hostname) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *hostname) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { // Skip if the file doesn't exist if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil diff --git a/generators/hostname_test.go b/generators/hostname_test.go index 6152bcce..25fac905 100644 --- a/generators/hostname_test.go +++ b/generators/hostname_test.go @@ -68,7 +68,7 @@ func TestHostnameGeneratorRunLXD(t *testing.T) { createTestFile(t, filepath.Join(cacheDir, "rootfs", "etc", "hostname"), "hostname") - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "hostname.tpl"), "{{ container.name }}\n") diff --git a/generators/hosts.go b/generators/hosts.go index 83b9f881..d8bd96e7 100644 --- a/generators/hosts.go +++ b/generators/hosts.go @@ -61,7 +61,7 @@ func (g *hosts) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) e } // RunIncus creates a hosts template. -func (g *hosts) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *hosts) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { // Skip if the file doesn't exist if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil diff --git a/generators/hosts_test.go b/generators/hosts_test.go index d53266f5..9ec472d6 100644 --- a/generators/hosts_test.go +++ b/generators/hosts_test.go @@ -71,7 +71,7 @@ func TestHostsGeneratorRunLXD(t *testing.T) { createTestFile(t, filepath.Join(cacheDir, "rootfs", "etc", "hosts"), "127.0.0.1\tlocalhost\n127.0.0.1\tdistrobuilder\n") - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "hosts.tpl"), diff --git a/generators/incus-agent.go b/generators/incus-agent.go index 57bc9f2e..dc2adfb2 100644 --- a/generators/incus-agent.go +++ b/generators/incus-agent.go @@ -65,7 +65,7 @@ func (g *lxdAgent) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC } // RunIncus creates systemd unit files for the lxd-agent. -func (g *lxdAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *lxdAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { initFile := filepath.Join(g.sourceDir, "sbin", "init") fi, err := os.Lstat(initFile) diff --git a/generators/remove.go b/generators/remove.go index f943d2d1..6afb7ecd 100644 --- a/generators/remove.go +++ b/generators/remove.go @@ -18,7 +18,7 @@ func (g *remove) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) } // RunIncus removes a path. -func (g *remove) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *remove) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { return g.Run() } diff --git a/generators/template.go b/generators/template.go index 4e50e79d..14e56f59 100644 --- a/generators/template.go +++ b/generators/template.go @@ -24,7 +24,7 @@ func (g *template) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC } // RunIncus dumps content to a file. -func (g *template) RunIncus(img *image.IncusImage, target shared.DefinitionTargetLXD) error { +func (g *template) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { templateDir := filepath.Join(g.cacheDir, "templates") err := os.MkdirAll(templateDir, 0755) diff --git a/generators/template_test.go b/generators/template_test.go index 865fe8b7..b1b6e303 100644 --- a/generators/template_test.go +++ b/generators/template_test.go @@ -42,7 +42,7 @@ func TestTemplateGeneratorRunLXD(t *testing.T) { createTestFile(t, filepath.Join(cacheDir, "rootfs", "root", "template"), "--test--") - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) require.NoError(t, err) validateTestFile(t, filepath.Join(cacheDir, "templates", "template.tpl"), "==test==\n") @@ -74,7 +74,7 @@ func TestTemplateGeneratorRunLXDDefaultWhen(t *testing.T) { image := image.NewIncusImage(context.TODO(), cacheDir, "", cacheDir, definition) - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) require.NoError(t, err) generator, err = Load("template", nil, cacheDir, rootfsDir, shared.DefinitionFile{ @@ -89,7 +89,7 @@ func TestTemplateGeneratorRunLXDDefaultWhen(t *testing.T) { require.IsType(t, &template{}, generator) require.NoError(t, err) - err = generator.RunIncus(image, shared.DefinitionTargetLXD{}) + err = generator.RunIncus(image, shared.DefinitionTargetIncus{}) require.NoError(t, err) testvalue := []string{"create", "copy"} diff --git a/shared/definition.go b/shared/definition.go index 069c6734..66c4983b 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -184,22 +184,22 @@ type DefinitionTargetLXC struct { Config []DefinitionTargetLXCConfig `yaml:"config,omitempty"` } -// DefinitionTargetLXDVM represents LXD VM specific options. -type DefinitionTargetLXDVM struct { +// DefinitionTargetIncusVM represents Incus VM specific options. +type DefinitionTargetIncusVM struct { Size uint64 `yaml:"size,omitempty"` Filesystem string `yaml:"filesystem,omitempty"` } -// DefinitionTargetLXD represents LXD specific options. -type DefinitionTargetLXD struct { - VM DefinitionTargetLXDVM `yaml:"vm,omitempty"` +// DefinitionTargetIncus represents Incus specific options. +type DefinitionTargetIncus struct { + VM DefinitionTargetIncusVM `yaml:"vm,omitempty"` } // A DefinitionTarget specifies target dependent files. type DefinitionTarget struct { - LXC DefinitionTargetLXC `yaml:"lxc,omitempty"` - LXD DefinitionTargetLXD `yaml:"lxd,omitempty"` - Type DefinitionFilterType // This field is internal only and used only for simplicity. + LXC DefinitionTargetLXC `yaml:"lxc,omitempty"` + Incus DefinitionTargetIncus `yaml:"incus,omitempty"` + Type DefinitionFilterType // This field is internal only and used only for simplicity. } // A DefinitionFile represents a file which is to be created inside to chroot. From 97f7e8b1ce8fff4bd50fe6fc23dfbf3ff52757ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:45:26 -0400 Subject: [PATCH 07/17] global: Rename lxd import to incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- distrobuilder/main.go | 4 ++-- distrobuilder/main_incus.go | 8 ++++---- distrobuilder/main_repack-windows.go | 18 +++++++++--------- distrobuilder/vm.go | 14 +++++++------- generators/cloud-init.go | 8 ++++---- generators/cloud-init_test.go | 6 +++--- generators/copy.go | 4 ++-- generators/hostname.go | 6 +++--- generators/hosts.go | 6 +++--- generators/incus-agent.go | 6 +++--- image/lxc.go | 6 +++--- managers/apt.go | 4 ++-- managers/luet.go | 4 ++-- managers/pacman.go | 6 +++--- managers/yum.go | 4 ++-- shared/archive_linux.go | 10 +++++----- shared/chroot.go | 8 ++++---- shared/definition.go | 8 ++++---- sources/common.go | 6 +++--- sources/common_test.go | 4 ++-- sources/debootstrap.go | 6 +++--- sources/oraclelinux-http.go | 8 ++++---- sources/plamolinux-http.go | 4 ++-- sources/rhel-common.go | 14 +++++++------- sources/utils.go | 4 ++-- 25 files changed, 88 insertions(+), 88 deletions(-) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index 30326c75..6b80784b 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -65,7 +65,7 @@ import ( "strings" "time" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "gopkg.in/yaml.v2" @@ -608,7 +608,7 @@ func getDefinition(fname string, options []string) (*shared.Definition, error) { // addSystemdGenerator creates a systemd-generator which runs on boot, and does some configuration around the system itself and networking. func addSystemdGenerator() error { // Check if container has systemd - if !lxd.PathExists("/etc/systemd") { + if !incus.PathExists("/etc/systemd") { return nil } diff --git a/distrobuilder/main_incus.go b/distrobuilder/main_incus.go index e8f99218..0402e41f 100644 --- a/distrobuilder/main_incus.go +++ b/distrobuilder/main_incus.go @@ -9,7 +9,7 @@ import ( "path/filepath" client "github.com/lxc/incus/client" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/incus/shared/api" "github.com/sirupsen/logrus" "github.com/spf13/cobra" @@ -45,7 +45,7 @@ func (c *cmdIncus) commandBuild() *cobra.Command { `, typeDescription, compressionDescription), Args: cobra.RangeArgs(1, 2), PreRunE: func(cmd *cobra.Command, args []string) error { - if !lxd.StringInSlice(c.flagType, []string{"split", "unified"}) { + if !incus.StringInSlice(c.flagType, []string{"split", "unified"}) { return errors.New("--type needs to be one of ['split', 'unified']") } @@ -113,7 +113,7 @@ func (c *cmdIncus) commandPack() *cobra.Command { `, typeDescription, compressionDescription), Args: cobra.RangeArgs(2, 3), PreRunE: func(cmd *cobra.Command, args []string) error { - if !lxd.StringInSlice(c.flagType, []string{"split", "unified"}) { + if !incus.StringInSlice(c.flagType, []string{"split", "unified"}) { return errors.New("--type needs to be one of ['split', 'unified']") } @@ -452,7 +452,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err if importFlag.Changed { path := "" - if lxd.PathExists("/var/snap/lxd/common/lxd") { + if incus.PathExists("/var/snap/lxd/common/lxd") { path = "/var/snap/lxd/common/lxd/unix.socket" } diff --git a/distrobuilder/main_repack-windows.go b/distrobuilder/main_repack-windows.go index ce6a1be7..43cd58ed 100644 --- a/distrobuilder/main_repack-windows.go +++ b/distrobuilder/main_repack-windows.go @@ -15,7 +15,7 @@ import ( "strings" "github.com/flosch/pongo2" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/sirupsen/logrus" "github.com/spf13/cobra" "golang.org/x/sys/unix" @@ -110,7 +110,7 @@ func (c *cmdRepackWindows) preRun(cmd *cobra.Command, args []string) error { } else { supportedVersions := []string{"w11", "w10", "2k19", "2k12", "2k16", "2k22"} - if !lxd.StringInSlice(c.flagWindowsVersion, supportedVersions) { + if !incus.StringInSlice(c.flagWindowsVersion, supportedVersions) { return fmt.Errorf("Version must be one of %v", supportedVersions) } } @@ -126,7 +126,7 @@ func (c *cmdRepackWindows) preRun(cmd *cobra.Command, args []string) error { } else { supportedArchitectures := []string{"amd64", "ARM64"} - if !lxd.StringInSlice(c.flagWindowsArchitecture, supportedArchitectures) { + if !incus.StringInSlice(c.flagWindowsArchitecture, supportedArchitectures) { return fmt.Errorf("Architecture must be one of %v", supportedArchitectures) } } @@ -191,7 +191,7 @@ func (c *cmdRepackWindows) run(cmd *cobra.Command, args []string, overlayDir str virtioISOPath = filepath.Join(c.global.flagSourcesDir, "windows", "virtio-win.iso") - if !lxd.PathExists(virtioISOPath) { + if !incus.PathExists(virtioISOPath) { err := os.MkdirAll(filepath.Dir(virtioISOPath), 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", filepath.Dir(virtioISOPath), err) @@ -208,7 +208,7 @@ func (c *cmdRepackWindows) run(cmd *cobra.Command, args []string, overlayDir str logger.Info("Downloading drivers ISO") - _, err = lxd.DownloadFileHash(c.global.ctx, &client, "", nil, nil, "virtio-win.iso", virtioURL, "", nil, f) + _, err = incus.DownloadFileHash(c.global.ctx, &client, "", nil, nil, "virtio-win.iso", virtioURL, "", nil, f) if err != nil { f.Close() os.Remove(virtioISOPath) @@ -219,7 +219,7 @@ func (c *cmdRepackWindows) run(cmd *cobra.Command, args []string, overlayDir str } } - if !lxd.PathExists(driverPath) { + if !incus.PathExists(driverPath) { err := os.MkdirAll(driverPath, 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", driverPath, err) @@ -354,7 +354,7 @@ func (c *cmdRepackWindows) modifyWim(path string, index int) error { wimFile := filepath.Join(path) wimPath := filepath.Join(c.global.flagCacheDir, "wim") - if !lxd.PathExists(wimPath) { + if !incus.PathExists(wimPath) { err := os.MkdirAll(wimPath, 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", wimPath, err) @@ -542,7 +542,7 @@ func (c *cmdRepackWindows) injectDrivers(dirs map[string]string) error { sourceDir := filepath.Join(driverPath, driver, c.flagWindowsVersion, c.flagWindowsArchitecture) targetBasePath := filepath.Join(dirs["filerepository"], info.PackageName) - if !lxd.PathExists(targetBasePath) { + if !incus.PathExists(targetBasePath) { err := os.MkdirAll(targetBasePath, 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", targetBasePath, err) @@ -554,7 +554,7 @@ func (c *cmdRepackWindows) injectDrivers(dirs map[string]string) error { targetPath := filepath.Join(targetBasePath, filepath.Base(path)) // Copy driver files - if lxd.StringInSlice(ext, []string{".cat", ".dll", ".inf", ".sys"}) { + if incus.StringInSlice(ext, []string{".cat", ".dll", ".inf", ".sys"}) { logger.WithFields(logrus.Fields{"src": path, "dest": targetPath}).Debug("Copying file") err := shared.Copy(path, targetPath) diff --git a/distrobuilder/vm.go b/distrobuilder/vm.go index 01b86da3..6bad51db 100644 --- a/distrobuilder/vm.go +++ b/distrobuilder/vm.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "github.com/lxc/distrobuilder/shared" @@ -29,7 +29,7 @@ func newVM(ctx context.Context, imageFile, rootfsDir, fs string, size uint64) (* fs = "ext4" } - if !lxd.StringInSlice(fs, []string{"btrfs", "ext4"}) { + if !incus.StringInSlice(fs, []string{"btrfs", "ext4"}) { return nil, fmt.Errorf("Unsupported fs: %s", fs) } @@ -124,7 +124,7 @@ func (v *vm) mountImage() error { deviceNumbers := strings.Split(out.String(), "\n") - if !lxd.PathExists(v.getUEFIDevFile()) { + if !incus.PathExists(v.getUEFIDevFile()) { fields := strings.Split(deviceNumbers[1], ":") major, err := strconv.Atoi(fields[0]) @@ -145,7 +145,7 @@ func (v *vm) mountImage() error { } } - if !lxd.PathExists(v.getRootfsDevFile()) { + if !incus.PathExists(v.getRootfsDevFile()) { fields := strings.Split(deviceNumbers[2], ":") major, err := strconv.Atoi(fields[0]) @@ -171,7 +171,7 @@ func (v *vm) mountImage() error { func (v *vm) umountImage() error { // If loopDevice is empty, the image probably isn't mounted. - if v.loopDevice == "" || !lxd.PathExists(v.loopDevice) { + if v.loopDevice == "" || !incus.PathExists(v.loopDevice) { return nil } @@ -181,14 +181,14 @@ func (v *vm) umountImage() error { } // Make sure that p1 and p2 are also removed. - if lxd.PathExists(v.getUEFIDevFile()) { + if incus.PathExists(v.getUEFIDevFile()) { err := os.Remove(v.getUEFIDevFile()) if err != nil { return fmt.Errorf("Failed to remove file %q: %w", v.getUEFIDevFile(), err) } } - if lxd.PathExists(v.getRootfsDevFile()) { + if incus.PathExists(v.getRootfsDevFile()) { err := os.Remove(v.getRootfsDevFile()) if err != nil { return fmt.Errorf("Failed to remove file %q: %w", v.getRootfsDevFile(), err) diff --git a/generators/cloud-init.go b/generators/cloud-init.go index 6f2460c4..d2c1cf3f 100644 --- a/generators/cloud-init.go +++ b/generators/cloud-init.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" @@ -23,13 +23,13 @@ func (g *cloudInit) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLX // Remove all symlinks to /etc/init.d/cloud-{init-local,config,init,final} in /etc/runlevels/* fullPath := filepath.Join(g.sourceDir, "etc", "runlevels") - if lxd.PathExists(fullPath) { + if incus.PathExists(fullPath) { err := filepath.Walk(fullPath, func(path string, info os.FileInfo, err error) error { if info.IsDir() { return nil } - if lxd.StringInSlice(info.Name(), []string{"cloud-init-local", "cloud-config", "cloud-init", "cloud-final"}) { + if incus.StringInSlice(info.Name(), []string{"cloud-init-local", "cloud-config", "cloud-init", "cloud-final"}) { err := os.Remove(path) if err != nil { return fmt.Errorf("Failed to remove file %q: %w", path, err) @@ -46,7 +46,7 @@ func (g *cloudInit) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLX // With systemd: path := filepath.Join(g.sourceDir, "/etc/cloud") - if !lxd.PathExists(path) { + if !incus.PathExists(path) { err := os.MkdirAll(path, 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", path, err) diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go index a9790b86..6f3b4ec8 100644 --- a/generators/cloud-init_test.go +++ b/generators/cloud-init_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/stretchr/testify/require" "github.com/lxc/distrobuilder/image" @@ -47,7 +47,7 @@ func TestCloudInitGeneratorRunLXC(t *testing.T) { // Check whether the generator has altered the rootfs for _, f := range []string{"cloud-init-local", "cloud-config", "cloud-init", "cloud-final"} { fullPath := filepath.Join(rootfsDir, "etc", "runlevels", f) - require.Falsef(t, lxd.PathExists(fullPath), "File '%s' exists but shouldn't", fullPath) + require.Falsef(t, incus.PathExists(fullPath), "File '%s' exists but shouldn't", fullPath) } for i := 0; i <= 6; i++ { @@ -55,7 +55,7 @@ func TestCloudInitGeneratorRunLXC(t *testing.T) { for _, f := range []string{"cloud-init-local", "cloud-config", "cloud-init", "cloud-final"} { fullPath := filepath.Join(dir, fmt.Sprintf("S99%s", f)) - require.Falsef(t, lxd.PathExists(fullPath), "File '%s' exists but shouldn't", fullPath) + require.Falsef(t, incus.PathExists(fullPath), "File '%s' exists but shouldn't", fullPath) } } diff --git a/generators/copy.go b/generators/copy.go index 5af2fbb0..978d1349 100644 --- a/generators/copy.go +++ b/generators/copy.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" @@ -173,7 +173,7 @@ func (g *copy) copyFile(src, dest string, defFile shared.DefinitionFile) error { return fmt.Errorf("Failed to create directory %q: %w", dir, err) } - err = lxd.FileCopy(src, dest) + err = incus.FileCopy(src, dest) if err != nil { return fmt.Errorf("Failed to copy file %q to %q: %w", src, dest, err) } diff --git a/generators/hostname.go b/generators/hostname.go index 5e0c9079..1ac44500 100644 --- a/generators/hostname.go +++ b/generators/hostname.go @@ -5,7 +5,7 @@ import ( "os" "path/filepath" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" @@ -19,7 +19,7 @@ type hostname struct { // RunLXC creates a hostname template. func (g *hostname) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) error { // Skip if the file doesn't exist - if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { + if !incus.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil } @@ -49,7 +49,7 @@ func (g *hostname) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC // RunIncus creates a hostname template. func (g *hostname) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { // Skip if the file doesn't exist - if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { + if !incus.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil } diff --git a/generators/hosts.go b/generators/hosts.go index d8bd96e7..c81dfa2f 100644 --- a/generators/hosts.go +++ b/generators/hosts.go @@ -6,7 +6,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/incus/shared/api" "github.com/lxc/distrobuilder/image" @@ -20,7 +20,7 @@ type hosts struct { // RunLXC creates a LXC specific entry in the hosts file. func (g *hosts) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) error { // Skip if the file doesn't exist - if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { + if !incus.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil } @@ -63,7 +63,7 @@ func (g *hosts) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) e // RunIncus creates a hosts template. func (g *hosts) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { // Skip if the file doesn't exist - if !lxd.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { + if !incus.PathExists(filepath.Join(g.sourceDir, g.defFile.Path)) { return nil } diff --git a/generators/incus-agent.go b/generators/incus-agent.go index dc2adfb2..a2fb076e 100644 --- a/generators/incus-agent.go +++ b/generators/incus-agent.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/image" "github.com/lxc/distrobuilder/shared" @@ -100,7 +100,7 @@ func (g *lxdAgent) Run() error { func (g *lxdAgent) handleSystemd() error { systemdPath := filepath.Join("/", "lib", "systemd") - if !lxd.PathExists(filepath.Join(g.sourceDir, systemdPath)) { + if !incus.PathExists(filepath.Join(g.sourceDir, systemdPath)) { systemdPath = filepath.Join("/", "usr", "lib", "systemd") } @@ -146,7 +146,7 @@ WantedBy=multi-user.target udevPath := filepath.Join("/", "lib", "udev", "rules.d") stat, err := os.Lstat(filepath.Join(g.sourceDir, "lib", "udev")) - if err == nil && stat.Mode()&os.ModeSymlink != 0 || !lxd.PathExists(filepath.Dir(filepath.Join(g.sourceDir, udevPath))) { + if err == nil && stat.Mode()&os.ModeSymlink != 0 || !incus.PathExists(filepath.Dir(filepath.Join(g.sourceDir, udevPath))) { udevPath = filepath.Join("/", "usr", "lib", "udev", "rules.d") } diff --git a/image/lxc.go b/image/lxc.go index 65ad221f..60963a0d 100644 --- a/image/lxc.go +++ b/image/lxc.go @@ -8,7 +8,7 @@ import ( "strings" "time" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -152,7 +152,7 @@ func (l *LXCImage) createMetadata() error { var excludesUser string - if lxd.PathExists(filepath.Join(l.sourceDir, "dev")) { + if incus.PathExists(filepath.Join(l.sourceDir, "dev")) { err := filepath.Walk(filepath.Join(l.sourceDir, "dev"), func(path string, info os.FileInfo, err error) error { if err != nil { @@ -192,7 +192,7 @@ func (l *LXCImage) packMetadata() error { files = append(files, filepath.Base(c)) } - if lxd.PathExists(filepath.Join(l.cacheDir, "metadata", "templates")) { + if incus.PathExists(filepath.Join(l.cacheDir, "metadata", "templates")) { files = append(files, "templates") } diff --git a/managers/apt.go b/managers/apt.go index 0e6f41de..46a49b1d 100644 --- a/managers/apt.go +++ b/managers/apt.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -63,7 +63,7 @@ func (m *apt) manageRepository(repoAction shared.DefinitionPackagesRepository) e } } - if !lxd.PathExists(filepath.Dir(targetFile)) { + if !incus.PathExists(filepath.Dir(targetFile)) { err := os.MkdirAll(filepath.Dir(targetFile), 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", filepath.Dir(targetFile), err) diff --git a/managers/luet.go b/managers/luet.go index 04e042df..b6d2628d 100644 --- a/managers/luet.go +++ b/managers/luet.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -64,7 +64,7 @@ func (m *luet) manageRepository(repoAction shared.DefinitionPackagesRepository) targetFile = filepath.Join("/etc/luet/repos.conf.d", repoAction.Name+".yml") } - if !lxd.PathExists(filepath.Dir(targetFile)) { + if !incus.PathExists(filepath.Dir(targetFile)) { err := os.MkdirAll(filepath.Dir(targetFile), 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", filepath.Dir(targetFile), err) diff --git a/managers/pacman.go b/managers/pacman.go index 1e298b52..c76b612e 100644 --- a/managers/pacman.go +++ b/managers/pacman.go @@ -6,7 +6,7 @@ import ( "path/filepath" "runtime" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -100,7 +100,7 @@ func (m *pacman) setupTrustedKeys() error { var keyring string - if lxd.StringInSlice(runtime.GOARCH, []string{"arm", "arm64"}) { + if incus.StringInSlice(runtime.GOARCH, []string{"arm", "arm64"}) { keyring = "archlinuxarm" } else { keyring = "archlinux" @@ -124,7 +124,7 @@ func (m *pacman) setMirrorlist() error { var mirror string - if lxd.StringInSlice(runtime.GOARCH, []string{"arm", "arm64"}) { + if incus.StringInSlice(runtime.GOARCH, []string{"arm", "arm64"}) { mirror = "Server = http://mirror.archlinuxarm.org/$arch/$repo" } else { mirror = "Server = http://mirrors.kernel.org/archlinux/$repo/os/$arch" diff --git a/managers/yum.go b/managers/yum.go index 59b268f1..f4cb6879 100644 --- a/managers/yum.go +++ b/managers/yum.go @@ -8,7 +8,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -81,7 +81,7 @@ func yumManageRepository(repoAction shared.DefinitionPackagesRepository) error { targetFile = fmt.Sprintf("%s.repo", targetFile) } - if !lxd.PathExists(filepath.Dir(targetFile)) { + if !incus.PathExists(filepath.Dir(targetFile)) { err := os.MkdirAll(filepath.Dir(targetFile), 0755) if err != nil { return fmt.Errorf("Failed to create directory %q: %w", filepath.Dir(targetFile), err) diff --git a/shared/archive_linux.go b/shared/archive_linux.go index bdc5b39d..6eacf1bf 100644 --- a/shared/archive_linux.go +++ b/shared/archive_linux.go @@ -8,13 +8,13 @@ import ( "os" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "golang.org/x/sys/unix" ) // Unpack unpacks a tarball. func Unpack(file string, path string) error { - extractArgs, extension, _, err := lxd.DetectCompression(file) + extractArgs, extension, _, err := incus.DetectCompression(file) if err != nil { return err } @@ -45,7 +45,7 @@ func Unpack(file string, path string) error { // Limit unsquashfs chunk size to 10% of memory and up to 256MB (default) // When running on a low memory system, also disable multi-processing - mem, err := lxd.DeviceTotalMemory() + mem, err := incus.DeviceTotalMemory() mem = mem / 1024 / 1024 / 10 if err == nil && mem < 256 { args = append(args, "-da", fmt.Sprintf("%d", mem), "-fr", fmt.Sprintf("%d", mem), "-p", "1") @@ -56,11 +56,11 @@ func Unpack(file string, path string) error { return fmt.Errorf("Unsupported image format: %s", extension) } - err = lxd.RunCommandWithFds(context.TODO(), reader, nil, command, args...) + err = incus.RunCommandWithFds(context.TODO(), reader, nil, command, args...) if err != nil { // We can't create char/block devices in unpriv containers so ignore related errors. if command == "unsquashfs" { - var runError *lxd.RunError + var runError *incus.RunError ok := errors.As(err, &runError) if !ok || runError.StdErr().String() == "" { diff --git a/shared/chroot.go b/shared/chroot.go index f91a448e..108f133d 100644 --- a/shared/chroot.go +++ b/shared/chroot.go @@ -7,7 +7,7 @@ import ( "regexp" "strconv" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "golang.org/x/sys/unix" ) @@ -91,7 +91,7 @@ func moveMounts(mounts []ChrootMount) error { // If the target's parent directory is a symlink, we need to resolve that as well. targetDir := filepath.Dir(target) - if lxd.PathExists(targetDir) { + if incus.PathExists(targetDir) { // Get information on current target fi, err := os.Lstat(targetDir) if err != nil { @@ -305,7 +305,7 @@ func SetupChroot(rootfs string, definition Definition, m []ChrootMount) (func() // Setup policy-rc.d override policyCleanup := false - if lxd.PathExists("/usr/sbin/") && !lxd.PathExists("/usr/sbin/policy-rc.d") { + if incus.PathExists("/usr/sbin/") && !incus.PathExists("/usr/sbin/policy-rc.d") { err = os.WriteFile("/usr/sbin/policy-rc.d", []byte(`#!/bin/sh exit 101 `), 0755) @@ -394,7 +394,7 @@ func populateDev() error { } for _, d := range devs { - if lxd.PathExists(d.Path) { + if incus.PathExists(d.Path) { continue } diff --git a/shared/definition.go b/shared/definition.go index 66c4983b..058e093b 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -9,7 +9,7 @@ import ( "time" "github.com/lxc/incus/shared" - lxdarch "github.com/lxc/incus/shared/osarch" + incusArch "github.com/lxc/incus/shared/osarch" ) // ImageTarget represents the image target. @@ -506,19 +506,19 @@ func (d *Definition) Validate() error { d.Image.ArchitectureMapped = archMapped // Kernel architecture and personality - archID, err := lxdarch.ArchitectureId(d.Image.Architecture) + archID, err := incusArch.ArchitectureId(d.Image.Architecture) if err != nil { return fmt.Errorf("Failed to get architecture ID: %w", err) } - archName, err := lxdarch.ArchitectureName(archID) + archName, err := incusArch.ArchitectureName(archID) if err != nil { return fmt.Errorf("Failed to get architecture name: %w", err) } d.Image.ArchitectureKernel = archName - archPersonality, err := lxdarch.ArchitecturePersonality(archID) + archPersonality, err := incusArch.ArchitecturePersonality(archID) if err != nil { return fmt.Errorf("Failed to get architecture personality: %w", err) } diff --git a/sources/common.go b/sources/common.go index f1644476..5f48e376 100644 --- a/sources/common.go +++ b/sources/common.go @@ -13,7 +13,7 @@ import ( "strings" "time" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/incus/shared/ioprogress" "github.com/sirupsen/logrus" @@ -145,7 +145,7 @@ func (s *common) DownloadHash(def shared.DefinitionImage, file, checksum string, if checksum == "" { err = shared.Retry(func() error { - _, err = lxd.DownloadFileHash(s.ctx, s.client, "distrobuilder", progress, nil, imagePath, file, "", nil, image) + _, err = incus.DownloadFileHash(s.ctx, s.client, "distrobuilder", progress, nil, imagePath, file, "", nil, image) if err != nil { os.Remove(imagePath) } @@ -160,7 +160,7 @@ func (s *common) DownloadHash(def shared.DefinitionImage, file, checksum string, hashFunc.Reset() } - _, err = lxd.DownloadFileHash(s.ctx, s.client, "distrobuilder", progress, nil, imagePath, file, h, hashFunc, image) + _, err = incus.DownloadFileHash(s.ctx, s.client, "distrobuilder", progress, nil, imagePath, file, h, hashFunc, image) if err == nil { break } diff --git a/sources/common_test.go b/sources/common_test.go index a253f277..6011952b 100644 --- a/sources/common_test.go +++ b/sources/common_test.go @@ -8,7 +8,7 @@ import ( "path/filepath" "testing" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/stretchr/testify/require" "github.com/lxc/distrobuilder/shared" @@ -137,6 +137,6 @@ func TestCreateGPGKeyring(t *testing.T) { keyring, err = c.CreateGPGKeyring() require.NoError(t, err) - require.False(t, lxd.PathExists(keyring), "File should not exist") + require.False(t, incus.PathExists(keyring), "File should not exist") os.RemoveAll(path.Dir(keyring)) } diff --git a/sources/debootstrap.go b/sources/debootstrap.go index 294b99d9..bd86cc7b 100644 --- a/sources/debootstrap.go +++ b/sources/debootstrap.go @@ -7,7 +7,7 @@ import ( "path/filepath" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "github.com/lxc/distrobuilder/shared" ) @@ -24,7 +24,7 @@ func (s *debootstrap) Run() error { release := strings.ToLower(s.definition.Image.Release) // Enable merged /usr by default, and disable it for certain distros/releases - if distro == "ubuntu" && lxd.StringInSlice(release, []string{"xenial", "bionic"}) || distro == "mint" && lxd.StringInSlice(release, []string{"tara", "tessa", "tina", "tricia", "ulyana"}) || distro == "devuan" { + if distro == "ubuntu" && incus.StringInSlice(release, []string{"xenial", "bionic"}) || distro == "mint" && incus.StringInSlice(release, []string{"tara", "tessa", "tina", "tricia", "ulyana"}) || distro == "devuan" { args = append(args, "--no-merged-usr") } else { args = append(args, "--merged-usr") @@ -86,7 +86,7 @@ func (s *debootstrap) Run() error { // If s.definition.Source.SameAs is set, create a symlink in /usr/share/debootstrap/scripts // pointing release to s.definition.Source.SameAs. scriptPath := filepath.Join("/usr/share/debootstrap/scripts", s.definition.Image.Release) - if !lxd.PathExists(scriptPath) && s.definition.Source.SameAs != "" { + if !incus.PathExists(scriptPath) && s.definition.Source.SameAs != "" { err := os.Symlink(s.definition.Source.SameAs, scriptPath) if err != nil { return fmt.Errorf("Failed to create symlink: %w", err) diff --git a/sources/oraclelinux-http.go b/sources/oraclelinux-http.go index 4f66585c..7a337afb 100644 --- a/sources/oraclelinux-http.go +++ b/sources/oraclelinux-http.go @@ -10,7 +10,7 @@ import ( "sort" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "gopkg.in/antchfx/htmlquery.v1" @@ -158,7 +158,7 @@ func (s *oraclelinux) unpackISO(latestUpdate, filePath, rootfsDir string) error var rootfsImage string squashfsImage := filepath.Join(isoDir, "LiveOS", "squashfs.img") - if lxd.PathExists(squashfsImage) { + if incus.PathExists(squashfsImage) { // The squashfs.img contains an image containing the rootfs, so first // mount squashfs.img err = shared.RunCommand(s.ctx, nil, nil, "mount", "-t", "squashfs", "-o", "ro", squashfsImage, squashfsDir) @@ -242,7 +242,7 @@ func (s *oraclelinux) unpackISO(latestUpdate, filePath, rootfsDir string) error defer f.Close() - _, err = lxd.DownloadFileHash(s.ctx, http.DefaultClient, "", nil, nil, elem[0], elem[1], "", nil, f) + _, err = incus.DownloadFileHash(s.ctx, http.DefaultClient, "", nil, nil, elem[0], elem[1], "", nil, f) if err != nil { return fmt.Errorf("Failed to download %q: %w", elem[1], err) } @@ -257,7 +257,7 @@ func (s *oraclelinux) unpackISO(latestUpdate, filePath, rootfsDir string) error return fmt.Errorf("Failed to setup chroot: %w", err) } - if !lxd.PathExists("/bin") && lxd.PathExists("/usr/bin") { + if !incus.PathExists("/bin") && incus.PathExists("/usr/bin") { err = os.Symlink("/usr/bin", "/bin") if err != nil { return fmt.Errorf("Failed to create /bin symlink: %w", err) diff --git a/sources/plamolinux-http.go b/sources/plamolinux-http.go index 686a8711..7ee6f5e6 100644 --- a/sources/plamolinux-http.go +++ b/sources/plamolinux-http.go @@ -9,7 +9,7 @@ import ( "strconv" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "gopkg.in/antchfx/htmlquery.v1" "github.com/lxc/distrobuilder/shared" @@ -152,7 +152,7 @@ func (s *plamolinux) downloadFiles(def shared.DefinitionImage, URL string, ignor if strings.HasSuffix(target, ".txz") || strings.HasSuffix(target, ".tzst") { pkgName := strings.Split(target, "-")[0] - if lxd.StringInSlice(pkgName, ignoredPkgs) { + if incus.StringInSlice(pkgName, ignoredPkgs) { continue } diff --git a/sources/rhel-common.go b/sources/rhel-common.go index 73c6ceab..b860082b 100644 --- a/sources/rhel-common.go +++ b/sources/rhel-common.go @@ -8,7 +8,7 @@ import ( "strconv" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" "golang.org/x/sys/unix" "github.com/lxc/distrobuilder/shared" @@ -52,7 +52,7 @@ func (c *commonRHEL) unpackISO(filePath, rootfsDir string, scriptRunner func(str var rootfsImage string squashfsImage := filepath.Join(isoDir, "LiveOS", "squashfs.img") - if lxd.PathExists(squashfsImage) { + if incus.PathExists(squashfsImage) { // The squashfs.img contains an image containing the rootfs, so first // mount squashfs.img err = shared.RunCommand(c.ctx, nil, nil, "mount", "-t", "squashfs", "-o", "ro", squashfsImage, squashfsDir) @@ -88,15 +88,15 @@ func (c *commonRHEL) unpackISO(filePath, rootfsDir string, scriptRunner func(str packagesDir := filepath.Join(isoDir, "Packages") repodataDir := filepath.Join(isoDir, "repodata") - if !lxd.PathExists(packagesDir) { + if !incus.PathExists(packagesDir) { packagesDir = filepath.Join(isoDir, "BaseOS", "Packages") } - if !lxd.PathExists(repodataDir) { + if !incus.PathExists(repodataDir) { repodataDir = filepath.Join(isoDir, "BaseOS", "repodata") } - if lxd.PathExists(packagesDir) { + if incus.PathExists(packagesDir) { entries, err := os.ReadDir(packagesDir) if err != nil { return fmt.Errorf("Failed reading directory %q: %w", packagesDir, err) @@ -110,7 +110,7 @@ func (c *commonRHEL) unpackISO(filePath, rootfsDir string, scriptRunner func(str } } - if lxd.PathExists(packagesDir) && lxd.PathExists(repodataDir) { + if incus.PathExists(packagesDir) && incus.PathExists(repodataDir) { // Create cdrom repo for yum err = os.MkdirAll(filepath.Join(tempRootDir, "mnt", "cdrom"), 0755) if err != nil { @@ -209,7 +209,7 @@ func (c *commonRHEL) unpackRootfsImage(imageFile string, target string) error { rootfsDir := installDir rootfsFile := filepath.Join(installDir, "LiveOS", "rootfs.img") - if lxd.PathExists(rootfsFile) { + if incus.PathExists(rootfsFile) { rootfsDir, err = os.MkdirTemp(c.cacheDir, "temp_") if err != nil { return fmt.Errorf("Failed to create temporary directory: %w", err) diff --git a/sources/utils.go b/sources/utils.go index a8729f96..2c8b7a7d 100644 --- a/sources/utils.go +++ b/sources/utils.go @@ -15,7 +15,7 @@ import ( "regexp" "strings" - lxd "github.com/lxc/incus/shared" + incus "github.com/lxc/incus/shared" ) // downloadChecksum downloads or opens URL, and matches fname against the @@ -46,7 +46,7 @@ func downloadChecksum(ctx context.Context, client *http.Client, targetDir string done := make(chan struct{}) defer close(done) - _, err = lxd.DownloadFileHash(ctx, client, "distrobuilder", nil, nil, "", URL, "", hashFunc, tempFile) + _, err = incus.DownloadFileHash(ctx, client, "distrobuilder", nil, nil, "", URL, "", hashFunc, tempFile) // ignore hash mismatch if err != nil && !strings.HasPrefix(err.Error(), "Hash mismatch") { return nil, err From a04aeb1d5c9e947baf7b28a04ad578a1dbea9a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:48:31 -0400 Subject: [PATCH 08/17] sphinx: Change URL to Incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .sphinx/conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.sphinx/conf.py b/.sphinx/conf.py index 7e976ec9..cf16f757 100644 --- a/.sphinx/conf.py +++ b/.sphinx/conf.py @@ -36,7 +36,7 @@ myst_heading_anchors = 7 intersphinx_mapping = { - 'lxd': ('https://documentation.ubuntu.com/lxd/en/latest/', None) + 'incus': ('https://linuxcontainers.org/incus/docs/main/', None) } if os.path.exists("../doc/substitutions.yaml"): From 390b6b4cd972f120e72d6784ab43e81f5830b4d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:48:39 -0400 Subject: [PATCH 09/17] README: Update for Incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 1716f176..5e90b47f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # distrobuilder -System container and VM image builder for LXC and LXD +System container and VM image builder for Incus and LXC. + +Incus images may also be compatible with Canonical's LXD. ## Status Type | Service | Status @@ -11,22 +13,22 @@ Project status | CII Best Practices | [![CII Best Practices](https://bestpra ## Command line options -The following are the command line options of `distrobuilder`. You can use `distrobuilder` to create container images for both LXC and LXD. +The following are the command line options of `distrobuilder`. You can use `distrobuilder` to create container images for both Incus and LXC. ```bash $ distrobuilder -System container and VM image builder for LXC and LXD +System container and VM image builder for Incus and LXC Usage: distrobuilder [command] Available Commands: build-dir Build plain rootfs + build-incus Build Incus image from scratch build-lxc Build LXC image from scratch - build-lxd Build LXD image from scratch help Help about any command + pack-incus Create Incus image from existing rootfs pack-lxc Create LXC image from existing rootfs - pack-lxd Create LXD image from existing rootfs repack-windows Repack Windows ISO with drivers included Flags: From 7040c48fd2ccdb0599d7b3969ef3b1bce3ec5374 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 16:54:35 -0400 Subject: [PATCH 10/17] global: Rename output files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- doc/howto/build.md | 2 +- doc/tutorials/use.md | 6 +++--- image/incus.go | 4 ++-- image/incus_test.go | 16 ++++++++-------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/doc/howto/build.md b/doc/howto/build.md index affe9700..b1acce7e 100644 --- a/doc/howto/build.md +++ b/doc/howto/build.md @@ -137,7 +137,7 @@ Global Flags: Running the `build-lxd` sub-command creates a LXD image. If `--type=split`, it outputs two files. -The metadata tarball will always be named `lxd.tar.xz`. +The metadata tarball will always be named `incus.tar.xz`. When creating a container image, the second file will be `rootfs.squashfs`. When creating a VM image, the second file will be `disk.qcow2`. If `--type=unified`, a unified tarball named `.tar.xz` is created. diff --git a/doc/tutorials/use.md b/doc/tutorials/use.md index 3281e039..7fd7cee6 100644 --- a/doc/tutorials/use.md +++ b/doc/tutorials/use.md @@ -76,12 +76,12 @@ To build an image for LXD, run `distrobuilder`. We are using the `build-lxd` opt See {ref}`howto-build-lxd` for more information about the `build-lxd` command. -If the command is successful, you will get an output similar to the following (for a container image). The `lxd.tar.xz` file is the description of the container image. The `rootfs.squasfs` file is the root file system (rootfs) of the container image. The set of these two files is the _container image_. +If the command is successful, you will get an output similar to the following (for a container image). The `incus.tar.xz` file is the description of the container image. The `rootfs.squasfs` file is the root file system (rootfs) of the container image. The set of these two files is the _container image_. ```bash $ ls -l total 100960 --rw-r--r-- 1 root root 676 Oct 3 16:15 lxd.tar.xz +-rw-r--r-- 1 root root 676 Oct 3 16:15 incus.tar.xz -rw-r--r-- 1 root root 103370752 Oct 3 16:15 rootfs.squashfs -rw-r--r-- 1 ubuntu ubuntu 7449 Oct 3 16:03 ubuntu.yaml $ @@ -92,7 +92,7 @@ $ To add the image to a LXD installation, use the `lxc image import` command as follows. ```bash -$ lxc image import lxd.tar.xz rootfs.squashfs --alias mycontainerimage +$ lxc image import incus.tar.xz rootfs.squashfs --alias mycontainerimage Image imported with fingerprint: 009349195858651a0f883de804e64eb82e0ac8c0bc51880 ``` diff --git a/image/incus.go b/image/incus.go index aa089490..f94d5ac3 100644 --- a/image/incus.go +++ b/image/incus.go @@ -78,7 +78,7 @@ func (l *IncusImage) Build(unified bool, compression string, vm bool) (string, s fname, _ = shared.RenderTemplate(l.definition.Image.Name, l.definition) } else { // Default name for the unified tarball. - fname = "lxd" + fname = "incus" } rawImage := filepath.Join(l.cacheDir, fmt.Sprintf("%s.raw", fname)) @@ -161,7 +161,7 @@ func (l *IncusImage) Build(unified bool, compression string, vm bool) (string, s } // Create metadata tarball. - imageFile, err = shared.Pack(l.ctx, filepath.Join(l.targetDir, "lxd.tar"), compression, + imageFile, err = shared.Pack(l.ctx, filepath.Join(l.targetDir, "incus.tar"), compression, l.cacheDir, paths...) if err != nil { return "", "", fmt.Errorf("Failed to create metadata tarball: %w", err) diff --git a/image/incus_test.go b/image/incus_test.go index 5a53a4d6..84281209 100644 --- a/image/incus_test.go +++ b/image/incus_test.go @@ -81,22 +81,22 @@ func testLXDBuildSplitImage(t *testing.T, image *IncusImage) { // Create split tarball and squashfs. imageFile, rootfsFile, err := image.Build(false, "xz", false) require.NoError(t, err) - require.FileExists(t, "lxd.tar.xz") + require.FileExists(t, "incus.tar.xz") require.FileExists(t, "rootfs.squashfs") require.Equal(t, "rootfs.squashfs", filepath.Base(rootfsFile)) - require.Equal(t, "lxd.tar.xz", filepath.Base(imageFile)) + require.Equal(t, "incus.tar.xz", filepath.Base(imageFile)) - os.Remove("lxd.tar.xz") + os.Remove("incus.tar.xz") os.Remove("rootfs.squashfs") imageFile, rootfsFile, err = image.Build(false, "gzip", false) require.NoError(t, err) - require.FileExists(t, "lxd.tar.gz") + require.FileExists(t, "incus.tar.gz") require.FileExists(t, "rootfs.squashfs") require.Equal(t, "rootfs.squashfs", filepath.Base(rootfsFile)) - require.Equal(t, "lxd.tar.gz", filepath.Base(imageFile)) + require.Equal(t, "incus.tar.gz", filepath.Base(imageFile)) - os.Remove("lxd.tar.gz") + os.Remove("incus.tar.gz") os.Remove("rootfs.squashfs") } @@ -118,9 +118,9 @@ func testLXDBuildUnifiedImage(t *testing.T, image *IncusImage) { image.definition.Image.Name = "" _, _, err = image.Build(true, "xz", false) require.NoError(t, err) - defer os.Remove("lxd.tar.xz") + defer os.Remove("incus.tar.xz") - require.FileExists(t, "lxd.tar.xz") + require.FileExists(t, "incus.tar.xz") } func TestLXDCreateMetadata(t *testing.T) { From 118c7d550e67d4cdaeb280e3792a493b3e8921cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:08:24 -0400 Subject: [PATCH 11/17] Rename lxd-agent to incus-agent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- doc/examples/ubuntu.yaml | 4 +- doc/reference/generators.md | 6 +- generators/generators.go | 21 ++++--- generators/incus-agent.go | 109 ++++++++++++++++++++---------------- image/incus_test.go | 48 ++++++++-------- shared/definition.go | 4 +- 6 files changed, 103 insertions(+), 89 deletions(-) diff --git a/doc/examples/ubuntu.yaml b/doc/examples/ubuntu.yaml index 71959334..425c8cce 100644 --- a/doc/examples/ubuntu.yaml +++ b/doc/examples/ubuntu.yaml @@ -139,8 +139,8 @@ files: types: - vm -- name: lxd-agent - generator: lxd-agent +- name: incus-agent + generator: incus-agent types: - vm diff --git a/doc/reference/generators.md b/doc/reference/generators.md index 241703a6..d4a20ea6 100644 --- a/doc/reference/generators.md +++ b/doc/reference/generators.md @@ -10,7 +10,7 @@ Available generators are * [`hosts`](#hosts) * [`remove`](#remove) * [`template`](#template) -* [`lxd-agent`](#lxd-agent) +* [`incus-agent`](#incus-agent) * [`fstab`](#fstab) In the image definition YAML, they are listed under `files`. @@ -108,9 +108,9 @@ The `when` key can be one or more of: See {ref}`lxd:image-format` in the LXD documentation for more information. -## `lxd-agent` +## `incus-agent` -This generator creates the `systemd` unit files which are needed to start the `lxd-agent` in LXD VMs. +This generator creates the `systemd` unit files which are needed to start the `incus-agent` in LXD VMs. ## `fstab` diff --git a/generators/generators.go b/generators/generators.go index 707fef41..5af13e4f 100644 --- a/generators/generators.go +++ b/generators/generators.go @@ -29,15 +29,18 @@ type Generator interface { } var generators = map[string]func() generator{ - "cloud-init": func() generator { return &cloudInit{} }, - "copy": func() generator { return ©{} }, - "dump": func() generator { return &dump{} }, - "fstab": func() generator { return &fstab{} }, - "hostname": func() generator { return &hostname{} }, - "hosts": func() generator { return &hosts{} }, - "lxd-agent": func() generator { return &lxdAgent{} }, - "remove": func() generator { return &remove{} }, - "template": func() generator { return &template{} }, + "cloud-init": func() generator { return &cloudInit{} }, + "copy": func() generator { return ©{} }, + "dump": func() generator { return &dump{} }, + "fstab": func() generator { return &fstab{} }, + "hostname": func() generator { return &hostname{} }, + "hosts": func() generator { return &hosts{} }, + "incus-agent": func() generator { return &incusAgent{} }, + "remove": func() generator { return &remove{} }, + "template": func() generator { return &template{} }, + + // Legacy. + "lxd-agent": func() generator { return &incusAgent{} }, } // Load loads and initializes a generator. diff --git a/generators/incus-agent.go b/generators/incus-agent.go index a2fb076e..1b94da78 100644 --- a/generators/incus-agent.go +++ b/generators/incus-agent.go @@ -14,9 +14,9 @@ import ( "github.com/lxc/distrobuilder/shared" ) -var lxdAgentSetupScript = `#!/bin/sh +var incusAgentSetupScript = `#!/bin/sh set -eu -PREFIX="/run/lxd_agent" +PREFIX="/run/incus_agent" # Functions. mount_virtiofs() { @@ -53,19 +53,26 @@ rmdir "${PREFIX}/.mnt" # Fix up permissions. chown -R root:root "${PREFIX}" + +# Legacy. +if [ -e "${PREFIX}/lxd-agent" ]; then + ln -s lxd-agent "${PREFIX}"/incus-agent +fi + +exit 0 ` -type lxdAgent struct { +type incusAgent struct { common } // RunLXC is not supported. -func (g *lxdAgent) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) error { +func (g *incusAgent) RunLXC(img *image.LXCImage, target shared.DefinitionTargetLXC) error { return ErrNotSupported } -// RunIncus creates systemd unit files for the lxd-agent. -func (g *lxdAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { +// RunIncus creates systemd unit files for the agent. +func (g *incusAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTargetIncus) error { initFile := filepath.Join(g.sourceDir, "sbin", "init") fi, err := os.Lstat(initFile) @@ -94,28 +101,28 @@ func (g *lxdAgent) RunIncus(img *image.IncusImage, target shared.DefinitionTarge } // Run does nothing. -func (g *lxdAgent) Run() error { +func (g *incusAgent) Run() error { return nil } -func (g *lxdAgent) handleSystemd() error { +func (g *incusAgent) handleSystemd() error { systemdPath := filepath.Join("/", "lib", "systemd") if !incus.PathExists(filepath.Join(g.sourceDir, systemdPath)) { systemdPath = filepath.Join("/", "usr", "lib", "systemd") } - lxdAgentServiceUnit := fmt.Sprintf(`[Unit] -Description=LXD - agent -Documentation=https://documentation.ubuntu.com/lxd/en/latest/ -ConditionPathExists=/dev/virtio-ports/org.linuxcontainers.lxd + incusAgentServiceUnit := fmt.Sprintf(`[Unit] +Description=Incus - agent +Documentation=https://linuxcontainers.org/incus/docs/main/ +ConditionPathExistsGlob=/dev/virtio-ports/org.linuxcontainers.* Before=cloud-init.target cloud-init.service cloud-init-local.service DefaultDependencies=no [Service] Type=notify -WorkingDirectory=-/run/lxd_agent -ExecStartPre=%s/lxd-agent-setup -ExecStart=/run/lxd_agent/lxd-agent +WorkingDirectory=-/run/incus_agent +ExecStartPre=%s/incus-agent-setup +ExecStart=/run/incus_agent/incus-agent Restart=on-failure RestartSec=5s StartLimitInterval=60 @@ -125,21 +132,21 @@ StartLimitBurst=10 WantedBy=multi-user.target `, systemdPath) - path := filepath.Join(g.sourceDir, systemdPath, "system", "lxd-agent.service") + path := filepath.Join(g.sourceDir, systemdPath, "system", "incus-agent.service") - err := os.WriteFile(path, []byte(lxdAgentServiceUnit), 0644) + err := os.WriteFile(path, []byte(incusAgentServiceUnit), 0644) if err != nil { return fmt.Errorf("Failed to write file %q: %w", path, err) } - err = os.Symlink(path, filepath.Join(g.sourceDir, "/etc/systemd/system/multi-user.target.wants/lxd-agent.service")) + err = os.Symlink(path, filepath.Join(g.sourceDir, "/etc/systemd/system/multi-user.target.wants/incus-agent.service")) if err != nil { - return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/systemd/system/multi-user.target.wants/lxd-agent.service"), err) + return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/systemd/system/multi-user.target.wants/incus-agent.service"), err) } - path = filepath.Join(g.sourceDir, systemdPath, "lxd-agent-setup") + path = filepath.Join(g.sourceDir, systemdPath, "incus-agent-setup") - err = os.WriteFile(path, []byte(lxdAgentSetupScript), 0755) + err = os.WriteFile(path, []byte(incusAgentSetupScript), 0755) if err != nil { return fmt.Errorf("Failed to write file %q: %w", path, err) } @@ -150,65 +157,69 @@ WantedBy=multi-user.target udevPath = filepath.Join("/", "usr", "lib", "udev", "rules.d") } - lxdAgentRules := `ACTION=="add", SYMLINK=="virtio-ports/org.linuxcontainers.lxd", TAG+="systemd" -SYMLINK=="virtio-ports/org.linuxcontainers.lxd", RUN+="/bin/systemctl start lxd-agent.service" + incusAgentRules := `ACTION=="add", SYMLINK=="virtio-ports/org.linuxcontainers.incus", TAG+="systemd" +SYMLINK=="virtio-ports/org.linuxcontainers.incus", RUN+="/bin/systemctl start incus-agent.service" + +# Legacy. +ACTION=="add", SYMLINK=="virtio-ports/org.linuxcontainers.lxd", TAG+="systemd" +SYMLINK=="virtio-ports/org.linuxcontainers.lxd", RUN+="/bin/systemctl start incus-agent.service" ` - err = os.WriteFile(filepath.Join(g.sourceDir, udevPath, "99-lxd-agent.rules"), []byte(lxdAgentRules), 0400) + err = os.WriteFile(filepath.Join(g.sourceDir, udevPath, "99-incus-agent.rules"), []byte(incusAgentRules), 0400) if err != nil { - return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, udevPath, "99-lxd-agent.rules"), err) + return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, udevPath, "99-incus-agent.rules"), err) } return nil } -func (g *lxdAgent) handleOpenRC() error { - lxdAgentScript := `#!/sbin/openrc-run +func (g *incusAgent) handleOpenRC() error { + incusAgentScript := `#!/sbin/openrc-run -description="LXD - agent" -command=/run/lxd_agent/lxd-agent +description="Incus - agent" +command=/run/incus_agent/incus-agent command_background=true -pidfile=/run/lxd-agent.pid -start_stop_daemon_args="--chdir /run/lxd_agent" -required_dirs=/run/lxd_agent +pidfile=/run/incus-agent.pid +start_stop_daemon_args="--chdir /run/incus_agent" +required_dirs=/run/incus_agent depend() { - need lxd-agent-setup - after lxd-agent-setup + need incus-agent-setup + after incus-agent-setup before cloud-init before cloud-init-local } ` - err := os.WriteFile(filepath.Join(g.sourceDir, "/etc/init.d/lxd-agent"), []byte(lxdAgentScript), 0755) + err := os.WriteFile(filepath.Join(g.sourceDir, "/etc/init.d/incus-agent"), []byte(incusAgentScript), 0755) if err != nil { - return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, "/etc/init.d/lxd-agent"), err) + return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, "/etc/init.d/incus-agent"), err) } - err = os.Symlink("/etc/init.d/lxd-agent", filepath.Join(g.sourceDir, "/etc/runlevels/default/lxd-agent")) + err = os.Symlink("/etc/init.d/incus-agent", filepath.Join(g.sourceDir, "/etc/runlevels/default/incus-agent")) if err != nil { - return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/runlevels/default/lxd-agent"), err) + return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/runlevels/default/incus-agent"), err) } - lxdConfigShareMountScript := `#!/sbin/openrc-run + incusConfigShareMountScript := `#!/sbin/openrc-run -description="LXD - agent - setup" -command=/usr/local/bin/lxd-agent-setup -required_files=/dev/virtio-ports/org.linuxcontainers.lxd +description="Incus - agent - setup" +command=/usr/local/bin/incus-agent-setup +required_dirs=/dev/virtio-ports/ ` - err = os.WriteFile(filepath.Join(g.sourceDir, "/etc/init.d/lxd-agent-setup"), []byte(lxdConfigShareMountScript), 0755) + err = os.WriteFile(filepath.Join(g.sourceDir, "/etc/init.d/incus-agent-setup"), []byte(incusConfigShareMountScript), 0755) if err != nil { - return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, "/etc/init.d/lxd-agent-setup"), err) + return fmt.Errorf("Failed to write file %q: %w", filepath.Join(g.sourceDir, "/etc/init.d/incus-agent-setup"), err) } - err = os.Symlink("/etc/init.d/lxd-agent-setup", filepath.Join(g.sourceDir, "/etc/runlevels/default/lxd-agent-setup")) + err = os.Symlink("/etc/init.d/incus-agent-setup", filepath.Join(g.sourceDir, "/etc/runlevels/default/incus-agent-setup")) if err != nil { - return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/runlevels/default/lxd-agent-setup"), err) + return fmt.Errorf("Failed to create symlink %q: %w", filepath.Join(g.sourceDir, "/etc/runlevels/default/incus-agent-setup"), err) } - path := filepath.Join(g.sourceDir, "/usr/local/bin", "lxd-agent-setup") + path := filepath.Join(g.sourceDir, "/usr/local/bin", "incus-agent-setup") - err = os.WriteFile(path, []byte(lxdAgentSetupScript), 0755) + err = os.WriteFile(path, []byte(incusAgentSetupScript), 0755) if err != nil { return fmt.Errorf("Failed to write file %q: %w", path, err) } @@ -216,7 +227,7 @@ required_files=/dev/virtio-ports/org.linuxcontainers.lxd return nil } -func (g *lxdAgent) getInitSystemFromInittab() error { +func (g *incusAgent) getInitSystemFromInittab() error { f, err := os.Open(filepath.Join(g.sourceDir, "etc", "inittab")) if err != nil { return fmt.Errorf("Failed to open file %q: %w", filepath.Join(g.sourceDir, "etc", "inittab"), err) diff --git a/image/incus_test.go b/image/incus_test.go index 84281209..34660573 100644 --- a/image/incus_test.go +++ b/image/incus_test.go @@ -16,7 +16,7 @@ import ( "github.com/lxc/distrobuilder/shared" ) -var lxdDef = shared.Definition{ +var incusDef = shared.Definition{ Image: shared.DefinitionImage{ Description: "{{ image.distribution|capfirst }} {{ image. release }}", Distribution: "ubuntu", @@ -34,7 +34,7 @@ var lxdDef = shared.Definition{ }, } -func setupLXD(t *testing.T) *IncusImage { +func setupIncus(t *testing.T) *IncusImage { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") err := os.MkdirAll(filepath.Join(cacheDir, "rootfs"), 0755) @@ -43,41 +43,41 @@ func setupLXD(t *testing.T) *IncusImage { err = os.MkdirAll(filepath.Join(cacheDir, "templates"), 0755) require.NoError(t, err) - image := NewIncusImage(context.TODO(), cacheDir, "", cacheDir, lxdDef) + image := NewIncusImage(context.TODO(), cacheDir, "", cacheDir, incusDef) fail := true defer func() { if fail { - teardownLXD(t) + teardownIncus(t) } }() // Check cache directory require.Equal(t, cacheDir, image.cacheDir) - require.Equal(t, lxdDef, image.definition) + require.Equal(t, incusDef, image.definition) - lxdDef.SetDefaults() + incusDef.SetDefaults() - err = lxdDef.Validate() + err = incusDef.Validate() require.NoError(t, err) fail = false return image } -func teardownLXD(t *testing.T) { +func teardownIncus(t *testing.T) { os.RemoveAll(filepath.Join(os.TempDir(), "distrobuilder-test")) } -func TestLXDBuild(t *testing.T) { - image := setupLXD(t) - defer teardownLXD(t) +func TestIncusBuild(t *testing.T) { + image := setupIncus(t) + defer teardownIncus(t) - testLXDBuildSplitImage(t, image) - testLXDBuildUnifiedImage(t, image) + testIncusBuildSplitImage(t, image) + testIncusBuildUnifiedImage(t, image) } -func testLXDBuildSplitImage(t *testing.T, image *IncusImage) { +func testIncusBuildSplitImage(t *testing.T, image *IncusImage) { // Create split tarball and squashfs. imageFile, rootfsFile, err := image.Build(false, "xz", false) require.NoError(t, err) @@ -100,7 +100,7 @@ func testLXDBuildSplitImage(t *testing.T, image *IncusImage) { os.Remove("rootfs.squashfs") } -func testLXDBuildUnifiedImage(t *testing.T, image *IncusImage) { +func testIncusBuildUnifiedImage(t *testing.T, image *IncusImage) { // Create unified tarball with custom name. _, _, err := image.Build(true, "xz", false) require.NoError(t, err) @@ -123,9 +123,9 @@ func testLXDBuildUnifiedImage(t *testing.T, image *IncusImage) { require.FileExists(t, "incus.tar.xz") } -func TestLXDCreateMetadata(t *testing.T) { - image := setupLXD(t) - defer teardownLXD(t) +func TestIncusCreateMetadata(t *testing.T) { + image := setupIncus(t) + defer teardownIncus(t) err := image.createMetadata() require.NoError(t, err) @@ -148,24 +148,24 @@ func TestLXDCreateMetadata(t *testing.T) { { "Properties[os]", image.Metadata.Properties["os"], - lxdDef.Image.Distribution, + incusDef.Image.Distribution, }, { "Properties[release]", image.Metadata.Properties["release"], - lxdDef.Image.Release, + incusDef.Image.Release, }, { "Properties[description]", image.Metadata.Properties["description"], - fmt.Sprintf("%s %s", cases.Title(language.English).String(lxdDef.Image.Distribution), - lxdDef.Image.Release), + fmt.Sprintf("%s %s", cases.Title(language.English).String(incusDef.Image.Distribution), + incusDef.Image.Release), }, { "Properties[name]", image.Metadata.Properties["name"], - fmt.Sprintf("%s-%s-%s-%s", strings.ToLower(lxdDef.Image.Distribution), - lxdDef.Image.Release, "x86_64", lxdDef.Image.Serial), + fmt.Sprintf("%s-%s-%s-%s", strings.ToLower(incusDef.Image.Distribution), + incusDef.Image.Release, "x86_64", incusDef.Image.Serial), }, } diff --git a/shared/definition.go b/shared/definition.go index 058e093b..0b039270 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -345,7 +345,7 @@ func (d *Definition) SetDefaults() { d.Image.Description = "{{ image.distribution|capfirst }} {{ image.release }} {{ image.architecture_mapped }}{% if image.variant != \"default\" %} ({{ image.variant }}){% endif %} ({{ image.serial }})" } - // Set default target type. This will only be overridden if building VMs for LXD. + // Set default target type. This will only be overridden if building VMs for Incus. d.Targets.Type = DefinitionFilterTypeContainer } @@ -443,7 +443,7 @@ func (d *Definition) Validate() error { "hosts", "remove", "cloud-init", - "lxd-agent", + "incus-agent", "fstab", } From fd0717d00685a08df27155b14813fba8f7d4f2f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:11:05 -0400 Subject: [PATCH 12/17] global: Rename build-lxd to build-incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- distrobuilder/main.go | 6 +++--- doc/howto/build.md | 10 +++++----- doc/reference/actions.md | 2 +- doc/tutorials/use.md | 8 ++++---- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index 6b80784b..ce38fa49 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -355,7 +355,7 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error { // only these sections will be processed. imageTargets := shared.ImageTargetUndefined - // If we're running either build-lxc or build-lxd, include types which are + // If we're running either build-lxc or build-incus, include types which are // meant for all. if !isRunningBuildDir { imageTargets |= shared.ImageTargetAll @@ -365,9 +365,9 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error { case "build-lxc": // If we're running build-lxc, also process container-only sections. imageTargets |= shared.ImageTargetContainer - case "build-lxd": + case "build-incus": // Include either container-specific or vm-specific sections when - // running build-lxd. + // running build-incus. ok, err := cmd.Flags().GetBool("vm") if err != nil { return fmt.Errorf(`Failed to get bool value of "vm": %w`, err) diff --git a/doc/howto/build.md b/doc/howto/build.md index b1acce7e..89158b20 100644 --- a/doc/howto/build.md +++ b/doc/howto/build.md @@ -85,11 +85,11 @@ After building the image, the rootfs will be destroyed. The `pack-lxc` sub-command can be used to create an image from an existing rootfs. The rootfs won't be deleted afterwards. -(howto-build-lxd)= +(howto-build-incus)= ## LXD image ```shell -$ distrobuilder build-lxd --help +$ distrobuilder build-incus --help Build LXD image from scratch Depending on the type, it either outputs a unified (single tarball) @@ -114,11 +114,11 @@ For supported compression methods, a compression level can be specified with method-N, where N is an integer, e.g. gzip-9. Usage: - distrobuilder build-lxd [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-lxd] [flags] + distrobuilder build-incus [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-lxd] [flags] Flags: --compression Type of compression to use (default "xz") - -h, --help help for build-lxd + -h, --help help for build-incus --import-into-lxd[="-"] Import built image into LXD --keep-sources Keep sources after build (default true) --sources-dir Sources directory for distribution tarballs (default "/tmp/distrobuilder") @@ -135,7 +135,7 @@ Global Flags: --version Print version number ``` -Running the `build-lxd` sub-command creates a LXD image. +Running the `build-incus` sub-command creates a LXD image. If `--type=split`, it outputs two files. The metadata tarball will always be named `incus.tar.xz`. When creating a container image, the second file will be `rootfs.squashfs`. diff --git a/doc/reference/actions.md b/doc/reference/actions.md index 36af85c2..7254ecbb 100644 --- a/doc/reference/actions.md +++ b/doc/reference/actions.md @@ -30,5 +30,5 @@ After the package manager has installed the requested packages, all `post-packag For more on `packages`, see [packages](packages.md). And last, after the `files` section has been processed, all `post-files` actions are run. -This action runs only for `build-lxc`, `build-lxd`, `pack-lxc`, and `pack-lxd`. +This action runs only for `build-lxc`, `build-incus`, `pack-lxc`, and `pack-lxd`. For more on `files`, see [generators](generators.md). diff --git a/doc/tutorials/use.md b/doc/tutorials/use.md index 7fd7cee6..4456650f 100644 --- a/doc/tutorials/use.md +++ b/doc/tutorials/use.md @@ -60,21 +60,21 @@ The steps for building and launching the image depend on whether you want to use ### Create an image for LXD -To build an image for LXD, run `distrobuilder`. We are using the `build-lxd` option to create an image for LXD. +To build an image for LXD, run `distrobuilder`. We are using the `build-incus` option to create an image for LXD. - To create a container image: ``` - sudo $HOME/go/bin/distrobuilder build-lxd ubuntu.yaml + sudo $HOME/go/bin/distrobuilder build-incus ubuntu.yaml ``` - To create a VM image: ``` - sudo $HOME/go/bin/distrobuilder build-lxd ubuntu.yaml --vm + sudo $HOME/go/bin/distrobuilder build-incus ubuntu.yaml --vm ``` -See {ref}`howto-build-lxd` for more information about the `build-lxd` command. +See {ref}`howto-build-incus` for more information about the `build-incus` command. If the command is successful, you will get an output similar to the following (for a container image). The `incus.tar.xz` file is the description of the container image. The `rootfs.squasfs` file is the root file system (rootfs) of the container image. The set of these two files is the _container image_. From 62ceccc39a35a5e7bc9f5f83717a8d46768eacf3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:11:41 -0400 Subject: [PATCH 13/17] global: Rename pack-lxd to pack-incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- doc/howto/build.md | 4 ++-- doc/reference/actions.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/howto/build.md b/doc/howto/build.md index 89158b20..f9e248fb 100644 --- a/doc/howto/build.md +++ b/doc/howto/build.md @@ -34,7 +34,7 @@ In that case one can simply run ```shell distrobuilder build-dir def.yaml /path/to/rootfs distrobuilder pack-lxc def.yaml /path/to/rootfs /path/to/output -distrobuilder pack-lxd def.yaml /path/to/rootfs /path/to/output +distrobuilder pack-incus def.yaml /path/to/rootfs /path/to/output ``` (howto-build-lxc)= @@ -154,5 +154,5 @@ This can be changed by calling it as `--import-into-lxd=`. After building the image, the rootfs will be destroyed. -The `pack-lxd` sub-command can be used to create an image from an existing rootfs. +The `pack-incus` sub-command can be used to create an image from an existing rootfs. The rootfs won't be deleted afterwards. diff --git a/doc/reference/actions.md b/doc/reference/actions.md index 7254ecbb..b6c611d0 100644 --- a/doc/reference/actions.md +++ b/doc/reference/actions.md @@ -30,5 +30,5 @@ After the package manager has installed the requested packages, all `post-packag For more on `packages`, see [packages](packages.md). And last, after the `files` section has been processed, all `post-files` actions are run. -This action runs only for `build-lxc`, `build-incus`, `pack-lxc`, and `pack-lxd`. +This action runs only for `build-lxc`, `build-incus`, `pack-lxc`, and `pack-incus`. For more on `files`, see [generators](generators.md). From 3f90c7fa74e72e5bcd90bb0c17f4b13cace59d00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:15:26 -0400 Subject: [PATCH 14/17] generators: Remove mentions of LXD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- generators/cloud-init.go | 2 +- generators/cloud-init_test.go | 2 +- generators/dump_test.go | 2 +- generators/hostname.go | 2 +- generators/hostname_test.go | 2 +- generators/hosts_test.go | 2 +- generators/template.go | 4 ++-- generators/template_test.go | 4 ++-- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/generators/cloud-init.go b/generators/cloud-init.go index d2c1cf3f..11e54e48 100644 --- a/generators/cloud-init.go +++ b/generators/cloud-init.go @@ -165,7 +165,7 @@ config: targetPath = g.defFile.Path } - // Add to LXD templates + // Add to Incus templates img.Metadata.Templates[targetPath] = &api.ImageMetadataTemplate{ Template: template, Properties: properties, diff --git a/generators/cloud-init_test.go b/generators/cloud-init_test.go index 6f3b4ec8..0d6b4bab 100644 --- a/generators/cloud-init_test.go +++ b/generators/cloud-init_test.go @@ -62,7 +62,7 @@ func TestCloudInitGeneratorRunLXC(t *testing.T) { require.FileExists(t, filepath.Join(rootfsDir, "etc", "cloud", "cloud-init.disabled")) } -func TestCloudInitGeneratorRunLXD(t *testing.T) { +func TestCloudInitGeneratorRunIncus(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") diff --git a/generators/dump_test.go b/generators/dump_test.go index f1277754..e7d842d8 100644 --- a/generators/dump_test.go +++ b/generators/dump_test.go @@ -77,7 +77,7 @@ func TestDumpGeneratorRunLXC(t *testing.T) { require.Equal(t, "hello {{ targets.lxc.create_message }}\n", buffer.String()) } -func TestDumpGeneratorRunLXD(t *testing.T) { +func TestDumpGeneratorRunIncus(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") diff --git a/generators/hostname.go b/generators/hostname.go index 1ac44500..688f86b7 100644 --- a/generators/hostname.go +++ b/generators/hostname.go @@ -72,7 +72,7 @@ func (g *hostname) RunIncus(img *image.IncusImage, target shared.DefinitionTarge return fmt.Errorf("Failed to write to hostname file: %w", err) } - // Add to LXD templates + // Add to Incus templates img.Metadata.Templates[g.defFile.Path] = &api.ImageMetadataTemplate{ Template: "hostname.tpl", Properties: g.defFile.Template.Properties, diff --git a/generators/hostname_test.go b/generators/hostname_test.go index 25fac905..7637cc07 100644 --- a/generators/hostname_test.go +++ b/generators/hostname_test.go @@ -43,7 +43,7 @@ func TestHostnameGeneratorRunLXC(t *testing.T) { validateTestFile(t, filepath.Join(cacheDir, "rootfs", "etc", "hostname"), "LXC_NAME\n") } -func TestHostnameGeneratorRunLXD(t *testing.T) { +func TestHostnameGeneratorRunIncus(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") diff --git a/generators/hosts_test.go b/generators/hosts_test.go index 9ec472d6..39f9d900 100644 --- a/generators/hosts_test.go +++ b/generators/hosts_test.go @@ -45,7 +45,7 @@ func TestHostsGeneratorRunLXC(t *testing.T) { "127.0.0.1\tlocalhost\n127.0.0.1\tLXC_NAME\n") } -func TestHostsGeneratorRunLXD(t *testing.T) { +func TestHostsGeneratorRunIncus(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") diff --git a/generators/template.go b/generators/template.go index 14e56f59..5ff9559a 100644 --- a/generators/template.go +++ b/generators/template.go @@ -54,7 +54,7 @@ func (g *template) RunIncus(img *image.IncusImage, target shared.DefinitionTarge return fmt.Errorf("Failed to parse template: %w", err) } - content, err = tpl.Execute(pongo2.Context{"lxd": target}) + content, err = tpl.Execute(pongo2.Context{"incus": target}) if err != nil { return fmt.Errorf("Failed to execute template: %w", err) } @@ -65,7 +65,7 @@ func (g *template) RunIncus(img *image.IncusImage, target shared.DefinitionTarge return fmt.Errorf("Failed to write to content to %s template: %w", g.defFile.Name, err) } - // Add to LXD templates + // Add to Incus templates img.Metadata.Templates[g.defFile.Path] = &api.ImageMetadataTemplate{ Template: template, Properties: g.defFile.Template.Properties, diff --git a/generators/template_test.go b/generators/template_test.go index b1b6e303..e5d2e5e7 100644 --- a/generators/template_test.go +++ b/generators/template_test.go @@ -12,7 +12,7 @@ import ( "github.com/lxc/distrobuilder/shared" ) -func TestTemplateGeneratorRunLXD(t *testing.T) { +func TestTemplateGeneratorRunIncus(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") @@ -49,7 +49,7 @@ func TestTemplateGeneratorRunLXD(t *testing.T) { validateTestFile(t, filepath.Join(cacheDir, "rootfs", "root", "template"), "--test--") } -func TestTemplateGeneratorRunLXDDefaultWhen(t *testing.T) { +func TestTemplateGeneratorRunIncusDefaultWhen(t *testing.T) { cacheDir := filepath.Join(os.TempDir(), "distrobuilder-test") rootfsDir := filepath.Join(cacheDir, "rootfs") From defd22f5a241a8370cb1bc0d5d481241e72b1d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:18:14 -0400 Subject: [PATCH 15/17] distrobuilder: Remove mentions of LXD MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- distrobuilder/main.go | 13 +++++++++---- distrobuilder/main_incus.go | 16 ++++++---------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/distrobuilder/main.go b/distrobuilder/main.go index ce38fa49..795aa989 100644 --- a/distrobuilder/main.go +++ b/distrobuilder/main.go @@ -306,7 +306,7 @@ func (c *cmdGlobal) preRunBuild(cmd *cobra.Command, args []string) error { return fmt.Errorf("Failed to get definition: %w", err) } - // Create cache directory if we also plan on creating LXC or LXD images + // Create cache directory if we also plan on creating LXC or Incus images if !isRunningBuildDir { err = os.MkdirAll(c.flagCacheDir, 0755) if err != nil { @@ -634,6 +634,11 @@ is_lxd_vm() { [ -e /dev/virtio-ports/org.linuxcontainers.lxd ] } +# is_incus_vm succeeds if we're running inside an Incus VM +is_incus_vm() { + [ -e /dev/virtio-ports/org.linuxcontainers.incus ] +} + # is_in_path succeeds if the given file exists in on of the paths is_in_path() { # Don't use $PATH as that may not include all relevant paths @@ -754,10 +759,10 @@ EOF } ## Main logic -# Nothing to do in LXD VM but deployed in case it is later converted to a container -is_lxd_vm && exit 0 +# Nothing to do in Incus VM but deployed in case it is later converted to a container +is_incus_vm || is_lxd_vm && exit 0 -# Exit immediately if not a LXC/LXD container +# Exit immediately if not an Incus/LXC container is_lxc_container || exit 0 # Check for NetworkManager diff --git a/distrobuilder/main_incus.go b/distrobuilder/main_incus.go index 0402e41f..a7e4fde1 100644 --- a/distrobuilder/main_incus.go +++ b/distrobuilder/main_incus.go @@ -279,7 +279,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err err = generator.RunIncus(img, c.global.definition.Targets.Incus) if err != nil { - return fmt.Errorf("Failed to create LXD data: %w", err) + return fmt.Errorf("Failed to create Incus data: %w", err) } } @@ -351,7 +351,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err return fmt.Errorf("Failed to mount UEFI partition: %w", err) } - // We cannot use LXD's rsync package as that uses the --delete flag which + // We cannot use Incus' rsync package as that uses the --delete flag which // causes an issue due to the boot/efi directory being present. err = shared.RsyncLocal(c.global.ctx, overlayDir+"/", vmDir) if err != nil { @@ -440,11 +440,11 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err } } - c.global.logger.WithFields(logrus.Fields{"type": c.flagType, "vm": c.flagVM, "compression": c.flagCompression}).Info("Creating LXD image") + c.global.logger.WithFields(logrus.Fields{"type": c.flagType, "vm": c.flagVM, "compression": c.flagCompression}).Info("Creating Incus image") imageFile, rootfsFile, err := img.Build(c.flagType == "unified", c.flagCompression, c.flagVM) if err != nil { - return fmt.Errorf("Failed to create LXD image: %w", err) + return fmt.Errorf("Failed to create Incus image: %w", err) } importFlag := cmd.Flags().Lookup("import-into-incus") @@ -452,13 +452,9 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err if importFlag.Changed { path := "" - if incus.PathExists("/var/snap/lxd/common/lxd") { - path = "/var/snap/lxd/common/lxd/unix.socket" - } - server, err := client.ConnectIncusUnix(path, nil) if err != nil { - return fmt.Errorf("Failed to connect to LXD: %w", err) + return fmt.Errorf("Failed to connect to Incus: %w", err) } image := api.ImagesPost{ @@ -510,7 +506,7 @@ func (c *cmdIncus) run(cmd *cobra.Command, args []string, overlayDir string) err return fmt.Errorf("Failed to create image: %w", err) } - // Don't create alias if the flag value is equal to the NoOptDefVal (the default value if --import-into-lxd flag is set without any value). + // Don't create alias if the flag value is equal to the NoOptDefVal (the default value if --import-into-incus flag is set without any value). if importFlag.Value.String() == importFlag.NoOptDefVal { return nil } From 686200c9a048f82e14bb0e36d94cec5abd22bdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:24:58 -0400 Subject: [PATCH 16/17] doc: Update for Incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- doc/doc-cheat-sheet.md | 12 +++++----- doc/examples/scheme.yaml | 2 +- doc/examples/ubuntu.yaml | 4 ++-- doc/howto/build.md | 28 +++++++++++----------- doc/howto/troubleshoot.md | 2 +- doc/index.md | 6 ++--- doc/reference/generators.md | 14 +++++------ doc/reference/image.md | 4 ++-- doc/reference/mappings.md | 2 +- doc/reference/targets.md | 4 ++-- doc/tutorials/use.md | 46 ++++++++++++++++++------------------- 11 files changed, 61 insertions(+), 63 deletions(-) diff --git a/doc/doc-cheat-sheet.md b/doc/doc-cheat-sheet.md index 8821c1a7..af0c9b3a 100644 --- a/doc/doc-cheat-sheet.md +++ b/doc/doc-cheat-sheet.md @@ -187,13 +187,13 @@ To reference a documentation page, use MyST syntax to automatically extract the - [](index) - - Do not use. -* - `[LXD documentation](index)` - - [LXD documentation](index) - - [LXD documentation](index) +* - `[Distrobuilder documentation](index)` + - [Distrobuilder documentation](index) + - [Distrobuilder documentation](index) - Preferred when overriding the link text. -* - `` {doc}`LXD documentation ` `` - - {doc}`LXD documentation ` - - {doc}`LXD documentation ` +* - `` {doc}`Distrobuiledr documentation ` `` + - {doc}`Distrobuilder documentation ` + - {doc}`Distrobuilder documentation ` - Alternative when overriding the link text. ``` diff --git a/doc/examples/scheme.yaml b/doc/examples/scheme.yaml index 41fbb0b6..0aec2ffe 100644 --- a/doc/examples/scheme.yaml +++ b/doc/examples/scheme.yaml @@ -56,7 +56,7 @@ targets: - type: all content: |- lxc.arch = {{ image.architecture_personality }} - lxd: + incus: vm: size: 2147483648 filesystem: ext4 diff --git a/doc/examples/ubuntu.yaml b/doc/examples/ubuntu.yaml index 425c8cce..a9b80e2f 100644 --- a/doc/examples/ubuntu.yaml +++ b/doc/examples/ubuntu.yaml @@ -144,7 +144,7 @@ files: types: - vm -- path: /etc/default/grub.d/50-lxd.cfg +- path: /etc/default/grub.d/50-incus.cfg generator: dump content: |- GRUB_RECORDFAIL_TIMEOUT=0 @@ -154,7 +154,7 @@ files: types: - vm -- path: /etc/sudoers.d/90-lxd +- path: /etc/sudoers.d/90-incus generator: dump mode: 0440 content: |- diff --git a/doc/howto/build.md b/doc/howto/build.md index f9e248fb..6e3d376f 100644 --- a/doc/howto/build.md +++ b/doc/howto/build.md @@ -28,7 +28,7 @@ Global Flags: To build a plain rootfs, run `distrobuilder build-dir`. The command takes an image definition file and an output directory as positional arguments. -Running `build-dir` is useful if one wants to build both LXC and LXD images. +Running `build-dir` is useful if one wants to build both LXC and Incus images. In that case one can simply run ```shell @@ -86,11 +86,11 @@ The `pack-lxc` sub-command can be used to create an image from an existing rootf The rootfs won't be deleted afterwards. (howto-build-incus)= -## LXD image +## Incus image ```shell $ distrobuilder build-incus --help -Build LXD image from scratch +Build Incus image from scratch Depending on the type, it either outputs a unified (single tarball) or split image (tarball + squashfs or qcow2 image). The --type flag can take one of the @@ -114,16 +114,16 @@ For supported compression methods, a compression level can be specified with method-N, where N is an integer, e.g. gzip-9. Usage: - distrobuilder build-incus [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-lxd] [flags] + distrobuilder build-incus [target dir] [--type=TYPE] [--compression=COMPRESSION] [--import-into-incus] [flags] Flags: - --compression Type of compression to use (default "xz") - -h, --help help for build-incus - --import-into-lxd[="-"] Import built image into LXD - --keep-sources Keep sources after build (default true) - --sources-dir Sources directory for distribution tarballs (default "/tmp/distrobuilder") - --type Type of tarball to create (default "split") - --vm Create a qcow2 image for VMs + --compression Type of compression to use (default "xz") + -h, --help help for build-incus + --import-into-incus[="-"] Import built image into Incus + --keep-sources Keep sources after build (default true) + --sources-dir Sources directory for distribution tarballs (default "/tmp/distrobuilder") + --type Type of tarball to create (default "split") + --vm Create a qcow2 image for VMs Global Flags: --cache-dir Cache directory @@ -135,7 +135,7 @@ Global Flags: --version Print version number ``` -Running the `build-incus` sub-command creates a LXD image. +Running the `build-incus` sub-command creates an Incus image. If `--type=split`, it outputs two files. The metadata tarball will always be named `incus.tar.xz`. When creating a container image, the second file will be `rootfs.squashfs`. @@ -147,10 +147,10 @@ If `--compression` is set, the tarballs will use the provided compression instea Setting `--vm` will create a `qcow2` image which is used for virtual machines. -If `--import-into-lxd` is set, the resulting image is imported into LXD. +If `--import-into-incus` is set, the resulting image is imported into Incus. It basically runs `lxc image import `. Per default, it doesn't create an alias. -This can be changed by calling it as `--import-into-lxd=`. +This can be changed by calling it as `--import-into-incus=`. After building the image, the rootfs will be destroyed. diff --git a/doc/howto/troubleshoot.md b/doc/howto/troubleshoot.md index 1cbd3fe1..b82bd6de 100644 --- a/doc/howto/troubleshoot.md +++ b/doc/howto/troubleshoot.md @@ -6,7 +6,7 @@ This section covers some of the most commonly encountered problems and gives ins > Error `Cannot install into target '/var/cache/distrobuilder.123456789/rootfs' mounted with noexec or nodev` -You have installed `distrobuilder` into a LXD container and you are trying to run it. `distrobuilder` does not run in a LXD container. Run `distrobuilder` on the host, or in a VM. +You have installed `distrobuilder` into an Incus container and you are trying to run it. `distrobuilder` does not run in an Incus container. Run `distrobuilder` on the host, or in a VM. ## Classic confinement diff --git a/doc/index.md b/doc/index.md index d25cd876..5f912add 100644 --- a/doc/index.md +++ b/doc/index.md @@ -1,11 +1,11 @@ # `distrobuilder` -`distrobuilder` is an image building tool for LXC and LXD. +`distrobuilder` is an image building tool for LXC and Incus. Its modern design uses pre-built official images whenever available and supports a variety of modifications on the base image. -`distrobuilder` creates LXC or LXD images, or just a plain root file system, from a declarative image definition (in YAML format) that defines the source of the image, its package manager, what packages to install or remove for specific image variants, OS releases and architectures, as well as additional files to generate and arbitrary actions to execute as part of the image build process. +`distrobuilder` creates LXC or Incus images, or just a plain root file system, from a declarative image definition (in YAML format) that defines the source of the image, its package manager, what packages to install or remove for specific image variants, OS releases and architectures, as well as additional files to generate and arbitrary actions to execute as part of the image build process. -`distrobuilder` can be used to create custom images that can be used as the base for LXC containers or LXD instances. +`distrobuilder` can be used to create custom images that can be used as the base for LXC containers or Incus instances. `distrobuilder` is used to build the images on the [Linux containers image server](https://images.linuxcontainers.org/). You can also use it to build images from ISO files that require licenses and therefore cannot be distributed. diff --git a/doc/reference/generators.md b/doc/reference/generators.md index d4a20ea6..db0e0e39 100644 --- a/doc/reference/generators.md +++ b/doc/reference/generators.md @@ -45,7 +45,7 @@ If `pongo` is `true`, the values of `path`, `content`, and `source` are rendered For LXC images, the generator disables cloud-init by disabling any cloud-init services, and creates the file `cloud-init.disable` which is checked by `cloud-init` on startup. -For LXD images, the generator creates templates depending on the provided name. +For Incus images, the generator creates templates depending on the provided name. Valid names are `user-data`, `meta-data`, `vendor-data` and `network-config`. The default `path` if not defined otherwise is `/var/lib/cloud/seed/nocloud-net/`. Setting `path`, `content` or `template.properties` will override the default values. @@ -80,14 +80,14 @@ Copying will be done according to the following rules: For LXC images, the host name generator writes the LXC specific string `LXC_NAME` to the `hostname` file set in `path`. If the path doesn't exist, the generator does nothing. -For LXD images, the generator creates a template for `path`. +For Incus images, the generator creates a template for `path`. If the path doesn't exist, the generator does nothing. ## `hosts` For LXC images, the generator adds the entry `127.0.0.1 LXC_NAME` to the hosts file set in `path`. -For LXD images, the generator creates a template for the hosts file set in `path`, adding an entry for `127.0.0.1 {{ container.name }}`. +For Incus images, the generator creates a template for the hosts file set in `path`, adding an entry for `127.0.0.1 {{ container.name }}`. ## `remove` @@ -95,7 +95,7 @@ The generator removes the file set in `path` from the container's root file syst ## `template` -This generator creates a custom LXD template. +This generator creates a custom Incus template. The `name` field is used as the template's file name. The `path` defines the target file in the container's root file system. The `properties` key is a map of the template properties. @@ -106,11 +106,11 @@ The `when` key can be one or more of: * copy (run when a container is created from an existing one) * start (run every time the container is started) -See {ref}`lxd:image-format` in the LXD documentation for more information. +See {ref}`incus:image-format` in the Incus documentation for more information. ## `incus-agent` -This generator creates the `systemd` unit files which are needed to start the `incus-agent` in LXD VMs. +This generator creates the `systemd` unit files which are needed to start the `incus-agent` in Incus VMs. ## `fstab` @@ -122,6 +122,6 @@ LABEL=rootfs / 0 0 LABEL=UEFI /boot/efi vfat defaults 0 0 ``` -The file system is taken from the LXD target (see [targets](targets.md)) which defaults to `ext4`. +The file system is taken from the Incus target (see [targets](targets.md)) which defaults to `ext4`. The options are generated depending on the file system. You cannot override them. diff --git a/doc/reference/image.md b/doc/reference/image.md index fc06bef9..d50c90c4 100644 --- a/doc/reference/image.md +++ b/doc/reference/image.md @@ -21,10 +21,10 @@ The `expiry` field describes the image expiry. The format is `\d+(s|m|h|d|w)` (seconds, minutes, hours, days, weeks), and defaults to 30 days (`30d`). It's also possible to define multiple such parts, e.g. `1h 30m 10s`. -The `name` field is used in the LXD metadata as well as the output name for LXD unified tarballs. +The `name` field is used in the Incus metadata as well as the output name for Incus unified tarballs. It defaults to `{{ image.distribution }}-{{ image.release }}-{{ image.architecture_mapped }}-{{ image.variant }}-{{ image.serial }}`. The `serial` field is the image's serial number. It can be anything and defaults to `YYYYmmdd_HHMM` (date format). -The `variant` field can be anything and is used in the LXD metadata as well as for [filtering](filters.md). +The `variant` field can be anything and is used in the Incus metadata as well as for [filtering](filters.md). diff --git a/doc/reference/mappings.md b/doc/reference/mappings.md index 98e78265..7632504c 100644 --- a/doc/reference/mappings.md +++ b/doc/reference/mappings.md @@ -1,6 +1,6 @@ # Mappings -`mappings` describes an architecture mapping between the architectures from those used in LXD and those used by the distribution. +`mappings` describes an architecture mapping between the architectures from those used in Incus and those used by the distribution. These mappings are useful if you for example want to build a `x86_64` image but the source tarball contains `amd64` as its architecture. ```yaml diff --git a/doc/reference/targets.md b/doc/reference/targets.md index a902b915..2412221b 100644 --- a/doc/reference/targets.md +++ b/doc/reference/targets.md @@ -12,7 +12,7 @@ targets: after: content: - ... - lxd: + incus: vm: size: filesystem: @@ -32,7 +32,7 @@ If your desired compatibility level is 3 for example, you would use `before: 4` `content` describes the configuration which is to be written to the configuration file. -## LXD +## Incus Valid keys are `size` and `filesystem`. The former specifies the VM image size in bytes. diff --git a/doc/tutorials/use.md b/doc/tutorials/use.md index 4456650f..0e955f51 100644 --- a/doc/tutorials/use.md +++ b/doc/tutorials/use.md @@ -4,7 +4,7 @@ discourse: 7519 # Use `distrobuilder` to create images -This guide shows you how to create an image for LXD or LXC. +This guide shows you how to create an image for Incus or LXC. Before you start, you must install `distrobuilder`. See {doc}`../howto/install` for instructions. @@ -26,7 +26,7 @@ The YAML configuration file contains an image template that gives instructions t Distrobuilder provides examples of YAML files for various distributions in the [examples directory](https://github.com/lxc/distrobuilder/tree/master/doc/examples). [`scheme.yaml`](https://github.com/lxc/distrobuilder/blob/master/doc/examples/scheme.yaml) is a standard template that includes all available options. -Official LXD templates for various distributions are available in the [`lxc-ci` repository](https://github.com/lxc/lxc-ci/tree/master/images). +Official Incus templates for various distributions are available in the [`lxc-ci` repository](https://github.com/lxc/lxc-ci/tree/master/images). ``` In this example, we are creating an Ubuntu image. @@ -44,7 +44,7 @@ You can define the following keys: |------------|------------------------------------------------------------------------------------------|--------------------------------| | `image` | Defines distribution, architecture, release etc. | {doc}`../reference/image` | | `source` | Defines main package source, keys etc. | {doc}`../reference/source` | -| `targets` | Defines configuration for specific targets (e.g. LXD-client, instances etc.) | {doc}`../reference/targets` | +| `targets` | Defines configuration for specific targets (e.g. Incus, instances etc.) | {doc}`../reference/targets` | | `files` | Defines generators to modify files | {doc}`../reference/generators` | | `packages` | Defines packages for install or removal; adds repositories | {doc}`../reference/packages` | | `actions` | Defines scripts to be run after specific steps during image building | {doc}`../reference/actions` | @@ -56,11 +56,11 @@ When building a VM image, you should either build an image with cloud-init suppo ## Build and launch the image -The steps for building and launching the image depend on whether you want to use it with LXD or with LXC. +The steps for building and launching the image depend on whether you want to use it with Incus or with LXC. -### Create an image for LXD +### Create an image for Incus -To build an image for LXD, run `distrobuilder`. We are using the `build-incus` option to create an image for LXD. +To build an image for Incus, run `distrobuilder`. We are using the `build-incus` option to create an image for Incus. - To create a container image: @@ -87,21 +87,21 @@ total 100960 $ ``` -#### Add the image to LXD +#### Add the image to Incus -To add the image to a LXD installation, use the `lxc image import` command as follows. +To add the image to an Incus installation, use the `incus image import` command as follows. ```bash -$ lxc image import incus.tar.xz rootfs.squashfs --alias mycontainerimage +$ incus image import incus.tar.xz rootfs.squashfs --alias mycontainerimage Image imported with fingerprint: 009349195858651a0f883de804e64eb82e0ac8c0bc51880 ``` -See {ref}`lxd:images-copy` for detailed information. +See {ref}`incus:images-copy` for detailed information. -Let's look at the image in LXD. The `ubuntu.yaml` had a setting to create an Ubuntu 20.04 (`focal`) image. The size is 98.58MB. +Let's look at the image in Incus. The `ubuntu.yaml` had a setting to create an Ubuntu 20.04 (`focal`) image. The size is 98.58MB. ```bash -$ lxc image list mycontainerimage +$ incus image list mycontainerimage +------------------+--------------+--------+--------------+--------+---------+-----------------------------+ | ALIAS | FINGERPRINT | PUBLIC | DESCRIPTION | ARCH | SIZE | UPLOAD DATE | +------------------+--------------+--------+--------------+--------+---------+-----------------------------+ @@ -109,20 +109,20 @@ $ lxc image list mycontainerimage +------------------+--------------+--------+--------------+--------+---------+-----------------------------+ ``` -#### Launch a LXD container from the container image +#### Launch an Incus container from the container image -To launch a container from the freshly created image, use `lxc launch` as follows. Note that you do not specify a repository for the image (like `ubuntu:` or `images:`) because the image is located locally. +To launch a container from the freshly created image, use `incus launch` as follows. Note that you do not specify a repository for the image (like `ubuntu:` or `images:`) because the image is located locally. ```bash -$ lxc launch mycontainerimage c1 +$ incus launch mycontainerimage c1 Creating c1 Starting c1 ``` ### Create an image for LXC -Using LXC containers instead of LXD may require the installation of `lxc-utils`. -Having both LXC and LXD installed on the same system will probably cause confusion. +Using LXC containers instead of Incus may require the installation of `lxc-utils`. +Having both LXC and Incus installed on the same system will probably cause confusion. Use of raw LXC is generally discouraged due to the lack of automatic AppArmor protection. @@ -160,7 +160,7 @@ lxc-start -n myContainerImage ```{youtube} https://www.youtube.com/watch?v=3PDMGwbbk48 ``` -With LXD it's possible to run Windows VMs. All you need is a Windows ISO and a bunch of drivers. +With Incus it's possible to run Windows VMs. All you need is a Windows ISO and a bunch of drivers. To make the installation a bit easier, `distrobuilder` added the `repack-windows` command. It takes a Windows ISO, and repacks it together with the necessary drivers. Currently, `distrobuilder` supports Windows 10, Windows Server 2012, Windows Server 2016, Windows Server 2019 and Windows Server 2022. The Windows version will automatically be detected, but in case this fails you can use the `--windows-version` flag to set it manually. It supports the values `w10`, `2k12`, `2k16`, `2k19` and `2k22` for Windows 10, Windows Server 2012, Windows Server 2016, Windows Server 2019 and Windows Server 2022 respectively. @@ -182,15 +182,13 @@ distrobuilder repack-windows -h Run the following commands to initialize the VM, to configure (=increase) the allocated disk space and finally attach the full path of your prepared ISO file. Note that the installation of Windows 10 takes about 10GB (before updates), therefore a 30GB disk gives you about 20GB of free space. ```bash -lxc init win10 --empty --vm -c security.secureboot=false -lxc config device override win10 root size=30GiB -lxc config device add win10 iso disk source=/path/to/Windows-repacked.iso boot.priority=10 +incus init win10 --empty --vm -c security.secureboot=false +incus config device override win10 root size=30GiB +incus config device add win10 iso disk source=/path/to/Windows-repacked.iso boot.priority=10 ``` Now, the VM win10 has been configured and it is ready to be started. The following command starts the virtual machine and opens up a VGA console so that we go through the graphical installation of Windows. ```bash -lxc start win10 --console=vga +incus start win10 --console=vga ``` - -Taken from: [How to run a Windows virtual machine on LXD on Linux](https://blog.simos.info/how-to-run-a-windows-virtual-machine-on-lxd-on-linux/) From 7569ba519b934d9a245906a2c8c276aaa41244a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Tue, 5 Sep 2023 17:56:52 -0400 Subject: [PATCH 17/17] sphinx: Add Incus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- .sphinx/wordlist.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/.sphinx/wordlist.txt b/.sphinx/wordlist.txt index c8704631..4dbf6ab3 100644 --- a/.sphinx/wordlist.txt +++ b/.sphinx/wordlist.txt @@ -94,6 +94,7 @@ idmap idmapped idmaps incrementing +Incus InfiniBand InfluxDB init