Solved

help with this Perl Script ( missing Array)

Posted on 2014-11-07
14
152 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 
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

Command Line Tips and Tricks

The command line is a powerful tool at the disposal of every Linux user. Although Linux distros come with beautiful user interfaces, it's worthwhile to learn the command line because it allows you to do a number of things that you otherwise cannot do from the GUI.  

Question has a verified solution.

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

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 …
Utilizing an array to gracefully append to a list of EmailAddresses
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

623 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