Skip to content

Commit

Permalink
lxd/init: Set Target after network/storage lookup
Browse files Browse the repository at this point in the history
Closes lxc/incus#335

Signed-off-by: Stéphane Graber <[email protected]>
(cherry picked from commit a13184bf72f0d5ad69aa12b7e392bc2c2ff2ec93)
Signed-off-by: Mark Laing <[email protected]>
License: Apache-2.0
  • Loading branch information
stgraber authored and markylaing committed Nov 8, 2024
1 parent 5c0f573 commit 05f6d56
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lxc/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,6 @@ func (c *cmdInit) create(conf *config.Config, args []string, launch bool) (lxd.I
return nil, "", err
}

if c.flagTarget != "" {
d = d.UseTarget(c.flagTarget)
}

// Overwrite profiles.
if c.flagProfile != nil {
profiles = c.flagProfile
Expand Down Expand Up @@ -264,6 +260,11 @@ func (c *cmdInit) create(conf *config.Config, args []string, launch bool) (lxd.I
instanceDBType = api.InstanceTypeVM
}

// Set the target if provided.
if c.flagTarget != "" {
d = d.UseTarget(c.flagTarget)
}

// Setup instance creation request
req := api.InstancesPost{
Name: name,
Expand Down

0 comments on commit 05f6d56

Please sign in to comment.