Allow dashes in hostname when expanding in ranges

Hostname characters allowed here are currently any alpha-numberic, underscores
and dashes.

Github issue #89
This commit is contained in:
Duncan Ferguson 2017-05-16 00:58:44 +01:00
parent 2b9b8990b7
commit fa01db1a03
3 changed files with 6 additions and 1 deletions

View file

@ -1,6 +1,7 @@
4.10_02 0000-00-00 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Include coverage tests in the resources
- Include the version of cssh in the utility documentation and README
- Fix dashes (-) not being accepted in hostname range expansion (Github issue #89)
4.10_01 2017-04-12 Duncan Ferguson <duncan_ferguson@user.sf.net>
- Allow 'include' directives when reading SSH configuration files (Github issue #77) (thanks to Azenet)

View file

@ -54,7 +54,7 @@ Ranges are of the form:
sub expand {
my ( $self, @items ) = @_;
my $range_regexp = qr/^\w+\{[\w\.,]+\}$/;
my $range_regexp = qr/^[\w-]+\{[\w\.,]+\}$/;
my @newlist;
foreach my $item (@items) {
if ( $item !~ m/$range_regexp/ ) {

View file

@ -29,6 +29,10 @@ my %tests = (
# print join(q{ }, bsd_glob("o{a,b,c")).$/
'o{a,b,c' => 'o',
'p{0..2' => 'p',
# Reported as bug in github issue #89
'q-0{0,1}' => 'q-00 q-01',
'q-0{0..1}' => 'q-00 q-01',
);
my $range = App::ClusterSSH::Range->new();