During system bootstrap/installation we might not have any SSH host
certificate at all. We should at most emit a warning and return. Making
it fatal means that we cannot even install the system.
Change-Id: I8404cf41b9691f1804e2221f5a4969058c0fb116
Support specifying which site to use, while using current as the
default, which should work everywhere.
Change-Id: Iee9d76b984830905aa76daf7b04c68f6aeaba6aa
To be able to generate templates that are multi-site aware and provide
connectivity across multiple sites we need to be able to get public SSH
keys for any site configured.
We remove the trailing slashes, as those gets duplicated when generating
the filename, and produces ugly output on error/warning.
Change-Id: I058545efae6e5ed44908a6abd3a56fac313d5841
During an upgrade we might not yet have all the desired optional SSH
keys in place yet, and failing when a template requests such keys is
going to make the whole installation fail, which is not desirable.
Instead emit a warning, and continue. Once the keys get generated on
the next build they will be integrated into the templates output.
We keep the 'rsa' keys being fatal, as that's the current key type
expected to be present on all systems, and if it is not, then we have
a problem we should be looking at. At some point we will switch the
required key to some other key type, once we deprecate 'rsa', for
example due to a post-quantum security transition.
Change-Id: If7429a5a952d757ed6093ede43167e3742e56b97
Only run these checks when we have useable and useful information to
check against. In particular, don't run these checks during deployment
or installation.
Change-Id: I5e31c9c2c1e79151f407eae3a1d29a5f68502531
As there is currently no update-schema script for sites.yml, set
'location' variable as optional. Otherwise during the upgrade to
relevant release (where location is required), schema check will
fail because this variable is not set in the old sites.yml file.
Change-Id: Iebf77e48a08f9c0461f6db8ac41591191284bb36
We need to add support for Debian v14 AKA forky so ngcpcfg doesn't
fail generating files like the ones in /etc/apt/sources.list.d/*.
We switched to usage of /etc/os-release in our installer also,
taking over information from its commit message:
File /etc/os-release was introduced by the systemd project in 2010, and
Debian included it as of base-files v6.8 for Debian 6 AKA jessie.
Its VERSION_CODENAME is present since base-files v10.2, so we can rely
on it for all our supported releases.
It also makes our life easier, as /etc/debian_version contains forky/sid
until it's released as stable version, while /etc/os-release always
contains the proper VERSION_CODENAME from its very beginning.
See
https://www.freedesktop.org/software/systemd/man/latest/os-release.html +
https://metadata.ftp-master.debian.org/changelogs//main/b/base-files/base-files_14.2_changelog
for further information.
Change-Id: I8fe6ff4ecdaa1b7d1dad5359ab6d93391636cc90
* mysql_tzinfo_to_sql has been moved into mariadb-client-compat package
that contains all the 'mysql centric' tools. there is no need for
the package as we should use the 'mariadb centric' tools instead,
therefore, mariadb-tzinfo-to-sql is used instead which is also
a part of mysql-client package that is available by default.
Change-Id: Ib91567dfafa4acb8e79b877763ccd934a3c4f41e
These methods return the list of pairs and nodes for the specified site,
or the current site if none has been specified.
Change-Id: I574f15ff5e0bc5dcaacb155fe81208850316c0ce
The code is constructing a regex from different parts by appending an
initial pipe and then the string to match, which means we are creating
a regex with an initial empty match. Instead use a join and a map to
create the regex.
Change-Id: Ib3d89f180094cfd625e5ac3448484c554be713ab
This is not a built-in, and the my declarations in its arguments are
generating a Perl warning:
Parentheses missing around "my" list at ../sbin/ngcp-network line 260.
Fixes: commit 5335c8b686
Change-Id: I9b25f13b08280903399acad9d465935e2c0ad45e
This is for backwards compatibility so that we can get the name with the
old and new sites.yml format.
Change-Id: I10082e3c22867e57d413794cc6d75ac6411a686c
This makes it more maintainable, as it means that POD can be syntax
highlighted, and it makes it obvious whether the documentation needs to
be updated or added if missing.
The usual reason for placing POD at __END__ is for performance reasons,
but the very slight parsing cost does not compensate the burden of
having it there.
Change-Id: I5e0d9e59a5331d5c54a9502176f8009da6b70946
We are switching from using the sites hash key as its user facing name,
to instead use it as an identifier, in the same way we use a similar
name for hosts. The user facing name, which could change if the site
gets moved or renamed, is going to be in a new "name" key.
Change-Id: Ia7c79caead98a1d112e307687664caf1033b0de4
change $dbh->begin_work or die "Cannot start tx: "..
to more appropriate
$dbh->begin_work if $dbh->{AutoCommit}
so that the transasction starts only if there is none,
because since some time a shared $dbh object is used.
Change-Id: I2fb6e115c170a5b04a010cb70198182cbbe9712d
This is no longer use, and was planned to be removed after mr10.5, so it
can be safely removed now.
Change-Id: Ia7962846fa39c75b88295065b2b58399613fa5b1
We need to hook the post-build action into the main ngcpcfg script,
otherwise we cannot call it standalone, nor get help about it.
Fixes: commit ad0cf94b46
Change-Id: I9a1173ac88d0f13797b50bad7fdaa3539752a903
A restructure of the returned 'get_redis_info' has been done.
The function is now returning a set of host/port collection
based on the required service: pair, central, ha or norep.
This change takes also into account the migration of the redis
configuration parameters from config.yml to constant.yml.
In particular the ports of the redis/valkey services are now
fully defined under the database.xxxx.redis_... keys.
The commit also consider the case of the multi-site config
where the connections to the ha nodes has to be switched to
the port used by haproxy service.
Change-Id: Ie33f2630fde9926391dd5906c0518b0618887621
These need to be performed after build and before service, so that
any service restart will have the correct grants and schema changes
to be able to operate correctly.
Because we usually perform these operations on the standby node where
the affected services are not running, we do not tend to notice
breaking changes, but this can happen from time to time depending on
the order of operations and the types of database changes. Doing these
operations in the commit action is in any case wrong.
While at it, improve and unify the log messages of what we are doing.
Change-Id: Ic918dc75cdfc4097dc51e2b79f82d1299588f011
We will use this new action to handle database actions that are
currently done in the commit action.
These need to be performed after build and before service, so that
any service restart will have the correct grants and schema changes
to be able to operate correctly.
Change-Id: Ia13c40bcd219902fa523f989d3f1f686fdff93a1
* remove duplicate chained function calls (lb_rtp_interfaces_sync
rtp_interfaces_sync), etc.
* structurise the code by having vars init section first then
function calls and then code execution.
* add main() function as the general entry point and move
all the logic function calls into main() for isolated readability.
* call main() after function definitions and exit with a valid return
code.
* improve main() code readability.
* generic_enum_sync(): improve SQL readability.
* improve SQL error handling.
* all "die" calls are now suffixed with "\n".
Change-Id: I6abce886acedb325892031add1c406be6da5f065
* new function sync_rtp_interface() that, when multi site is enabled,
adds the site name as a prefix for the generated rtp intefaces names
(not their values), enabling the 'rtp_interface' preferences list
to contain rtp_interfaces from all sites.
Change-Id: I8b4e85541747dc46c76135ab05d4424ea79dcf39
* kamailio.lb.extra_socket definitions are now prefixed
with the site name when multi site is enabled
Change-Id: Ia156f2b80c80daee28abafffe2b82522ca499156
* merge duplicate multi site info data preparation into
a dedicated function get_multi_site_data()
* use the function in the related functions instead of the
duplicated code there.
Change-Id: I2eb1a888553ebd00ee69b8ed031078bfde794d3f
* scripts/commit: add $SITES_CONFIG to sync-db command line args
so that the file is loaded (but only if it exists).
* new function get_current_site() that returns a hash containing
current site name,id,role as keys
* "site_name:" preference name prefix is automatically added when
lb_and_extra_sockets_sync() is running with enabled multi site
* preference names with prefixes from non-current sites are ignored
and not removed (so that multiple different sites populate own
preferences, while removing old non multi site ones).
* always show the IP addres in the built 'outbound_socket' preference
name, regardless of the shared ips amount, for consistency and
easier visual recognition when working with the values list
(especially with the multi site enabled).
Change-Id: Ibb1bf13e919f29c9a97f9f0ca3c9b2a6b8121a59
* Central db connection must not be used when syncing db data
in the sync-db helper as it causes possible unexpected data
behaviours when for instance changes in outbound_socket on web01
immediately applied to the central db node when running
ngcpcfg apply on web01.
Therefore, central db connection is switched to the pair
(localhost:3306) one.
Change-Id: Ie6b17d1bf074deca9cf8a7ac626211af6a43d0e1
* 1 is returned in do_sync_db_timezones() when no errors
occured, including version match, to let dependent functions
be called properly in the chain.
* move mysql_tzinfo_to_sql capture after version comparsion
so that the data is not gathered needlessly.
Change-Id: I88ab0ef67ee40da064b9884c65b27d542550dd8f
* disable perlcritic for the comma separated line, mainly for
bookworm as in trixie it's no longer triggered
Change-Id: I3a0af2ad6fedec8bff5d61128a1a4fcf4560ae83
* instead of only central db connection, there are 3
db connections now, pair, central and local. all
fetched from constants.yml database.{central|pair|local}.
* read /etc/default/ngcp-roles to fetch NGCP_TYPE and NGCP_IS_PROXY
* adjust existing functions the following way to work with the db:
- sync_lb_and_extra_sockets
sync_rtp_interfaces
sync_smsc_peers -- all using generic_enum_sync(), use the central
db connection.
- sync_general_timezone
sync_db_timezones
sync_timezone_version -- use pair+local on carrier+proxy, otherwise
pair only. This is to address the issue where on carrier, nodes there
could not sync db timezones locally because they always read the
version info from the central db.
* add log line when syncing db timezones.
Change-Id: I236fb55871ed2a80d8ff62efedc6140218c14c6f
- Add pyproject.toml and tox.ini with consistent black and pycodestyle
settings.
- Run black for consistent coding style.
- Manually fix remaining issues:
+ Split overlong strings.
+ Reflow comments.
+ Use «is» instead of «==» for None.
+ Disable checks for explicit empty blank lines in test data.
Change-Id: I6d10b78061974d8f96bdb07eadee939e0e481aa4
* ngcp.get_redis_ports() requires no arguments and returns
a hash ref, containing Redis/Valkey related info e.g.:
redis = ngcp.get_redis_info
redis.ports.local
Local database port by default or HA port if mutli site
is enabled and the node has 'db' role
redis.ports.central
Central database port by default or HA port if multi site
is enabled
redis.ports.norep
No replication port, used when certain services configured
to write concurrently on the pair of nodes.
Defaults to redis.port + 1
* fix indentation of "Current known meta-variables"
Change-Id: I97bb06d0d8d5c29930d8176ade2c958a9a0b36c0