Skip to content

refactor: give the settings #984 could not reach the Ascender name - #998

Merged
cigamit merged 4 commits into
ctrliq:mainfrom
blaipr:refactor/ascender-file-settings
Sep 15, 2026
Merged

cigamit merged 4 commits into
ctrliq:mainfrom
blaipr:refactor/ascender-file-settings

Conversation

@blaipr

@blaipr blaipr commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

#984 renamed the eleven settings the database registers. Seventeen more were left, because they are not registered: thirteen are defined in defaults.py and overridden in a settings file, and four are read from the environment.

The thirteen

ASCENDER_AUTO_DEPROVISION_INSTANCES, ASCENDER_CALLBACK_PROFILE, the five ASCENDER_CONTAINER_GROUP_*, ASCENDER_CONTROL_NODE_TASK_IMPACT, ASCENDER_NOTIFICATION_REQUEST_TIMEOUT, ASCENDER_REBUILD_SMART_MEMBERSHIP, ASCENDER_REQUEST_PROFILE_WITH_DOT, ASCENDER_RUNNER_OMIT_ENV_FILES, ASCENDER_RUNNER_SUPPRESS_OUTPUT_FILE.

Same route as #984: renamed at the definition and every use, with the old name added to the _FORMER_NAMES table, so a conf.d file that writes AWX_NOTIFICATION_REQUEST_TIMEOUT still lands on the current name.

The four from the environment, which could not take that route

AWX_SETTINGS_FILE, AWX_SETTINGS_DIR, AWX_LOGGING_MODE, AWX_WEB_PROCESS.

The alias table runs after the settings modules have loaded, and two of these decide which settings file loads at all. An alias applied afterwards would be too late to matter. They read both names directly instead, through one helper, in the same shape as the ASCENDER_ variables ascender-kit took in its #72.

Nothing has to move

  • AWX_SETTINGS_FILE is what the Dockerfile passes to collectstatic.
  • AWX_LOGGING_MODE is what the three installers write into their compose environments.
  • AWX_WEB_PROCESS is what supervisor sets.

Those keep working for as long as they exist, not for a release.

Checking

Both directions against a real production settings load:

  • the old environment name still selects the settings file, and
  • a settings file written with the old setting name still carries over (AWX_NOTIFICATION_REQUEST_TIMEOUT = 99 arrives as settings.ASCENDER_NOTIFICATION_REQUEST_TIMEOUT == 99).

A test asserts that no settings module reads one of the four with a bare os.environ.get, since that would answer to one name only, which is the failure the helper exists to prevent.

1,573 unit and conf tests pass. typed.py regenerated. ruff check and ruff format --check clean.

Touches defaults.py and production.py, so it conflicts with #997; whichever lands second is a rebase onto the moved paths.

ctrliq#984 renamed the eleven settings the database registers. Seventeen more were
left, because they are not registered: thirteen are defined in defaults.py and
overridden in a settings file, and four are read from the environment.

The thirteen take the same route as ctrliq#984: renamed at the definition and every
use, with the old name added to the _FORMER_NAMES table so a conf.d file that
writes AWX_NOTIFICATION_REQUEST_TIMEOUT still lands on the current name.

The four from the environment could not, and this is the part worth reading.
That table runs after the settings modules have loaded, and AWX_SETTINGS_FILE
and AWX_SETTINGS_DIR decide which settings file loads at all, so an alias
applied afterwards would be too late to matter. They read both names directly
instead, through one helper, in the same shape as the ASCENDER_ variables
ascender-kit took in its ctrliq#72.

Nothing has to move to the new names. AWX_SETTINGS_FILE is what the Dockerfile
passes to collectstatic, AWX_LOGGING_MODE is what the three installers write
into their compose environments, and AWX_WEB_PROCESS is what supervisor sets.
Those keep working for as long as they exist rather than for a release.

A test asserts that no settings module reads one of the four with a bare
os.environ.get, since that would answer to one name only, which is the failure
the helper exists to prevent. Both directions are checked against a real
production settings load: the old environment name still selects the settings
file, and a file written with the old setting name still carries over.
blaipr added a commit to blaipr/ascender that referenced this pull request Sep 14, 2026
/etc/tower holds the settings files and /var/log/tower the logs, and they are
/etc/ascender and /var/log/ascender now, with the Tower names as aliases onto
them. Same shape as the data directory, the development tree and the receptor
socket: the real directory takes the Ascender name so retiring the old one is a
deleted symlink.

The aliases are needed rather than tidy. ascender-install names /etc/tower
thirty seven times and the operator thirty eight, mounting individual files at
/etc/tower/SECRET_KEY, /etc/tower/settings.py and /etc/tower/conf.d/*.py. A file
mounted through a symlinked parent is a different case from the directory mounts
the other aliases rely on, so it was checked rather than assumed: both a
SECRET_KEY and a conf.d file mounted at the old paths land in /etc/ascender and
the symlink survives the mount.

production.py keeps naming /etc/tower in its two defaults. Those lines are
rewritten by ctrliq#998 and resolve through the alias in the meantime, so they move
when that lands rather than conflicting with it now.

One thing worth naming, because I did it: the sweep that moved the tooling paths
also rewrote the two ln -s lines that create the aliases, leaving symlinks
pointing at themselves. Every symlink the image creates is now checked for that.
@cigamit cigamit self-assigned this Sep 15, 2026
@cigamit cigamit added Needs triage When a Issue needs to be researched or a PR has an issue that needs fixing before merging Refactor labels Sep 15, 2026
# Conflicts:
#	ascender/main/notifications/pagerduty_backend.py
#	ascender/main/notifications/twilio_backend.py
#	ascender/main/tests/unit/settings/test_environment_names.py
#	ascender/main/tests/unit/settings/test_logging_mode.py
#	ascender/settings/environment.py
ctrliq#997 landed while this branch was open, so the module this adds now lives at
ascender/settings/environment.py and the five imports of it named the old
package.

They resolved, because the awx shim aliases the whole package, but a settings
module that cannot load without the compatibility layer is the wrong dependency
to take on: production.py and defaults.py are imported to decide which settings
file loads at all, and this is the branch that gives those settings the Ascender
name in the first place.
@blaipr

blaipr commented Sep 15, 2026

Copy link
Copy Markdown
Contributor Author

Rebuilt on the post-#997 main: mergeable now, full suite green at 4238 passed, 6 skipped.

@cigamit cigamit removed the Needs triage When a Issue needs to be researched or a PR has an issue that needs fixing before merging label Sep 15, 2026
@cigamit
cigamit merged commit a63d9d9 into ctrliq:main Sep 15, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants