Solved

help with this Perl Script ( missing Array)

Posted on 2014-11-07
14
142 Views
Last Modified: 2015-01-02
Hello , I have this script that when I run it against this zone file I get this error


==> /local/bin/ms-fix-ad-rrs.pl -v Internal tdn.mcld.net.db

Can't use an undefined value as an ARRAY reference at /local/bin/ms-fix-ad-rrs.pl line 110, <> line 13722.

Can anyone have a look to see whats the issue? I cant seem to solve it.

BTW... The extensions were renamed.

The output should look like this if it worked for that zone name:

# ACL for DCs zone [indstream.com]
conf zone mod indstream.com set allow_update=[10.104.92.58, 10.104.92.57, 10.104.92.59, 10.104.92.56]
# AD Records for zone [indstream.com]
conf zone "" del host indstream.com view Internal
conf zone "" add a_rec indstream.com 10.104.92.58 view Internal
conf zone "" add a_rec indstream.com 10.104.92.57 view Internal

conf zone "" del host gc._msdcs.indstream.com view Internal
conf zone "" del host forestdnszones.indstream.com view Internal
conf zone "" del host domaindnszones.indstream.com view Internal
#--DC CNAMES

Thanks

Rich
ms-fix-ad-rrs-.txt
tdn.mcld.net.db.txt
0
Comment
Question by:richsark
  • 7
  • 7
14 Comments
 
LVL 84

Expert Comment

by:ozo
ID: 40428865
$rrs{'tdn.mcld.net'} was undefined.
Should it have been defined?
If so, what should it have been defined as?
Or what would you want to have happen when it is undefined?
0
 
LVL 1

Author Comment

by:richsark
ID: 40428972
Hi. I would like for it to run anyway or have it defined based on the name.

Does that make sense. ?
0
 
LVL 84

Expert Comment

by:ozo
ID: 40429024
Run in what manner? Have what defined based on what name?
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:richsark
ID: 40429072
Hi.  Based on tdn.mcld.net.db
0
 
LVL 84

Expert Comment

by:ozo
ID: 40429094
Do you mean like this?
  my $dclist = join ( "," , @{ $rrs{$zone}||$rrs{'tdn.mcld.net.db'} } );
When I run your ms-fix-ad-rrs-.txt  on the data in your tdn.mcld.net.db.txt, $rrs{'tdn.mcld.net.db'}  is not defined either
0
 
LVL 1

Author Comment

by:richsark
ID: 40429421
Hi. So ...is there a way it can be forced to be defined. Like perhaps insert it ?
Or would it be easier to type it inside the file somewhere ?
0
 
LVL 84

Expert Comment

by:ozo
ID: 40429501
What do you want to define, and what do you want to define it to be?
0
 
LVL 1

Author Comment

by:richsark
ID: 40429648
Can it be defined as tdn.mcld.net.db
0
 
LVL 84

Expert Comment

by:ozo
ID: 40429744
If you mean you want to change,
  my $dclist = join ( "," , @{ $rrs{$zone} } );
to
  my $dclist = join ( "," , @{ $rrs{$zone}||$rrs{'tdn.mcld.net.db'} } );
that also finds nothing, since there is no line beginning with tdn.mcld.net.db in the http://filedb.experts-exchange.com/incoming/2014/11_w45/881747/tdn.mcld.net.db.txt file you posted.
0
 
LVL 1

Author Comment

by:richsark
ID: 40429768
Ok. So can I add it in the file. Just looking for ideas on how to achieve this
0
 
LVL 1

Author Comment

by:richsark
ID: 40429887
Hi Ozo,

so what I did is added this in that tdn.mcld.net.db file

tdn.mcld.net.   IN      A       100.100.100.1

I ran that script and it seemed to work once I added. So the question is, If that A record match is not there, the script fails.

So maybe if we can modify the script to output " Missing matching A Record for ..."

can this be done?
0
 
LVL 84

Expert Comment

by:ozo
ID: 40429922
You might insert the line
   die "Missing matching A Record for $zone" unless $rrs{$zone};
or perhaps change
  my $dclist = join ( "," , @{ $rrs{$zone} || ["Missing matching A Record for $zone"] } );
0
 
LVL 1

Author Comment

by:richsark
ID: 40429960
Ok. Great. Does it matter where I woukd inset these different options ?
0
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40430766
Before or in place of
my $dclist = join ( "," , @{ $rrs{$zone} } );
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I've spent many an hour playing on hardened, DMZ'd servers, with only a sub-set of the usual GNU toy's to keep me company; frequently I've needed to save and send log or data extracts from these server back to my PC, or to others, and…
Utilizing an array to gracefully append to a list of EmailAddresses
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

823 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question