The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Shell::Var::Reader::CMDB - Helper for updating shell_var_reader based CMDBs.

VERSION

Version 0.4.0

SUBROUTINES

update

Reads through the directory and process all relevant files.

    Shell::Var::Reader::CMDB->update(
                                   dir=>'./foo/',
                                   verbose=>1,
                                   );

The following options are available.

    - dir :: Path to where to create it.
        - Default :: undef.

    - verbose :: If it should be verbose or not.
        - Default :: 1

    - to_process :: An optional array of groups or systems
            to process by path.
        - Default :: undef

If dir undef, it will check the following directories for the file '.shell_var_reader'.

  ./
  ../
  ../../
  ../../../
  ../../../../

When using to_process, group and systems should not be mixed as it will result in groups being ignored as systems is more restrictive.

Lets assume we have the following...

    ./group_a/foo.sh
    ./group_a/bar.sh
    ./group_b/nas.sh

So if we have to_process set to ['group_a'] the following would be processed...

    ./group_a/foo.sh
    ./group_a/bar.sh

So if we have to_process set to ['group_a/bar.sh'] the following would be processed...

    ./group_a/bar.sh

So if we have to_process set to ['group_a/bar.sh', 'group_b'] the following would be processed...

    ./group_a/bar.sh

LAYOUT & WORKFLOW

Specifically named files.

    - .shell_var_reader :: Marks the base directory as being for a shell_var_reader CMDB.

Specifically named directories.

    - cmdb :: The TOML CMDB directory.
    - json_confs :: Generated JSON confs.
    - shell_confs :: Generated shell confs.
    - toml_confs :: Generated TOML confs.
    - yaml_confs :: Generated YAML confs.

Other directories that that don't start with a '.' or contiain a file named '.not_a_system_group' will be processed as system groups.

These directories will be searched for files directly below them for files ending in '.sh' and not starting with either a '_' or a '.'. The name used for a system is the name of the file minus the ending '.sh', so 'foo.bar.sh' would generate a config for a system named 'foo.bar'.

When it finds a file to use as a system config, it will point shell_var_reader at it with TOML CMDB enabled and with the name of that system set the hostname to use with the TOML CMDB. That name will also be saved as the variable 'SYSTEM_NAME', provided that variable is not defined already. If a 'munger.pl' exists, that file is used as the munger file. shell_var_reader will be ran four times, once to generate each config type.

AUTHOR

Zane C. Bowers-Hadley, <vvelox at vvelox.net>

BUGS

Please report any bugs or feature requests to bug-shell-var-reader at rt.cpan.org, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Shell-Var-Reader. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Shell::Var::Reader

You can also look for information at:

ACKNOWLEDGEMENTS

LICENSE AND COPYRIGHT

This software is Copyright (c) 2023 by Zane C. Bowers-Hadley.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)