Update centos-art.sh's prepare module.
- Previously, the prepare module doesn't fit inside the modular design
of centos-art.sh script. As consequence, the prepare actions didn't
work. This updates makes the prepare module to fit the centos-art.sh
script modular design and prepare module now runs as expected.
- The command-line options changed. See centos-art.sh-prepare.1
documentation, also added with this update inside the Manuals
directory. Notice that, in this update, the --links option doesn't
work because the symlink sub-module isn't implemented inside render
module yet. This is an issue of render module not prepare module.
- Previously, the prepare module hasn't any documentation in its
structure. In this update an initial documentation written in
centos-art.sh-prepare.asciidoc file was put in the Manuals directory
of prepare module. In this directory there is also a render.conf
file that can be used to produce both html and man pages from the
asciidoc file.
The update of centos-art.sh-preapre module required the following
updates to centos-art.sh common scripts:
- Add tcar_checkFnEnvironment.sh and tcar_setSubModuleEnvironment.sh
files.
- Previously, the tcar_checkFiles function didn't verify whether the
FILES variable had an empty value or not. Since the FILES variable
is used as data source for the loop, all the verifications could be
skipped because no data was provided. Because verification were not
applied, the work flow continues as no error would be present. This
would provoke further calls that required the file to continue to
fail because no file was present. This updates the tcar_checkFiles
function to verify whether FILES variable has an empty value or not,
letting the script execution to finish with an error the way we
expect in case of empty value.
- Previously, it was not possible to refer the current working
directory using the ./ form from the centos-art.sh script command
line. With this update the tcar_checkRepoDirSource function was
changed to let referring the current directory using the form ./.
- Previously, it was not possible to refer the repository's root
directory from a place different to repository's root directory.
This update changes the tcar_checkRepoDirsource function to let
referring the repository's root directory using a single slash (/)
as argument to centos-art.sh command. In case more than one slash be
passed instead of a single one, they all will be removed in the sake
of a single slash only. This way the final location is returned
clean.
- Previously, module documentation was read from files in the form
MODULE_NAME.1, produced from MODULE_NAME.asciidoc files. This may
bring confusion to users since it is possible that some modules has
the same name of other commands outside centos-art.sh script. To
avoid confusion, this update changes the tcar_printHelp function to
start using the form centos-art.sh-MODULE_NAME.1 to all modules'
documentation.
- Previously, error messages produced by tcar_printMessage function
were all output to standard error. When errors where produced by
functions called inside variable assignment, the error messages
produced by tcar_printMessage was stored in the variable and printed
in unexpected ways later. This update changes the tcar_printMessage
to redirect error messages to standard error. This change fixes the
issue of saving error messages inside variables but don't fixes the
problem of stop script execution after an error triggered this way.
To workaround this last script execution issue, do all the
verifications you need before calling functions in the right side of
variable assignment constructions. To do that be sure the functions
you call will not fail in any way.
- Remove the tcar_setFnEnvironment function from Scripts/ directory.
The tcar_setModuleEnvironment function should be used instead. We
are re-organizing code in a modular fashion and
tcar_setFnEnvironment doesn't fit in it. In fact, the
tcar_setFnEnvironment has evolved into tcar_setModuleEnvironment.
- Previously, when tcar_setModuleEnvironment function tried to load a
module and the module didn't exist, it printed an error message
telling so, but no reference to the exact non-existent module was
mentioned in the error message. This update changes the
tcar_setModuleEnvironment function to tell what the non-existent
module is.
- Previously, everything was treated as a module. Even modules inside
modules. It seems like there is no problem with this design when
there is no need to call parent modules from children modules.
However, when we need to call parents modules from children modules,
we cannot use the same name space for both of them because path
information is remember only for the last module loaded. If we try
to load a parent module from a children module the children module
will try to load a module children to it with the name of the parent
module we tried to load. If such module doesn't exist, centos-art.sh
script shows an error message.
To solve this issue, we created two module name-spaces inside the
centos-art.sh script. One for parent modules defined by the function
tcar_setModuleEnvironment and other for children modules defined for
the function tcar_setSubModuleEnvironment.
When the centos-art.sh script is executed, it is executed with a
parent module that may call several levels of children modules one
inside another so the last children has all the information of its
parents. In this configuration, you cannot call parent modules from
children modules unless the module you are calling is in the first
level of modules' directory structure (i.e., Automation/Modules/)
and use the tcar_setModuleEnvironment function for that.