diff --git a/helper/instances-info b/helper/instances-info index 3e082d32..a5bf88e5 100755 --- a/helper/instances-info +++ b/helper/instances-info @@ -92,7 +92,7 @@ sub show_match { $path = $bpath; } - foreach my $info (sort @{$dirs->{$path}}) { + foreach my $info (sort { $a->{name} cmp $b->{name} } @{$dirs->{$path}}) { my $dest; if(defined $spath && defined $suffix) { $dest = $info->{dest}."/${suffix}"; @@ -106,11 +106,11 @@ sub show_match { sub prepare_info { return 0 unless defined $yaml->{instances}; - foreach my $instance ( sort @{ $yaml->{instances} } ) { + foreach my $instance (sort { $a->{name} cmp $b->{name} } @{$yaml->{instances}}) { $instances->{ $instance->{label} } //= (); push @{ $instances->{ $instance->{label} } }, $instance->{name}; } - foreach my $def ( sort @{ $templ->{sources} } ) { + foreach my $def (sort { $a->{orig} cmp $b->{orig} } @{$templ->{sources}}) { my $inst = $instances->{ $def->{label} }; next unless $inst; my $orig = prefix_root $def->{orig}; diff --git a/t/fixtures/output/instances_info_args b/t/fixtures/output/instances_info_args index 1b98f2ec..de0b9c42 100644 --- a/t/fixtures/output/instances_info_args +++ b/t/fixtures/output/instances_info_args @@ -1,6 +1,6 @@ -/etc/kamailio/lb:/etc/kamailio/lb_B:B /etc/kamailio/lb:/etc/kamailio/lb_A:A -/etc/momo:/etc/momo_B:B +/etc/kamailio/lb:/etc/kamailio/lb_B:B /etc/momo:/etc/momo_A:A -/etc/other/lb:/etc/other/lb_B:B +/etc/momo:/etc/momo_B:B /etc/other/lb:/etc/other/lb_A:A +/etc/other/lb:/etc/other/lb_B:B diff --git a/t/fixtures/output/instances_info_args_longer b/t/fixtures/output/instances_info_args_longer index b9a5c45c..66656faa 100644 --- a/t/fixtures/output/instances_info_args_longer +++ b/t/fixtures/output/instances_info_args_longer @@ -1,2 +1,2 @@ -/etc/kamailio/lb/db:/etc/kamailio/lb_B/db:B /etc/kamailio/lb/db:/etc/kamailio/lb_A/db:A +/etc/kamailio/lb/db:/etc/kamailio/lb_B/db:B diff --git a/t/fixtures/output/instances_info_args_same b/t/fixtures/output/instances_info_args_same index 87919098..9e43a1c1 100644 --- a/t/fixtures/output/instances_info_args_same +++ b/t/fixtures/output/instances_info_args_same @@ -1,2 +1,2 @@ -/etc/kamailio/lb:/etc/kamailio/lb_B:B /etc/kamailio/lb:/etc/kamailio/lb_A:A +/etc/kamailio/lb:/etc/kamailio/lb_B:B diff --git a/t/fixtures/output/instances_info_noargs b/t/fixtures/output/instances_info_noargs index 1b98f2ec..de0b9c42 100644 --- a/t/fixtures/output/instances_info_noargs +++ b/t/fixtures/output/instances_info_noargs @@ -1,6 +1,6 @@ -/etc/kamailio/lb:/etc/kamailio/lb_B:B /etc/kamailio/lb:/etc/kamailio/lb_A:A -/etc/momo:/etc/momo_B:B +/etc/kamailio/lb:/etc/kamailio/lb_B:B /etc/momo:/etc/momo_A:A -/etc/other/lb:/etc/other/lb_B:B +/etc/momo:/etc/momo_B:B /etc/other/lb:/etc/other/lb_A:A +/etc/other/lb:/etc/other/lb_B:B