panic: malformed yaml of manual-cloud causes bootstrap failure

Bug #2039322 reported by Adam Dyess
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
New
Undecided
Unassigned

Bug Description

version: juju 3.1.6
Trying to bootstrap onto a manual-cloud with malformed cloud.yaml in `.local/share/juju/clouds.yaml` failed to bootstrap

culprit yaml:
```
clouds:
manual-cloud:
    type: manual
    endpoint: ubuntu@10.246.154.167
```

Reference Github Action:
https://github.com/charmed-kubernetes/charm-calico-enterprise/actions/runs/6513048687/job/17691946011

Panic trace
  /snap/bin/juju bootstrap --debug --verbose manual-cloud github-pr-0f1a4-manual-cloud --model-default test-mode=true --model-default automatically-retry-hooks=false --model-default logging-config=<root>=DEBUG --bootstrap-constraints=
  21:09:51 INFO juju.cmd supercommand.go:56 running juju [3.1.6 f6a66aa91eec620f5ac04a19d8c06bef03ae6228 gc go1.20.8]
  21:09:51 DEBUG juju.cmd supercommand.go:57 args: []string{"/snap/juju/24626/bin/juju", "bootstrap", "--debug", "--verbose", "manual-cloud", "github-pr-0f1a4-manual-cloud", "--model-default", "test-mode=true", "--model-default", "automatically-retry-hooks=false", "--model-default", "logging-config=<root>=DEBUG", "--bootstrap-constraints="}
  21:09:51 INFO cmd bootstrap.go:658
  Now you can run
   juju add-model <model-name>
  to create a new model to deploy workloads.
  panic: runtime error: invalid memory address or nil pointer dereference
  [signal SIGSEGV: segmentation violation code=0x1 addr=0x88 pc=0x96ef53]

  goroutine 1 [running]:
  github.com/juju/juju/cloud.cloudFromInternal(0x0?)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cloud/clouds.go:579 +0x53
  github.com/juju/juju/cloud.ParseCloudMetadata({0xc000d90400, 0x4b, 0x200})
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cloud/clouds.go:459 +0x4ca
  github.com/juju/juju/cloud.ParseCloudMetadataFile({0xc000d860c0?, 0x1?})
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cloud/personalclouds.go:41 +0x2a
  github.com/juju/juju/cloud.PersonalCloudMetadata()
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cloud/personalclouds.go:27 +0x4a
  github.com/juju/juju/cloud.CloudByName({0x7fff2ea7ee7c, 0xc})
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cloud/clouds.go:317 +0x3e
  github.com/juju/juju/cmd/juju/commands.(*bootstrapCommand).cloud(0xc000101800, 0x0?)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/juju/commands/bootstrap.go:1201 +0xb4
  github.com/juju/juju/cmd/juju/commands.(*bootstrapCommand).Run(0xc000101800, 0xc0000d95c0)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/juju/commands/bootstrap.go:689 +0x1c5
  github.com/juju/juju/cmd/modelcmd.(*modelCommandWrapper).Run(0xc000b42510, 0xc000d01790?)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/modelcmd/modelcommand.go:663 +0x123
  github.com/juju/juju/cmd/modelcmd.(*baseCommandWrapper).Run(0xc000a74350, 0x200000006?)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/modelcmd/base.go:554 +0xaf
  github.com/juju/cmd/v3.(*SuperCommand).Run(0xc00096cf20, 0xc0000d95c0)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/vendor/github.com/juju/cmd/v3/supercommand.go:514 +0x378
  github.com/juju/cmd/v3.Main({0x64a83e8, 0xc00096cf20}, 0xc0000d95c0, {0xc0000df500, 0xc, 0xc})
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/vendor/github.com/juju/cmd/v3/cmd.go:468 +0x25d
  github.com/juju/juju/cmd/juju/commands.jujuMain.Run({0xc0001aa140?}, {0xc0001a60d0, 0xd, 0xd})
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/juju/commands/main.go:213 +0x97f
  github.com/juju/juju/cmd/juju/commands.Main(...)
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/juju/commands/main.go:126
  main.main()
   /build/snapcraft-juju-da55d99d296df0fff85c9f11a6a5ab0b/parts/juju/build/cmd/juju/main.go:27 +0x72
  Error: The process '/snap/bin/juju' failed with exit code 2

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.