mirror of
https://github.com/ansible/awx.git
synced 2026-04-13 22:19:27 -02:30
Use CLUSTER_HOST_ID as default hostname argument value
Incorporates feedback from https://github.com/ansible/awx/pull/13445/files#r1106012308 Signed-off-by: Stanislav Zaprudskiy <s.zaprudskiy@sap.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import socket
|
|
||||||
import time
|
import time
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
|
|
||||||
@@ -18,7 +17,7 @@ class AWXInstance:
|
|||||||
self.get_instance()
|
self.get_instance()
|
||||||
|
|
||||||
def get_instance(self):
|
def get_instance(self):
|
||||||
filter = self.filter if self.filter is not None else dict(hostname=socket.gethostname())
|
filter = self.filter if self.filter is not None else dict(hostname=settings.CLUSTER_HOST_ID)
|
||||||
qs = Instance.objects.filter(**filter)
|
qs = Instance.objects.filter(**filter)
|
||||||
if not qs.exists():
|
if not qs.exists():
|
||||||
raise ValueError(f"No AWX instance found with {filter} parameters")
|
raise ValueError(f"No AWX instance found with {filter} parameters")
|
||||||
@@ -88,7 +87,7 @@ class Command(BaseCommand):
|
|||||||
filter_group.add_argument(
|
filter_group.add_argument(
|
||||||
"--hostname",
|
"--hostname",
|
||||||
type=str,
|
type=str,
|
||||||
default=socket.gethostname(),
|
default=settings.CLUSTER_HOST_ID,
|
||||||
help=f"{Instance.hostname.field.help_text} Defaults to the hostname of the machine where the Python interpreter is currently executing".strip(),
|
help=f"{Instance.hostname.field.help_text} Defaults to the hostname of the machine where the Python interpreter is currently executing".strip(),
|
||||||
)
|
)
|
||||||
filter_group.add_argument("--id", type=self.ge_1, help=Instance.id.field.help_text)
|
filter_group.add_argument("--id", type=self.ge_1, help=Instance.id.field.help_text)
|
||||||
|
|||||||
Reference in New Issue
Block a user