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
We need the latest ngcp-archive-keyring version, addressing the SHA-1
situation with our repository key. To get that, we refreshed our base
image sipwise-trixie, but need to ensure that we refresh all the docker
images building on top of it.
While at it, update the ENV syntax to avoid the deprecation warning.
Change-Id: I652169eb93041c75628a667523f29b9c1b8a7b6c
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
- Update copyright years.
- Remove «Priority: optional» field, which is now the default.
- Remove boilerplate comment from dh-make from maintainer script.
- Do not use unbalanced quotes in error message in maintainer script.
- Fix vim modelines in bash-completion scripts to set file type to bash.
- Fix comments in debian/rules.
- Unify make lists by terminating them with «#EOL» on its own line.
- Wrap and sort fields.
- Add spaces around operators in make variables.
Change-Id: Ic5c7fba4fd019786d34d308b1aade0c7a92d4b18
When we are in multi-site mode we also need to scan all the site
specific template directories, in addition to the main single-site one,
as the user might have passed any of those paths on the CLI.
Change-Id: If3290f969b6dededafd452f913f071253cbb0fcd
Use the existing OUTPUT_DIRECTORY option to write generated files to a
new temporary directory.
Save the original OUTPUT_DIRECTORY so that differences can be detected.
Use `find` + `diff` to determine changed files instead of `git status`.
Change-Id: Ia1b34001e773812404dd2f2bf94a43fb084d883c
If we're writing to a new output directory, we may end up with some
directories not existing if not all of them contained files to be
generated. Don't bail out with an error in that case.
Change-Id: Id9fd1860da3ec60d799da50b3e0e82ecb8d98359
Don't make changes to the git repo during dry run. This also means we
don't need a commit message.
Change-Id: I62badf5326898a4aae3f657e014cae5c2e50ba58
Don't require presence of etckeeper during tests and instead do a manual
git commit to simulate it.
Change-Id: I20da26d7597779584f181f7375c31f31692b94d0
The process_pool function already extracts the provided tarball to
initialise an empty git repo. Doing it again when creating the
directories is redundant. Use the appropriate /etc path for config file
output.
Change-Id: I3c598a4b1ddf3a65f7f1759c9b29f1f7d1c098bf
Use a separate temp dir for the state files. Otherwise updates to the
state files pollute the git status of the mock /etc.
Change-Id: I6a784259db63b12c7ffe5666660966ad6c9d60f4
This variable is assumed to be set and exported by ngcpcfg when it
starts running. But we have code (in the ngcp-upgrade steps), which
calls the restore-permissions helper directly w/o going through ngcpcfg,
and which then breaks when the variable is not yet set.
Add a fallback value so that we do not fail anymore. But we should
eventually expose this functionality as an actual command as part of
the public ngcpcfg CLI.
Change-Id: Ibda18faaff8a26a04240e6ed7a46ee7650b82954
- Update copyright years.
- Update Standards-Version to 4.7.2
- Remove Rules-Requires-Root now defaulting to «no».
- Remove ancient conffile removal handling.
- Remove dependencies for versions earlier than the previous LTS.
- Sort fields by strength and use: Depends, Conflicts, Replaces, Provides.
- Switch to dh-sequence-bash-completion instead of Build-depends and
dh --with.
- Minor coding style fixes.
Change-Id: I2cf62db7ebdd03075ca44e4e4ffdf0ccd463c00b