NetApp...:Export(3pm)

πŸ“¦
version 500.002 Β· 2 versions
  • 500.002 Β· debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking (latest)
  • 500.002 Β· ubuntu jammy
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ¦‹ NAME πŸ¦‹

okay so welcome to the NetApp...:Export(3pm) page bestie πŸ’– this is NetApp::Filer::Export β€” an OO Class for representing NFS exports. she's a whole queen and she's here to help you manage your exports one at a time, no cap.


✨ SYNOPSIS ✨

use NetApp::Filer;

my $filer                   = NetApp::Filer->new({ ... });

# Filer methods for querying exports:
my @exports                 = $filer->get_exports;
my @temporary_exports       = $filer->get_temporary_exports;
my @permanent_exports       = $filer->get_permanent_exports;
my @active_exports          = $filer->get_active_exports;
my @inactive_exports        = $filer->get_inactive_exports;

# Methods for accessing export attributes
foreach my $export ( @exports ) {

}

# Methods for changing export attributes

🌸 DESCRIPTION 🌸

so basically this class encapsulates a single NFS export on a NetApp filer, and hands you all the methods for managing them 🫢 there's a whole bunch of related methods over in the NetApp::Filer class that deal with exports as a whole, but everything in this class is specifically about one single NFS export. one. singular. main character energy only πŸ’…

πŸŽ€ API specific attributes πŸŽ€

this API is also out here trying to bring some sanity to how exports are managed, and some consistency to the interface, because honestly? needed. most of the attributes of an export are pretty obvious and they map directly to the options supported by exportfs and the /etc/exports file. but this API introduces two new attributes: 'type' and 'active'.

⭐ The type attribute ⭐

so to distinguish between exports that are temporary (i.e. NOT saved to /etc/exports) and those that are permanent (i.e. ARE saved to /etc/exports), this API supports a "type", which can be either of:

permanent
temporary
  • a temporary export is one that was created using exportfs -io, and which was not saved to /etc/exports. these exports will not survive a reboot of the filer. rip to them honestly πŸ’€
  • a permanent export is one that is found in /etc/exports.

πŸ’œ The active attribute πŸ’œ

since you can change the export options for a filesystem temporarily (for example, by using the "fencing" option -b, or just manually specifying different options and re-exporting using -io), some permanent exports may not actually be in effect on the system. the audacity.

the active attribute is what tracks these. if the active attribute is true, then the export is currently in effect. almost by definition, all temporary exports are always active. however, if a permanent export is not in effect because a temporary export for the same pathname has been created, then such an export is considered inactive 😭

🌈 Global vs. Limited ro/rw Attributes 🌈

the "ro" and "rw" export options really have two different modes of use. if either option is specified with no "=a[:b[:c...]]" list, then it means ALL hosts. and since this API provides methods for adding and removing entries from those lists, it treats the "all" cases special, by managing them as separate attributes ✨

to specify global readonly or readwrite access, use the following options:

ro_all
rw_all

these have boolean values. the "rw" and "ro" attributes/options are ARRAY references, each containing the list of entries for an "rw=" or "ro=" list for managing limited access. iykyk 🧚

πŸ¦‹ Change and Update Semantics πŸ¦‹

there are several methods for changing the attributes of an export object, but in ALL cases, these merely change the object in memory. for the attribute change to actually take effect, the update method must be called, which will generate and execute the appropriate "exportfs" command. so like, don't forget the update bestie, or nothing happens πŸ™ˆ

for example, suppose you wanted to remove root access for a specific hostname from all exports on a filer:

my $untrusted       = 'unsafe.foo.com';

my @exports         = $filer->get_exports;

foreach my $export ( @exports ) {
    if ( $export->has_root( $untrusted ) ) {
        $export->remove_root( $untrusted );
        $export->update;
    }
}

the "remove_root" method simply removes the entry from the object in memory. the "update" method re-exports that filesystem to make the change take effect on the filer. two-step process, both steps mandatory, no skipping πŸ’…


πŸ‘‘ METHODS πŸ‘‘

πŸ’– get_filer

returns the NetApp::Filer object for the filer on which this export exists. your filer, your girl, your connection 🫢

πŸ’– get_type

returns a string with one of the following values:

temporary
permanent

indicating whether or not this particular export has been written to /etc/exports.

πŸ’– get_active

returns a boolean value, false only if the type is "permanent", and the same export was not found in the list of currently active exports (i.e. not found in the output of "exportfs"). a temporary export is always active, by definition. she said what she said ✨

πŸ’– get_path

returns a string representing the path for the export. note that this may not necessarily be the same as the actual pathname of the underlying volume or qtree. it's giving vibes, not necessarily truth 😭

πŸ’– get_actual

