Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

By default, do not count indirect hosts #15801

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion awx/main/migrations/0201_indirect_managed_node_audit.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='job',
name='event_queries_processed',
field=models.BooleanField(default=False, help_text='Events of this job have been queried for indirect host information'),
field=models.BooleanField(default=True, help_text='Events of this job have been queried for indirect host information, or do not need processing.'),
),
migrations.CreateModel(
name='EventQuery',
4 changes: 2 additions & 2 deletions awx/main/models/jobs.py
Original file line number Diff line number Diff line change
@@ -608,8 +608,8 @@ class Meta:
help_text=_("If ran as part of sliced jobs, the total number of slices. If 1, job is not part of a sliced job."),
)
event_queries_processed = models.BooleanField(
default=False,
help_text=_("Events of this job have been queried for indirect host information"),
default=True,
help_text=_("Events of this job have been queried for indirect host information, or do not need processing."),
)

def _get_parent_field_name(self):
1 change: 1 addition & 0 deletions awx/main/tasks/callback.py
Original file line number Diff line number Diff line change
@@ -277,6 +277,7 @@ def status_handler(self, status_data, runner_config):
def artifacts_handler(self, artifact_dir):
success, query_file_contents = try_load_query_file(artifact_dir)
if success:
self.delay_update(event_queries_processed=False)
collections_info = collect_queries(query_file_contents)
for collection, data in collections_info.items():
version = data['version']
10 changes: 4 additions & 6 deletions awx/main/tests/functional/tasks/test_host_indirect.py
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
)
from awx.main.models.event_query import EventQuery
from awx.main.models.indirect_managed_node_audit import IndirectManagedNodeAudit
from awx.main.tests.functional.conftest import organization

"""These are unit tests, similar to test_indirect_host_counting in the live tests"""

@@ -25,7 +24,8 @@
def bare_job(job_factory):
job = job_factory()
job.installed_collections = {'demo.query': {'version': '1.0.1'}, 'demo2.query': {'version': '1.0.1'}}
job.save(update_fields=['installed_collections'])
job.event_queries_processed = False
job.save(update_fields=['installed_collections', 'event_queries_processed'])
return job


@@ -72,11 +72,9 @@ def new_audit_record(bare_job, organization):


@pytest.mark.django_db
def test_build_with_no_results(job_factory):
def test_build_with_no_results(bare_job):
# never filled in events, should do nothing
job = job_factory()
assert job.event_queries_processed is False
assert build_indirect_host_data(job, {}) == []
assert build_indirect_host_data(bare_job, {}) == []


@pytest.mark.django_db