Skip related endpoints without NATURAL_KEY during awxkit export#573
Merged
cigamit merged 1 commit intoJul 10, 2026
Merged
Conversation
fe76fc0 to
54b6372
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes awxkit’s asset export flow so that related endpoints which don’t define a NATURAL_KEY (e.g., write-only related endpoints like webhook_key) are skipped instead of causing the entire resource export to fail and drop assets.
Changes:
- Skip related endpoints that lack
NATURAL_KEYduring_export(), logging a warning instead of erroring out. - Add
webhook_keyentries toDEPENDENT_NONEXPORTfor Project, JobTemplate, and WorkflowJobTemplate.
blaipr
added a commit
to blaipr/ascender-collection
that referenced
this pull request
Jul 9, 2026
…filter - Move the new API fields (webhook_key, webhook_ref_filter, webhook_service, max_retries) from no_api_parameter_ok to needs_param_development. no_api_parameter_ok only applies when the module has a parameter the API lacks; these are the opposite case (new API fields the modules do not support yet), which is exactly what needs_param_development is for. Also add job_slice_pinned_hosts, which was still failing. - Drop the IgnoreNaturalKeyFilter from export.py. Filtering the log message cannot fix the export (awxkit still drops the assets), and it would hide the genuine natural-key errors that mean the export is incomplete. The real fix is in awxkit (ctrliq/ascender#573).
…ad of failing When exporting resources (e.g. job_templates), the awxkit export code iterates over POST fields from the OPTIONS response. For write_only fields like webhook_key, the key appears in both post_fields and _page.related (added by the serializer's get_related), but the resolved endpoint (e.g. /api/v2/job_templates/N/webhook_key/) is served by a view whose page class (Base) has no NATURAL_KEY defined. Previously this caused the export to log an ERROR, set _has_error=True, and return None for every affected resource, producing empty asset lists. Fix: 1. Phase A (direct fields): When the resolved related endpoint has no NATURAL_KEY attribute, log a warning and skip the field instead of erroring out. 2. Documentation: Add webhook_key to DEPENDENT_NONEXPORT for Project, JobTemplate, and WorkflowJobTemplate.
54b6372 to
e299adf
Compare
Contributor
Author
|
I updated the PR:
Verification: I ran the ascender-collection unit test suite against this branch (ascender_devel image, |
cigamit
approved these changes
Jul 10, 2026
cigamit
pushed a commit
to ctrliq/ascender-collection
that referenced
this pull request
Jul 10, 2026
* Fix unit test failures in CI * Fix pep8 E303: too many blank lines after removing test_no_templated_values * Rework unit test fixes: use needs_param_development, drop export log filter - Move the new API fields (webhook_key, webhook_ref_filter, webhook_service, max_retries) from no_api_parameter_ok to needs_param_development. no_api_parameter_ok only applies when the module has a parameter the API lacks; these are the opposite case (new API fields the modules do not support yet), which is exactly what needs_param_development is for. Also add job_slice_pinned_hosts, which was still failing. - Drop the IgnoreNaturalKeyFilter from export.py. Filtering the log message cannot fix the export (awxkit still drops the assets), and it would hide the genuine natural-key errors that mean the export is incomplete. The real fix is in awxkit (ctrliq/ascender#573). * Replace removed version-invariant unit test and refresh tools/README test_no_templated_values used to catch a mismatch between the hardcoded _COLLECTION_VERSION and galaxy.yml; it was dropped along with the other unit test fixes. Add test_collection_version_matches_galaxy_yml to keep that guarantee: it loads controller_api.py through the collection_import fixture and compares _COLLECTION_VERSION against galaxy.yml's version. Also update tools/README.md: the source no longer carries a 0.0.1-devel placeholder, it ships the real released version, so template_galaxy.yml is now only needed for non-default namespace builds or to stamp a different version at build time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When exporting resources (e.g. job_templates), the awxkit export code iterates over POST fields from the OPTIONS response. For write_only fields like
webhook_key(added to projects in #563, and already present on job templates and workflow job templates), the key appears in bothpost_fieldsand_page.related, but the resolved endpoint (e.g./api/v2/job_templates/N/webhook_key/) is served by a view whose page class (Base) has noNATURAL_KEYdefined. This caused the awxkit export to log an ERROR, set_has_error=True, and returnNonefor every affected resource, producing empty asset lists (for example zero job templates in an awxkit collection export).Fix
When the resolved related endpoint has no
NATURAL_KEYattribute, log a warning and skip the field instead of erroring out and dropping the whole resource. A missingNATURAL_KEYmeans the page class does not participate in natural key resolution at all, which is a different situation from a failed natural key construction, and it should not be fatal.This fixes the
test_export_simplefailure in ctrliq/ascender-collection#165, where every JobTemplate was silently dropped from the awxkit export output.Verification
I ran the ascender-collection unit test suite against this branch (ascender_devel image,
pytest tests/unit/): 149 passed, includingtest_export_simple.