Failure when deploying on lxd models and model name contains space characters

Bug #1568944 reported by Francesco Banconi
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
High
Mick Gregg

Bug Description

For instance, on a newly bootstrapped lxd controller:

% juju create-model "foo bar"
created model "foo bar"
% juju switch "foo bar"
local.lxd:foo bar (no change)
% juju deploy wordpress
Added charm "cs:trusty/wordpress-4" to the model.
Deploying charm "cs:trusty/wordpress-4" with the charm series "trusty".

But then:
% juju status
...
[Units]
wordpress/0 error lost cannot assign unit "wordpress/0" to machine: cannot assign unit "wordpress/0" to new machine or container: cannot assign unit "wordpress/0" to new machine: Error inserting juju-foo bar into database: UNIQUE constraint failed: profiles.name
...

Moreover, after the above is run, it's also not possible to destroy the controller:
% juju destroy-controller lxd --destroy-all-models -y
Destroying controller
Waiting for hosted model resources to be reclaimed
Waiting on 2 models, 1 service
Waiting on 1 model, 1 service
Waiting on 1 model, 1 service
Waiting on 1 model, 1 service
Waiting on 1 model, 1 service
... [for ever]

I had to manually lxc delete -f ... and kill the controller.

Note that it could be potentially common for users to create models with such names, as it's very easy for instance when using the Juju GUI.

Revision history for this message
Francesco Banconi (frankban) wrote :

This is surely related on the lxd provider, but also part of a more generic lack of input validation when creating new models.

Revision history for this message
Francesco Banconi (frankban) wrote :

Also note that website exposing URL paths which include the model name would be broken without input validation (for instance, a model can be named "#...".

Changed in juju-core:
status: New → Triaged
importance: Undecided → High
milestone: none → 2.0.0
Changed in juju-core:
assignee: nobody → Horacio Durán (hduran-8)
status: Triaged → In Progress
Revision history for this message
Horacio Durán (hduran-8) wrote :

The important question here is, what is the policy we are going to choose.
Should we forbid names with spaces/special characters or should we add extreme support for them? (escaping chars, replacing chars) I would go for a limiting approach, the other one opens the door to many more hiden issues.

Changed in juju-core:
status: In Progress → Triaged
assignee: Horacio Durán (hduran-8) → nobody
Ian Booth (wallyworld)
Changed in juju-core:
assignee: nobody → Reed O'Brien (reedobrien)
milestone: 2.0.0 → 2.0-rc1
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta5 → 2.0-rc1
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta6 → 2.0-beta7
Curtis Hovey (sinzui)
Changed in juju-core:
milestone: 2.0-beta7 → 2.0-beta8
Revision history for this message
Mick Gregg (macgreagoir) wrote :

On the limiting approach, may I suggest the unreserved characters from RFC3986 (https://www.ietf.org/rfc/rfc3986.txt)? "[U]ppercase and lowercase letters, decimal digit, hyphen, period, underscore, and tilde." These should be URL- and Bash-safe. Is this set too limiting?

Revision history for this message
Tim Penhey (thumper) wrote :

I would go one step further, and say lowercase, digit and hyphen.

Mick Gregg (macgreagoir)
Changed in juju-core:
assignee: Reed O'Brien (reedobrien) → Mick Gregg (macgreagoir)
Mick Gregg (macgreagoir)
Changed in juju-core:
status: Triaged → In Progress
Revision history for this message
Mick Gregg (macgreagoir) wrote :
Revision history for this message
Mick Gregg (macgreagoir) wrote :
Revision history for this message
Mick Gregg (macgreagoir) wrote :

The question has been raised as to how well we can align naming rules for features. The current PRs have lowercase, digit and hyphen (from comment #5). The user names rule allows these and also upper case letters, plus sign and dot. Are user and model names worth aligning, at least, or are there reasons to keep model names more limited?

Mick Gregg (macgreagoir)
tags: added: blocker
Mick Gregg (macgreagoir)
Changed in juju-core:
importance: High → Critical
Mick Gregg (macgreagoir)
Changed in juju-core:
importance: Critical → High
tags: removed: blocker
Mick Gregg (macgreagoir)
tags: added: blocker
Changed in juju-core:
importance: High → Critical
Mick Gregg (macgreagoir)
Changed in juju-core:
importance: Critical → High
status: In Progress → Fix Committed
tags: removed: blocker
Curtis Hovey (sinzui)
Changed in juju-core:
status: Fix Committed → Fix Released
affects: juju-core → juju
Changed in juju:
milestone: 2.0-beta8 → none
milestone: none → 2.0-beta8
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.