using `instance-type` contraints parameter with string containing spaces character

Bug #1875590 reported by dave
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Achilleas Anagnostopoulos
2.8
Fix Released
Medium
Achilleas Anagnostopoulos

Bug Description

When trying to bootstrap a new controller using `instance-type` parameter where the possible values would contain space characters like "4GB Standard Instance" that is not possible, as juju client would consider each part as individual parameters.
Trying different method to escape the spaces don't help either.

example:
```juju bootstrap rackspace/lon ctrl --bootstrap-constraints 'instance-type=4GB Standard Instance'```

would output
```ERROR malformed constraint "Standard"```

Regards,
Dave

Revision history for this message
Ian Booth (wallyworld) wrote :

There's this PR recently added to allow zone constraints with spaces.

https://github.com/juju/juju/pull/11500

It seems there needs to be a similar fix across other constraint attributes.

Changed in juju:
milestone: none → 2.8-rc1
importance: Undecided → High
status: New → Triaged
Changed in juju:
importance: High → Medium
assignee: nobody → Achilleas Anagnostopoulos (achilleasa)
milestone: 2.8-rc1 → 2.7.7
status: Triaged → In Progress
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

@Ian: I have a quick fix for this which basically allows you to escape spaces anywhere inside a constraint string via a slash just as you would do in a shell, e.g:

--constraints arch=amd64 instance-type=with\ spaces zones=az\ one,az2

But it looks like the PR you just linked (hasn't landed yet though) adds space support for all constraint KV pairs without the need to manually escape spaces so I guess we can go with that one instead since it looks like it has already been reviewed.

Also linking the relevant bug for zones: https://bugs.launchpad.net/juju/+bug/1847259

tags: added: constraints rackspace
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :
Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

My previous comment was actually incorrect. PR https://github.com/juju/juju/pull/11511 incorporates the changes from 11500 (+ some minor fixes) and properly enables instance-type constraints with space characters.

With this fix the bootstrap command now becomes (note: no escape needed):

```juju bootstrap rackspace/lon ctrl --bootstrap-constraints instance-type=4GB Standard Instance```

Revision history for this message
Achilleas Anagnostopoulos (achilleasa) wrote :

After discussing the caveats for the solution that landed with PR #11500, we decided to go for a more streamlined solution (escape spaces with slashes) that retains the validation logic (don't allow the operator to specify the same constraint type more than once) from the original code and will land https://github.com/juju/juju/pull/11519 as a followup fix.

With the followup fix the bootstrap command now becomes:

juju bootstrap rackspace/lon ctrl --bootstrap-constraints instance-type=4GB\ Standard\ Instance

Changed in juju:
status: In Progress → Fix Committed
Changed in juju:
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.