returns a string representing the "actual" path of the underlying volume or qtree for the export. if a volume or qtree has been exported using a different name, this is the actual path of the underlying object. if this export option was not used, this method will return an empty string.

πŸ’– get_nosuid

returns a boolean value, indicating whether or not the "nosuid" option is used by the export.

πŸ’– set_nosuid( $boolean )

this method takes a single argument, interpreted in boolean context, and sets the "nosuid" option for the export.

πŸ’– get_anon

returns the value of the "anon" option, if set. since this option can have the value of "0", it returns undef when this option has not been set.

⚠️ WARNING: be careful interpreting this in a simple boolean context. to test whether or not this option has been set use "defined". do not get got by the falsy zero bestie, fr fr.

πŸ’– set_anon( $anon )

takes a single argument, and sets the "anon" option to that value. to unset this option, pass an undefined value:

$export->set_anon( undef );

πŸ’– get_sec

returns a list of the "sec" option values.

πŸ’– set_sec( $arrayref )

takes a single argument, an array reference of "sec" values, which can be any of: none, sec, krb5, krb5i, or krb5p. this API does no validation of these values, so if an invalid value is given, this will result in a fatal exception when the "update" method is called. so like, be normal about it πŸ’€

πŸ’– has_sec( $sec )

takes a single string argument, and returns true if that value is found in the list of "sec" options, false otherwise.

πŸ’– add_sec( $sec )

takes a single string argument, and adds that value to the list of "sec" options, if not already present. no dupes, we're not messy πŸ’…

πŸ’– remove_sec( $sec )

takes a single string argument, and removes that value from the list of "sec" options, if present.

πŸ’– get_root

returns a list of the "root" option values.

πŸ’– set_root( $arrayref )

takes a single argument, an array reference of "root" values, which can be any combination of hostnames, IP addresses, or networks. again, no data validation is performed, so bogus values will not be detected until the export is updated on the filer, using the "update" method. 😭

to clear the root option entirely, simply pass an empty array reference.

πŸ’– has_root( $root )

takes a single string argument, and returns true if that value is found in the list of "root" options, false otherwise.

πŸ’– add_root( $root )

takes a single string argument, and adds that value to the list of "root" options, if not already present.

πŸ’– remove_root( $root )

takes a single string argument, and removes that value from the list of "root" options, if present.

πŸ’– get_ro_all

returns a boolean value, indicating whether or not the "ro_all" option has been set.

πŸ’– set_ro_all( $boolean )

takes a single boolean argument, and sets the "ro_all" option to its value. setting "ro_all" to a true value will clear the "ro" list, if it exists.

also, if "ro_all" is true, then the following methods will quietly do nothing:

has_ro
add_ro
remove_ro

the "ro_all" option must be cleared (set to a false value) first. no shortcuts bestie ✨

πŸ’– get_ro

returns a list of the "ro" entries, if any. returns nothing if "ro_all" has been set.

πŸ’– set_ro( $arrayref )

takes a single argument, an array reference of "ro" values. setting the "ro" list explicitly will set clear "ro_all" (set it to a false value). mutual exclusivity, iconic behavior πŸ’…

πŸ’– has_ro( $ro )

takes a single argument, and returns true if that value is found in the list of "ro" options, false otherwise. if "ro_all" is true, then it always returns false.

πŸ’– add_ro( $ro )

takes a single string argument, and adds that value to the list of "ro" options, if not already present. if "ro_all" is true, then this method will do nothing.

πŸ’– remove_ro( $ro )

takes a single string argument, and removes that value from the list of "ro" options, if present. if "ro_all" is true, then this method does nothing.

πŸ’– get_rw_all, set_rw_all, get_rw, set_rw, has_rw, add_rw, remove_rw

all of these methods behave exactly the same as their "ro" counterparts described immediately above. they apply to the "rw" option, instead of "ro", but if that isn't obvious... πŸ™ˆ

πŸ’– update

this method re-exports the export, using "exportfs". if ANY of the object attributes have been changed programmatically, those changes will not take effect on the filer until this method has been called.

note that updating an export will not necessarily change its "type" from temporary to permanent, unless the "type" is explicitly changed. so like, update β‰  promotion, bestie, they're different things 🫢

πŸ’– compare( $export )

this method takes a single NetApp::Filer::Export object, and compares the current object (that is, the one on which the method was called) to it. if they have the same basic export options, it returns true, otherwise, it returns false. only the following options are compared:

actual
nosuid
anon
sec
root
rw/rw_all
ro/ro_all

🌟 and that's the whole page bestie!! this was the NetApp...:Export(3pm) man page from perl v5.36.0, dated 2022-11-19. go forth and manage your exports, you absolute icon πŸ‘‘πŸ’–βœ¨
πŸ“¦ where this page comes from