NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Software Development Kit (SDK) and API Discussions

perl - SDK - append export

kfelipe
4,168 Views

Hi folks,

I am quite new with the Perl SDK, but I've tried several ways of appending exports with no success

I am using version 5.3.1

 

This is the method:

nfs_exportfs_append_rules

which requires one parameter named rules and expects an array of 'exports-rule-info'

 

it fails with error: Field 'exports-rule-info[]' for 'rules' not specified (13001)

 

Can anyone copy an snipet of code how to add an array of exports-rule-info or similar as an input parameter?

This is my code:

   my $rule=new NaElement('exports-rule-info');
   $rule->child_add_string('pathname','/vol/test1');
   my $rules = new NaElement('rules');

   $rules->child_add($rule);
   my @RuleS=();
   push @RuleS,$rule;
   $out = $s->nfs_exportfs_append_rules('rules'=>$rules);

I have tried passing also the @RuleS and the \@rules with no success

 

Thanks in advance and regards,

1 ACCEPTED SOLUTION

richard_payne
4,139 Views

I haven't had time to actually add hosts/subnets/netgroups to the export...but this at least passes, hopefully it helps

 

 

my $cmd = new NaElement ('nfs-exportfs-append-rules');
my $rules= new NaElement ('rules');
my $expRuleInfo = new NaElement('exports-rule-info');

 

$expRuleInfo->child_add_string('pathname','/vol/test1');

$cmd->child_add_string('verbose','1');
$rules->child_add($expRuleInfo);

$cmd->child_add($rules);

my $result = $s->invoke_elem($cmd);

 

 

$s is of course the NaServer insance.

 

--rdp

View solution in original post

2 REPLIES 2

richard_payne
4,140 Views

I haven't had time to actually add hosts/subnets/netgroups to the export...but this at least passes, hopefully it helps

 

 

my $cmd = new NaElement ('nfs-exportfs-append-rules');
my $rules= new NaElement ('rules');
my $expRuleInfo = new NaElement('exports-rule-info');

 

$expRuleInfo->child_add_string('pathname','/vol/test1');

$cmd->child_add_string('verbose','1');
$rules->child_add($expRuleInfo);

$cmd->child_add($rules);

my $result = $s->invoke_elem($cmd);

 

 

$s is of course the NaServer insance.

 

--rdp

kfelipe
4,119 Views

Yes, it does help. It worked.

Thanks you very much!

Felipe

Public