Nolan Brubaker 57fef57868 Move base environment directory to an argument
In preparation for moving the current code into a new file but retaining
the existing dynamic_inventory.py entry-point, this change modifies the
main function so that can generate inventory without having to be in the
same directory as the env.d dir.

An initial attempt to move the `main` function of dynamic_inventory into a
structure like this:

    playbooks/
        inventory/
            env.d/
                <env files>
            dynamic_inventory.py
            lib/
                generate.py (contents of dynamic_inventory moved here)

resulted in errors when trying to access env.d due to using
os.path.join(__file__) inside the function. Also, incorporating this
change with the move would have resulted in a harder-to-review patch.

Instead, the `args` function will be left inside of dynamic_inventory.py
when `main` is moved out, so that the CLI-facing code is grouped
together.

Since the base environment was moved to a command line argument,
documentation was added as to its function, as well as the differences
from the --config argument.

As a side effect, this opens the door to running tests with multiple
environment layouts. However, none is added with this review.

Change-Id: Ie690f31b64c7381257634a9dbb2ee5b4197fd9bf
2016-09-28 22:26:16 +00:00
..