Subscribe

Perl AIP name-mapping-unix-user-create

I've just started using the Perl API so forgive my ignorance.

 

I'm trying to add new Unix user to a SVM and according to the documentation, the appropriate call is name-mapping-unix-user-create.

 

use lib '/netapp-manageability-sdk-5.4/lib/perl/NetApp';
use NaServer;
use NaElement;

$in = NaElement->new("name-mapping-unix-user-create");
$in->child_add_string("user-name",$u);
$in->child_add_string("user-id",$uid);
$in->child_add_string("group-id",$gid);
$in->child_add_string("full-name",$name);

$response = $s->invoke_elem($in);

When this code runs I get the following error.

 

 

ERROR: Unable to find API: name-mapping-unix-user-create

 

Am I missing something obvious? All of my other API calls and Cluster connecttions work. This is the first one that bombs.

Re: Perl AIP name-mapping-unix-user-create

Hello,

 

Based on the text you've posted, I'd say you haven't set your vserver context. If you look at the API docs for this call you'll see:

 

[Family: vserver]

 

Which means this call is only valid if you're talking to (or have selected) a vserver. You can't run this API against the cluster itself.

 

You'll want to do something like:

 

        $s->set_vserver("vservername");

 

Where $s is your connection to the cluster, and vservername is of course the name of your vserver.

 

--rdp

Re: Perl AIP name-mapping-unix-user-create

I added the following. I also included my connection code.

 

 

$s = NaServer->new ($filer, 1, 0);
if (ref ($response) eq "NaElement" && $response->results_errno != 0) {
        $r = $response->results_reason();
        print "Unable to set authentication style $r\n";
        exit 2;
}

$s->set_admin_user($user, $pw);
$response = $s->set_transport_type('HTTP');
if (ref ($response) eq "NaElement" && $response->results_errno != 0) {
        $r = $response->results_reason();
        print "Unable to set HTTP transport $r\n";
        exit 2;
}

$s->set_vserver("cifs1");
$in = NaElement->new("name-mapping-unix-user-create");
$in->child_add_string("user-name",$u);
$in->child_add_string("user-id",$uid);
$in->child_add_string("group-id",$gid);
$in->child_add_string("full-name",$name);

$response = $s->invoke_elem($in);

Same error.

 

 

ERROR: Unable to find API: name-mapping-unix-user-create

Re: Perl AIP name-mapping-unix-user-create

Which version of cDot?

 

I just ran that code against an cluster running 8.3.1P2: and it worked fine. I even ran a 'name-mapping-unix-user-get-iter'  afterwards and saw the account i just added.

 

 

--rdp