Community

Subscribe
Highlighted
Accepted Solution

Create export command update

Hi,

     I have cloned the "create export" command to make it more secure as per our needs.  I was wondering if there are any immediate issues with this simple code?  It simply ensures that there is no world RW or RO export as it is not acceptable in the automated deployment environment we have.

if ($Anon)

{

   $expression += " -Anon " + $Anon

}

##

##New code begin

##

If (  ( $Roothosts )  -and ( !$RWhosts ) ) {

            $RWhosts = $Roothosts

}

##

##New code end

##

if(!$RWhosts -and !$ROhosts)

{

    $RWhosts = "all-hosts"

}

Re: Create export command update

Hi Scott,

Your code looks fine and there do not seem to be any issues.

Tested it briefly and it works as expected when "Roothosts" is defined.

Providing the relevant snippet of the command test log below:

"Add-NaNfsExport -Persistent -Path /vol/testvol -Root @('1.1.1.1') -ReadOnly @() -ReadWrite @('1.1.1.1')"

FYI (in case you have missed it): WFA provides a "Test" feature per command for the very purpose mentioned in this thread.

Regards,

Tanzim

Re: Create export command update

Thanks Tanzim,

     I have tested the command, previewed and executed the workflow under our existing 1.1.1 and our test 2.0 WFA.  I simply needed another set of eyes to be certain that I was not missing something.

-Scott

Re: Create export command update

Hi Scott,

Another point worth noting:

Cloned commands do not retain the Reservation characteristics that certified commands have.

Not sure if that's overly critical with said command, but worth noting.

BTW - You could have done that in the define of the export as well, and then retain the usage of our certified command:

For the RWHosts write something like

$RWHosts == "" ? $RootHosts : $RWHosts

Here's a screen cap of the definition and the results (When RootHosts contain data while RWHosts is empty):

Hope that helps.

Yaron Haimsohn

WFA Team

Re: Create export command update

Thank you Yaron!

     I didn't even think about using the variable in the find chart to correct it.  I am going to use this method so that I still am using the certified command structure.

Many thanks,

Scott