#!/bin/env bash
declare -a hostlist=$(grep -P '(?##
#!/usr/bin/env perl
use strict;
use warnings;
use File::Basename;
my $lab_root = dirname $0;
opendir( DH, $lab_root) or die "Cannot open $lab_root: $!\n";
my @kickstarts = grep ( /\.ks$/, readdir(DH));
my @bsname ;
my $hostname;
for my $kickstart (@kickstarts) {
my $name = (split /\./)[0], $kickstart;
open my $fh, $kickstart or die "Cannot open $kickstart: $!";
while (<$fh>) {
chomp;
my @fields = split /=/;
if ( $fields[0] eq '--hostname') {
$hostname = $fields[1];
print "$hostname\n";
push @bsname , $hostname;
}else {
$hostname = $name;
print "$hostname\n";
push @bsname , $hostname;
}
close $fh;
}
}
####
Provisioner]$ ./installer.pl
Useless use of private variable in void context at ./installer.pl line 13.
Use of uninitialized value $_ in split at ./installer.pl line 13.
Use of uninitialized value $hostname in concatenation (.) or string at ./installer.pl line 24, <$fh> line 1.
readline() on closed filehandle $fh at ./installer.pl line 27.
Use of uninitialized value $_ in split at ./installer.pl line 13.
master.myhost.com
readline() on closed filehandle $fh at ./installer.pl line 27.
Use of uninitialized value $_ in split at ./installer.pl line 13.
Use of uninitialized value $hostname in concatenation (.) or string at ./installer.pl line 24, <$fh> line 1.
readline() on closed filehandle $fh at ./installer.pl line 27.
Use of uninitialized value $_ in split at ./installer.pl line 13.
Use of uninitialized value $fields[0] in string eq at ./installer.pl line 18, <$fh> line 1.
Use of uninitialized value $hostname in concatenation (.) or string at ./installer.pl line 24, <$fh> line 1.
readline() on closed filehandle $fh at ./installer.pl line 27.
####
[################### Provisioner]$ ./installer.pl
master.myhost.com
master.myhost.com[################### Provisioner]$