Instead of silently ignoring the config file, which can be quite
perplexing, print a warning mentioning that the symlink is missing
and that the file is not being loaded.
Change-Id: I3dca401edf6c7fc7e6820569f02adc98f73ad89a
We check whether we have both a sites.yml and a sites/ directory.
If so, and multi-sites support is enabled, then we proceed to load
all the multi-sites configurations, by placing each of them under
«sites.<site-name>.<config>». Adding a «sites.current» link to the
current site, and filling the root tree config with the current site
as well for backwards compatibility.
Change-Id: Ia810f57e8e976eef6a7582bddda46c1701456ed6
For multi-site support we need to pass all the possible files to load,
and these might be different between sites, so we need to check for
their existence from within tt2-process, instead of from the outside as
that would restrict them to only the current site.
Change-Id: I0965506832aa2f0a1ba67b19511c509bec60922e
The HA_NODE, HA_FILE and HA_CONFIG variables and nomenclature are
deprecated in favor of the NGCP_NODENAME, NODE_FILE and NODE_CONFIG.
Switch the old uses to the new ones. Unify PAIRNAME to NGCP_PAIRNAME.
Leave the old HA_ variables for backwards compatibility
Change-Id: I11f09f1620c2e456f10fc17229b61ec5a35a732b
The YAML::XS module handles its passed or returned data for Load() and
Dump() as raw UTF-8, irrespective of perl's UTF-8 string markers. When
we use these functions we need to use a «:raw» encoding or we will end
up with doubly encoded strings.
We also need to tell the Template Toolkit to use UTF-8 as encoding, and
then setup the file handles to use the appropriate encodings.
Change-Id: I37a6811f0680763d7177c3ad92ddf9b890869e66
we need to produce different output for each instance defined
from the same source
* helper/instances-info, produces the needed output to feed
helper/tt2-process with the proper arguments to build
instances files. We inject ``instance_name`` with the
proper value to templates and INSTANCE_NAME to hooks
environment
* ${NGCPCTL_MAIN}/ngcpcfg.instances is where we define the
supported instance templates and where the output path is
* helper/tt2-process, add -r --replace <path:path> option
in order to allow generation of different output from
the same source
Change-Id: I067266b5226485ea0d6c3bc3436275c5553a8177
Permissions should be set based on the "base file", since derived files
.customtt.tt2 or .customtt.tt2.web01a often have been created or copied
without the right permissions, whereas the base file usually has the
right permissions (at least if unmodified since shipped from the .deb
file, which if it happens it's usually a mistake).
This has been detected as an actual problem in several customers
upgrades when generating files like 'monitrc' with the wrong
permissions, and then 'monit' refusing to start, causing significant
headaches and waste of time.
Even if this is not always the cause, the problem comes often from
having .customtt files with different permissions (created new or copied
from other hosts or personal laptops from Ops/Support). In the past
there were .postbuild files to control the final ownership and/or
permissions of the file generated, so this problem was avoided, but at
some point most of them were deleted in commit
f65ae16579a62768dde0936d61e38af50550de6f (the solution favoured was to
control this at the repo/.deb and file level).
The corner cases will be dealt with with other extra measures, like
re-establishing those .postbuild files for the known and more dangerous
cases. But as a starting point, the permissions to be used for the
final file should be based on those of the "base file", and not these
.customtt files, for the reasons mentioned above.
Change-Id: I793cc68e8b962371c7b1d5192564da4b4d45bb8c
When operating on pairs of arguments we also need to return an array
ref.
Change-Id: Ib5ef81f11ecc6473ba6c3ee4b9012884a40e659a
Fixes: commit 59d95f0549
This makes the code easier to understand as it separates generic logic
from one specific to the tt2 processing.
Change-Id: I3b8a9922816e8b15cfba296b4ee4597baeeeffdf
Move the hook selection at the input/output file generation stage, and
refactor the hook execution into a new function.
Change-Id: I010e50d198f946f5e8e5da0e60cf87d5688c45c7
This avoids lots of chmod calls.
We do not need the symlink handling, as we will generate now the files
with the correct permissions, and will respect the symlinks on mv, as
before, and are not doing the explicit chmod anymore.
Change-Id: I9ab75dda79e8b346eb1f41c36b450d6fabb10f11
This is needed for the get command, so that we can exactly control where
to output to, and avoid all the file generation heuristics based on the
input files.
Change-Id: Iace05d1093342722553ec0bbb8ff0e817f77857c
This makes sure we sort each array, instead of sorting the second, and
then letting perl merge the first aray with the result of the second
sort, and then sorting them all as a single array.
Change-Id: I7cd22bf479fee79c104627bf652f0ee674117eec
Fixes: commit 011ce33f32
The current shell code is very inefficient, as it uses files to track
the file lists, and grep to traverse them NxM times per N files.
Change-Id: I8396b4ee232157cea8ef599cba0618be3dd93536
Switch away from the old daemon/wrapper architecture, which complicates
things and requires more scaffolding code.
We turn the daemon/wrapper and build_config into a single perl process
that will load all YAML files, and then process each input/output pair
on a parallel child, to try to speed up the processing as much as
possible.
For whole rebuilds, it might speed up the generation by at least a
factor of x2, x4 or more, depending on the number of active processors.
Change-Id: I51aa2f90336e34a20983d8733f45b64d9b6fea0b