The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Setup::Unix::Group - Setup Unix group (existence)

VERSION

version 0.09

SYNOPSIS

 use Setup::Unix::Group 'setup_unix_group';

 # simple usage (doesn't save undo data)
 my $res = setup_unix_group name => 'foo';
 die unless $res->[0] == 200 || $res->[0] == 304;

 # perform setup and save undo data (undo data should be serializable)
 $res = setup_unix_group ..., -undo_action => 'do';
 die unless $res->[0] == 200 || $res->[0] == 304;
 my $undo_data = $res->[3]{undo_data};

 # perform undo
 $res = setup_unix_group ..., -undo_action => "undo", -undo_data=>$undo_data;
 die unless $res->[0] == 200 || $res->[0] == 304;

DESCRIPTION

This module provides one function: setup_unix_group.

This module is part of the Setup modules family.

This module uses Log::Any logging framework.

This module has Rinci metadata.

THE SETUP MODULES FAMILY

I use the Setup:: namespace for the Setup modules family. See Setup::File for more details on the goals, characteristics, and implementation of Setup modules family.

FUNCTIONS

None are exported by default, but they are exportable.

FAQ

How to create group with a specific GID?

Set min_new_gid and max_new_gid to your desired value. Note that the function will report failure if when wanting to create a group, the desired GID is already taken. But the function will not report failure if the group already exists, even with a different GID.

SEE ALSO

Setup::Unix::User.

Other modules in Setup:: namespace.

FUNCTIONS

setup_unix_group(%args) -> [status, msg, result, meta]

Setup Unix group (existence).

On do, will create Unix group if not already exists. The created GID will be returned in the result.

On undo, will delete Unix group previously created.

On redo, will recreate the Unix group with the same GID.

Arguments ('*' denotes required arguments):

  • min_new_gid => int (default: 65534)

    When creating new group, specify maximum GID.

  • name* => str

    Group name.

Return value:

Returns an enveloped result (an array). First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.