[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cpx] Re: [vps2] automated management of virtmaps



I was messing around with the add_entry and update_entry commands and they seem to do the same thing. If I try to add the same user twice with add_entry, it does nothing. If I edit the destination for that address with add_user it updates that destination. If I use update_entry to update an entry that is not there, it adds it. Is this intentional, or is there just a lot of overlap in the commands?

One thing I noticed, these are not flimsy commands. They seem pretty smart. Well written. I tried abusing them by running them multiple times with the same information and they curteously remained silent and did not duplicate or mess up data or complain. I used different usernames in the e-mail addresses and they grouped the same domain names together. I used the same usernames in the e-mail addresses and different domains and they created a new section. And after every run of each of the commands, the virtusertable database file is rebuilt on the fly.

I am quite impressed. Wow, what a handy set of one line tools for my admin tool belt. No more opening up the virtusertable file for me. These are a godsend. Just what I needed for this huge project I am working on. So now I just need to know that these commands will not change on me and wreak havoc on my users while I am sipping a Margarita (virgin of course) on some cruise ship in the Bahamas.

Seriously, the CPX team rocks!  Thank you!

Jonathan


On Mon, 6 Dec 2004, Jonathan Duncan wrote:

Jared,

Ok, you and Sherm and Scott have now got my curiosity up.

What would be the reason behind you giving me the long perl script that basically does (in the end) the same thing that the 3 liner that Sherm gave me does? I notice that one using the VSAP::Client and the other is using the VSAP:Server. I assume that the client just weeds stuff out and plays with the data before it feeds it to the server command. Yes?

Jonathan

--------------------------------------
#!/usr/bin/perl
use VSAP::Server::Modules::vsap::mail;
VSAP::Server::Modules::vsap::mail::update_entry( 'joe@xxxxxxxx' => 'joeuser');
--------------------------------------
## Other commands I found while browsing through VSAP
## VSAP::Server::Modules::vsap::mail::add_entry($sourceaddr . $sourcedomain, $dest); ## VSAP::Server::Modules::vsap::mail::update_entry($sourceaddr . $sourcedomain, $dest);
## VSAP::Server::Modules::vsap::mail::delete_entry($source);
--------------------------------------

----------------------------------------------------------------
#!/usr/bin/env perl

use VSAP::Client;

if(@ARGV != 2) {
       print "Usage: $0 source dest\n";
       exit;
}
$source = $ARGV[0];
$dest = $ARGV[1];

$vsap = new VSAP::Client(Debug => 0);
$vsap->authenticate('ADMIN_USER', 'PASSWORD', 'HOSTNAME');

$cmd = '<vsap xmlns:cp="http://vsap.org/cp";>' .
               '<vsap type="mail:addresses:add">' .
                       '<source>' . $source . '</source>' .
                       '<dest>' . $dest . '</dest>' .
               '</vsap>' .
       '</vsap>';vsap
$response = $vsap->send($cmd);

$vsap->quit;
----------------------------------------------------------------


======================================================================
This is <cpx@xxxxxxxxxxxxx>      <http://www.groupmail.org/lists/cpx/>
Before posting a question, please search the archives (see above URL).


Home | Main Index | Thread Index
Match: Format: Sort by:
Search: