Juju should add new machine after version sorting bundle machines

Bug #1762309 reported by Nobuto Murata
24
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Canonical Juju
Fix Released
Medium
Tim Penhey
2.3
Fix Released
Medium
Tim Penhey

Bug Description

$ juju version
2.3.5-xenial-amd64

When deploying a bundle, Juju adds bundle machines from 0, 1, 10, 11, ..., 2, 20. Considering that Juju also supports "--map-machines existing,X=Y" for re-running `juju deploy`. It would be definitely straightforward if Juju adds bundle machines after sorting numerics naturally (version sort). So that we don't need to pass "X=Y" less frequently. See an actual and expected outputs below.

[actual]

$ juju deploy ./bundle.yaml
...
- add new machine 0
- add new machine 1
- add new machine 2 (bundle machine 10)
- add new machine 3 (bundle machine 11)
- add new machine 4 (bundle machine 12)
- add new machine 5 (bundle machine 13)
- add new machine 6 (bundle machine 14)
- add new machine 7 (bundle machine 15)
- add new machine 8 (bundle machine 16)
- add new machine 9 (bundle machine 17)
- add new machine 10 (bundle machine 18)
- add new machine 11 (bundle machine 19)
- add new machine 12 (bundle machine 2)
- add new machine 13 (bundle machine 20)
- add new machine 14 (bundle machine 21)
- add new machine 15 (bundle machine 22)
- add new machine 16 (bundle machine 3)
- add new machine 17 (bundle machine 4)
- add new machine 18 (bundle machine 5)
- add new machine 19 (bundle machine 6)
- add new machine 20 (bundle machine 7)
- add new machine 21 (bundle machine 8)
- add new machine 22 (bundle machine 9)

[expected]

$ juju deploy ./bundle.yaml
...
- add new machine 0
- add new machine 1
- add new machine 2 (bundle machine 2)
- add new machine 3 (bundle machine 3)
- add new machine 4 (bundle machine 4)
- add new machine 5 (bundle machine 5)
- add new machine 6 (bundle machine 6)
- add new machine 7 (bundle machine 7)
- add new machine 8 (bundle machine 8)
- add new machine 9 (bundle machine 9)
- add new machine 10 (bundle machine 10)
- add new machine 11 (bundle machine 11)
- add new machine 12 (bundle machine 12)
- add new machine 13 (bundle machine 13)
- add new machine 14 (bundle machine 14)
- add new machine 15 (bundle machine 15)
- add new machine 16 (bundle machine 16)
- add new machine 17 (bundle machine 17)
- add new machine 18 (bundle machine 18)
- add new machine 19 (bundle machine 19)
- add new machine 20 (bundle machine 20)
- add new machine 21 (bundle machine 21)
- add new machine 22 (bundle machine 22)

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

I *think* this is just changing an alphabetical sort into a numeric lexical sort, and we have that function somewhere.

Changed in juju:
status: New → Triaged
importance: Undecided → Medium
tags: added: bitesize bundles deploy
Revision history for this message
John A Meinel (jameinel) wrote : Re: [Bug 1762309] Re: Juju should add new machine after version sorting bundle machines

utils.SortStringsNaturally()
(elsewhere it is called 'naturalsort')
https://en.wikipedia.org/wiki/Natural_sort_order
which links to
https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/

and I got it from Martin Pool:
https://github.com/sourcefrog/natsort

On Tue, Apr 10, 2018 at 1:13 AM, Tim Penhey <email address hidden>
wrote:

> I *think* this is just changing an alphabetical sort into a numeric
> lexical sort, and we have that function somewhere.
>
> ** Changed in: juju
> Status: New => Triaged
>
> ** Changed in: juju
> Importance: Undecided => Medium
>
> ** Tags added: bitesize bundles deploy
>
> --
> You received this bug notification because you are subscribed to juju.
> Matching subscriptions: juju bugs
> https://bugs.launchpad.net/bugs/1762309
>
> Title:
> Juju should add new machine after version sorting bundle machines
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1762309/+subscriptions
>

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

Yet another thing to move out of utils.

Does this make sense to have in a juju/collections package?

On 11/04/18 00:50, John A Meinel wrote:
> utils.SortStringsNaturally()
> (elsewhere it is called 'naturalsort')
> https://en.wikipedia.org/wiki/Natural_sort_order
> which links to
> https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
>
> and I got it from Martin Pool:
> https://github.com/sourcefrog/natsort
>
>
> On Tue, Apr 10, 2018 at 1:13 AM, Tim Penhey <email address hidden>
> wrote:
>
>> I *think* this is just changing an alphabetical sort into a numeric
>> lexical sort, and we have that function somewhere.
>>
>> ** Changed in: juju
>> Status: New => Triaged
>>
>> ** Changed in: juju
>> Importance: Undecided => Medium
>>
>> ** Tags added: bitesize bundles deploy
>>
>> --
>> You received this bug notification because you are subscribed to juju.
>> Matching subscriptions: juju bugs
>> https://bugs.launchpad.net/bugs/1762309
>>
>> Title:
>> Juju should add new machine after version sorting bundle machines
>>
>> To manage notifications about this bug go to:
>> https://bugs.launchpad.net/juju/+bug/1762309/+subscriptions
>>
>

Revision history for this message
John A Meinel (jameinel) wrote :

I'd just make a github.com/juju/naturalsort.Sort package.

John
=:->

On Wed, Apr 11, 2018, 00:30 Tim Penhey <email address hidden> wrote:

> Yet another thing to move out of utils.
>
> Does this make sense to have in a juju/collections package?
>
>
> On 11/04/18 00:50, John A Meinel wrote:
> > utils.SortStringsNaturally()
> > (elsewhere it is called 'naturalsort')
> > https://en.wikipedia.org/wiki/Natural_sort_order
> > which links to
> > https://blog.codinghorror.com/sorting-for-humans-natural-sort-order/
> >
> > and I got it from Martin Pool:
> > https://github.com/sourcefrog/natsort
> >
> >
> > On Tue, Apr 10, 2018 at 1:13 AM, Tim Penhey <email address hidden>
> > wrote:
> >
> >> I *think* this is just changing an alphabetical sort into a numeric
> >> lexical sort, and we have that function somewhere.
> >>
> >> ** Changed in: juju
> >> Status: New => Triaged
> >>
> >> ** Changed in: juju
> >> Importance: Undecided => Medium
> >>
> >> ** Tags added: bitesize bundles deploy
> >>
> >> --
> >> You received this bug notification because you are subscribed to juju.
> >> Matching subscriptions: juju bugs
> >> https://bugs.launchpad.net/bugs/1762309
> >>
> >> Title:
> >> Juju should add new machine after version sorting bundle machines
> >>
> >> To manage notifications about this bug go to:
> >> https://bugs.launchpad.net/juju/+bug/1762309/+subscriptions
> >>
> >
>
> --
> You received this bug notification because you are subscribed to juju.
> Matching subscriptions: juju bugs
> https://bugs.launchpad.net/bugs/1762309
>
> Title:
> Juju should add new machine after version sorting bundle machines
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/juju/+bug/1762309/+subscriptions
>

Tim Penhey (thumper)
Changed in juju:
status: Triaged → In Progress
assignee: nobody → Tim Penhey (thumper)
milestone: none → 2.4-beta2
Tim Penhey (thumper)
Changed in juju:
status: In Progress → Fix Committed
Alvaro Uria (aluria)
tags: added: canonical-bootstack
Tim Penhey (thumper)
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.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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