The sort function is undefined in scalar context, which means a call
site that calls these functions in scalar context will trigger undefined
behavior.
Sort the result and return the list.
Fixes: Subroutines::ProhibitReturnSort
Warned-by: perlcritic
Change-Id: I355b5e3e412bc91c297a46a73bb6caba6e969f54
After some experimentation it was found to best to keep these platforms
independent, and integrate them externally as usual, instead of trying
to merge them into a single platform.
Change-Id: I19d721dece38d104b73cae573332571c4bef0fbf
This makes this function spN ready, by getting the entire list of
siblings and returning the first of them.
Change-Id: Ifc69b1764bc6d8c1007b8b567f4158a66eca81d8
This method returns a sorted list of hostnames for the pair of the
specified hostname, except itself. This is useful for spN support.
Change-Id: I4e7d46de4f480f4c56701b1663877812f74e3640
Let's remove the duplicate implementation, and simply off-load to the
command, so that we only need to modify one place.
As a side effect, this removes a bogus fallback value of 'self' for
CE systems, which should have been 'spce'.
Change-Id: I70b48caad3da4123a3399254deda73c381ae67d9
Add support for getting the nodename for any hostname in an NGCP
cluster.
We switch from fetching this information from the filesystem to the one
contained now in network.yml.
We accept up to 9 nodes per "pair", from sp1 to sp9, so for Carrier
setups that means hostnames ending from 'a' to 'i'. On CE the nodename
is called "spce".
If we cannot match the hostname to a known pattern we will error out.
Change-Id: I80c287046d02f60193479febee427615474043e3
This will be used in the templates for values that are scaled based on
the number of online CPUs on the system, such as process pools, or load
averages.
Change-Id: I3666873f327becc3f7a02be02dba82493b29252e
This method takes a string and replaces %-style meta-variables in it.
Current supported meta-variable is %v for the NGCP version.
Change-Id: I9c932e603a5791115a176b9fea25baff87cab6b9
These have been around for enough time to leave admins room to switch to
the new alternatives. Time for cleanup.
Change-Id: I40a51c8107daf53a6d7fd24b5035bbc2aff77bb6
The li role needs to be active also when the li_dist is active, as per
our own documentation. This also has the nice effect of simplifying the
code.
Change-Id: I34845e58130c6cdebb933c608006b6a4979c2ad6
These are redundant and bogus aliases for get_mgmt_node, which were
reading from a generated templated file instead of getting the
information from the source. Keep the alias around for now in case a
customer is still using this function.
Change-Id: I5aec69313d97bef5bbc655d18f03e7c9af0dbc21
When the hostname is self or unknown, we do not return any peername,
so should cope with that to avoid doing comparisons that will end up
emitting warnings.
Change-Id: Ib7e70666991a76b99e1f64ca365a3018320728ec
The li match was triggering for all wildcards and when li mode was not
enabled in some way then we were getting negative results.
The proper way to solve the original problem is to relegate the matching
of the li modes to the end, so that we can properly match on wildcards
and not interfere with other roles.
Change-Id: I7cb559a8dc10e8a832c2e2bcd78f1effc1cc101a
Fixes: commit 236b56d990
To be able to generate an authorized_keys file from templates we need
to fetch the public ssh keys for the root user. This function will make
this task easier.
Change-Id: If8edef0e77a5f3c1167fe8dfd0e92e4d9e468a6a
This partially reverts commit bc8ae9e795.
We should not match li_dist with regexes as then we would trap cases
that we should not be covering by the li_dist mapping logic. Just do
exact matches.
This also fixes the hypothetical case with other regexes that are not
the wrongly specified '*'.
Change-Id: I9d9d850969e03fa9dc587f2d47a688bc0359e63c
Otherwise it matches on 'li/li_dist' cases and the library get_all_ips
returns no IPs if called like:
> argv.role='*';
> argv.type='*';
> PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips';
> all_ips = out;
This is a hotfix commit for backporting into mr6.4.1 while the "proper" fix
should be re-considered and committed for mr6.5+
P.S we have 3 tt2 templates where we have * in argv parameters.
P.P.S. The code is from Andreas, tnx for the fix!
Change-Id: I119a687389075d2ebdcd824ed457f768b5fb2123
This adds an additional virtual li_dist role on top of the existing li
role. The difference is that li is the cluster simpli acting in central
mode, while li_dist is the cluster acting in distributed mode.
Change-Id: I930c93380a0e88649c325b7faf3c0fb86d78e5ff
Move the ngcp object variable into NGCP::Template::Object, and make
NGCP::Template just a customized variant of Template that we can use
instead.
This way we hide all the internal details of how to set up the
environment we need to process NGCP templates.
Change-Id: I690cf1a74551f4751380a506ddcc047b0942ba21