Solved

help with this Perl Script ( missing Array)

Posted on 2014-11-07
14
131 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now