Recent Changes - Search:


Code:


Social:


My journals will take the place of a blog. If you go to the Journal page there is an RSS feed to subscribe with.

« July 2017 
SunMonTueWedThuFriSat
      1
2345678
9101112131415
16171819202122
23242526272829
3031     

Sites I take responsibility for

West Volusia, Florida

Documents

Technical

General

Me

Living

Places I frequent

Hobbies

Humor

Items for sale:


Clipboard

edit SideBar

Linode ticket 161973

Include our styles below Infobox - invoke as >>infobox<< ... >><<

Codebox: - invoke as >>codebox<< ... >><<

warnbox: - invoke as >>codebox<< ... >><<

editingbox: - invoke as >>codebox<< ... >><<

noticebox: - invoke as >>codebox<< ... >><<

Page bread crumbs: Welcome to ke3vin.org! - Temp - 20100329

Pages by tags: (:listtags:)
Subscribe to this wiki: RSS Feed RSS or subscribe to this page for changes: RSS Feed RSS
496 articles have been published so far. Recent changes
Share

2016-03-22: This site is being moved to my main site at https://kevininscoe.com/wiki as part of a consolidation to one domain.


This article maintenance has now been moved to WebService::Linode and this temporary article will be purged in 30 days.

 [161973] Can't locate object method "getDomainIDbyName" v
 Status 	OPEN
 Opened On 	2010-03-28 08:01:10 AM by kinsce2
 Last Updated On 	2010-03-28 02:56:50 PM by mgreb

shell script:

 setenv linode_api `/bin/cat /usr/local/admin/etc/linode`
 setenv public_ip `some routine to pull the public address from the NAT`

CPAN module:

http://search.cpan.org/~mikegrb/WebService-Linode/lib/WebService/Linode.pm

 Additional Helper Methods
          o getDomainIDbyName( domain => 'example.com' )
          o getDomainResourceIDbyName( domainid => 242, name => 'www') 

Perl script:

 
#!/usr/bin/perl -w

use WebService::Linode;

my $apikey = $ENV{'linode_api'};
die "error: environment variable linode_api is not set correctly." unless $apikey;
my $pubip = $ENV{'public_ip'};
die "error: environment variable public_ip is not set correctly." unless $pubip;

print "Public ip is $pubip\n";

if ( $pubip eq "" || $apikey eq "" ) {
        die "error: environment variables are not set correctly.";
}

my @domains = ('kevininscoe.com', 'unixforbusypeople.com');
my @Site1Names;
my $domain='';
my $record='';
my $domainid=0;
my $api;

foreach (@domains) {

        $domain = $_;
        print "Entering domain=$domain\n";

        if ( $domain eq "kevininscoe.com" ) {
                @Site1Names = ('site1', 'home.site1', 'proxy', 'svn', 'icecast', 'private', 'pub', 'lab.site1');
        } elsif ( $domain eq "unixforbusypeople.com" ) {
                @Site1Names = ('lab');
        } else {
                print "Unknown domain name $domain\n"; 
                @Site1Names = ('unknown');
        }

# Get the domainid needed by the API
        $api = new WebService::Linode(apikey => $apikey);
        $domainid = $api->getDomainIDbyName( domain => $domain );
#       die "Couldn't get domain id for $domain" unless $domainid;
#       print "DomainID for $domain is $domainid\n";

        foreach (@Site1Names) {

                $record = $_;
                print "Setting FQDN=$record.$domain\n";
                print "Domain=$domain, Record=$record\n";

                my $resourceid = $api->getResourceIDbyName(domain => $domain, name => $record);
#               die "Couldn't find RR id for $domain" unless $resourceid;

                $api->domainResourceUpdate(domainid => $domainid, resourceid => $resourceid, target => $pubip);
        }
}

Error produced:

 # set_linode_site1_dns.sh.orig   
 Public ip is n.n.n.n
 Entering domain=kevininscoe.com
 Setting FQDN=site1.kevininscoe.com
 Domain=kevininscoe.com, Record=site1
 Undefined subroutine &WebService::Linode::getResourceIDbyName called at /root/set_linode_site1_dns.pl.orig line 52

Kevin's Public Wiki maintained and created by Kevin P. Inscoe is licensed under a
Creative Commons Attribution 3.0 United States License.

Back to my web site - http://kevininscoe.com

Edit - History - Print - Recent Changes - Search
Page last modified on April 03, 2010, at 07:59 AM EST