Solved

help with this Perl Script ( missing Array)

Posted on 2014-11-07
14
138 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

910 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

22 Experts available now in Live!

Get 1:1 Help Now