juju sync-tools destroys the environment when given an invalid source

Bug #1316869 reported by Ryan Finnie
22
This bug affects 3 people
Affects Status Importance Assigned to Milestone
juju-core
Fix Released
Critical
Andrew Wilkins
1.18
Fix Released
Critical
Andrew Wilkins

Bug Description

If an existing juju environment exists, and juju sync-tools is run with an invalid --source location, the existing environment will be destroyed without prompt.

[rfinnie@lcy01] ryan@linda:~$ juju --debug sync-tools --dry-run --version 1.18 --source blahblah
2014-05-07 10:14:19 INFO juju.cmd supercommand.go:297 running juju-1.18.1-trusty-amd64 [gc]
2014-05-07 10:14:19 DEBUG juju.environs open.go:86 ConfigForName found bootstrap config map[string]interface {}{"image-metadata-url":"", "image-stream":"", "tenant-name":"rfinnie_project", <snip>, "ssl-hostname-verification":true}
2014-05-07 10:14:20 DEBUG juju.environs.configstore disk.go:64 Making /home/ryan/.juju/environments
2014-05-07 10:14:20 INFO juju.environs open.go:177 environment info already exists; using New not Prepare
2014-05-07 10:14:20 INFO juju.provider.openstack provider.go:202 opening environment "openstack"
2014-05-07 10:14:20 INFO juju.environs.sync sync.go:141 using sync tools source: file://blahblah/tools
using sync tools source: file://blahblah/tools
2014-05-07 10:14:20 INFO juju.environs.sync sync.go:64 listing available tools
listing available tools
2014-05-07 10:14:20 DEBUG juju.environs.tools tools.go:45 no architecture specified when finding tools, looking for any
2014-05-07 10:14:20 DEBUG juju.environs.tools tools.go:56 no series specified when finding tools, looking for any
2014-05-07 10:14:20 INFO juju.utils http.go:55 hostname SSL verification enabled
2014-05-07 10:14:20 DEBUG juju.environs.simplestreams simplestreams.go:490 fetchData failed for "file://blahblah/tools/streams/v1/index.sjson": cannot find URL "file://blahblah/tools/streams/v1/index.sjson" not found
2014-05-07 10:14:20 DEBUG juju.environs.simplestreams simplestreams.go:464 cannot load index "file://blahblah/tools/streams/v1/index.sjson": invalid URL "file://blahblah/tools/streams/v1/index.sjson" not found
2014-05-07 10:14:20 INFO juju.utils http.go:55 hostname SSL verification enabled
2014-05-07 10:14:20 DEBUG juju.environs.simplestreams simplestreams.go:490 fetchData failed for "file://blahblah/tools/streams/v1/index.json": cannot find URL "file://blahblah/tools/streams/v1/index.json" not found
2014-05-07 10:14:20 DEBUG juju.environs.simplestreams simplestreams.go:464 cannot load index "file://blahblah/tools/streams/v1/index.json": invalid URL "file://blahblah/tools/streams/v1/index.json" not found
2014-05-07 10:14:20 INFO juju.cmd cmd.go:113 Sync-tools failed, destroying environment
2014-05-07 10:14:20 INFO juju.provider.common destroy.go:14 destroying environment "openstack"
2014-05-07 10:14:21 DEBUG juju.provider.openstack provider.go:848 terminating instances [c64a7009-8a93-4bf0-83f7-5ae31fec6e3a]
2014-05-07 10:14:24 ERROR juju.cmd supercommand.go:300 no tools available

Related branches

Revision history for this message
Andrew Wilkins (axwalk) wrote :

sync-tools will destroy the environment *iff* it created it and sync-tools fails. If it exists already, and sync-tools fails, it will be left alone. Closing as invalid; please reopen if my analysis is wrong.

Changed in juju-core:
status: New → Invalid
Revision history for this message
Ryan Finnie (fo0bar) wrote :

Nope, I went ahead and bootstrapped a new environment, then ran sync-tools with the existing environment around, which it destroyed. Description updated with this log. [Original description had a log of juju trying to destroy an empty environment.]

FWIW, in this situation the reason I am running sync-tools is part of building SimpleStreams data for a new private cloud. The existing juju environment I'm running this from is unrelated (other than the backend is Openstack); juju is just being used as a disconnected tool, but the fact that it could also unexpectedly destroy a (possibly production) environment is scary.

description: updated
Changed in juju-core:
status: Invalid → New
Andrew Wilkins (axwalk)
Changed in juju-core:
status: New → In Progress
importance: Undecided → Critical
assignee: nobody → Andrew Wilkins (axwalk)
Revision history for this message
Andrew Wilkins (axwalk) wrote :

So as far as I can tell, this bug will only occur if you've never switched environments. Also, someone (probably unintentionally) fixed it in the 1.19 branch, but not 1.18; I will backport it.

Ian Booth (wallyworld)
Changed in juju-core:
milestone: none → 1.18.3
Ian Booth (wallyworld)
no longer affects: juju-core/trunk
Changed in juju-core:
milestone: 1.18.3 → 1.19.2
Go Bot (go-bot)
Changed in juju-core:
status: In Progress → Fix Committed
Changed in juju-core:
status: Fix Committed → Fix Released
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.