From 5d43fed7a9f3c4272091c462f18d0421eaac5558 Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Sun, 26 Jan 2025 09:20:55 +0200 Subject: [PATCH] admin/init: use api.InitProfileProjectPost Signed-off-by: Meghea Iulian --- cmd/incus/admin_init_auto.go | 38 +++++++++++++++++------------ cmd/incus/admin_init_dump.go | 2 +- cmd/incus/admin_init_interactive.go | 13 ++++++---- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/cmd/incus/admin_init_auto.go b/cmd/incus/admin_init_auto.go index 75135fbb358..8022bf4cfe3 100644 --- a/cmd/incus/admin_init_auto.go +++ b/cmd/incus/admin_init_auto.go @@ -109,17 +109,20 @@ func (c *cmdAdminInit) RunAuto(cmd *cobra.Command, args []string, d incus.Instan config.StoragePools = []api.StoragePoolsPost{pool} // Profile entry - config.Profiles = []api.ProfilesPost{{ - Name: "default", - ProfilePut: api.ProfilePut{ - Devices: map[string]map[string]string{ - "root": { - "type": "disk", - "path": "/", - "pool": pool.Name, + config.Profiles = []api.InitProfileProjectPost{{ + ProfilesPost: api.ProfilesPost{ + Name: "default", + ProfilePut: api.ProfilePut{ + Devices: map[string]map[string]string{ + "root": { + "type": "disk", + "path": "/", + "pool": pool.Name, + }, }, }, }, + Project: api.ProjectDefaultName, }} } @@ -170,17 +173,20 @@ func (c *cmdAdminInit) RunAuto(cmd *cobra.Command, args []string, d incus.Instan // Add it to the profile if config.Profiles == nil { - config.Profiles = []api.ProfilesPost{{ - Name: "default", - ProfilePut: api.ProfilePut{ - Devices: map[string]map[string]string{ - "eth0": { - "type": "nic", - "network": network.Name, - "name": "eth0", + config.Profiles = []api.InitProfileProjectPost{{ + ProfilesPost: api.ProfilesPost{ + Name: "default", + ProfilePut: api.ProfilePut{ + Devices: map[string]map[string]string{ + "eth0": { + "type": "nic", + "network": network.Name, + "name": "eth0", + }, }, }, }, + Project: api.ProjectDefaultName, }} } else { config.Profiles[0].Devices["eth0"] = map[string]string{ diff --git a/cmd/incus/admin_init_dump.go b/cmd/incus/admin_init_dump.go index faacfe3e0c8..513426aede3 100644 --- a/cmd/incus/admin_init_dump.go +++ b/cmd/incus/admin_init_dump.go @@ -65,7 +65,7 @@ func (c *cmdAdminInit) RunDump(d incus.InstanceServer) error { } for _, profile := range profiles { - profilesPost := api.ProfilesPost{} + profilesPost := api.InitProfileProjectPost{} profilesPost.Config = profile.Config profilesPost.Description = profile.Description profilesPost.Devices = profile.Devices diff --git a/cmd/incus/admin_init_interactive.go b/cmd/incus/admin_init_interactive.go index 4bf1c8a7c70..d1bdcba8dde 100644 --- a/cmd/incus/admin_init_interactive.go +++ b/cmd/incus/admin_init_interactive.go @@ -36,13 +36,16 @@ func (c *cmdAdminInit) RunInteractive(cmd *cobra.Command, args []string, d incus config.Server.Config = map[string]string{} config.Server.Networks = []api.InitNetworksProjectPost{} config.Server.StoragePools = []api.StoragePoolsPost{} - config.Server.Profiles = []api.ProfilesPost{ + config.Server.Profiles = []api.InitProfileProjectPost{ { - Name: "default", - ProfilePut: api.ProfilePut{ - Config: map[string]string{}, - Devices: map[string]map[string]string{}, + ProfilesPost: api.ProfilesPost{ + Name: "default", + ProfilePut: api.ProfilePut{ + Config: map[string]string{}, + Devices: map[string]map[string]string{}, + }, }, + Project: api.ProjectDefaultName, }, }