mirror of
https://github.com/ansible/awx.git
synced 2026-03-11 22:49:32 -02:30
Revert EE selectable work in favor of rewriting later
This commit is contained in:
@@ -27,9 +27,9 @@ from awx.main.utils.mem_inventory import MemInventory, dict_to_mem_data
|
||||
from awx.main.utils.safe_yaml import sanitize_jinja
|
||||
|
||||
# other AWX imports
|
||||
from awx.main.models.execution_environments import ExecutionEnvironment
|
||||
from awx.main.models.rbac import batch_role_ancestor_rebuilding
|
||||
from awx.main.utils import ignore_inventory_computed_fields, get_licenser
|
||||
from awx.main.utils.execution_environments import get_default_execution_environment
|
||||
from awx.main.signals import disable_activity_stream
|
||||
from awx.main.constants import STANDARD_INVENTORY_UPDATE_ENV
|
||||
from awx.main.utils.pglock import advisory_lock
|
||||
@@ -67,17 +67,16 @@ class AnsibleInventoryLoader(object):
|
||||
/usr/bin/ansible/ansible-inventory -i hosts --list
|
||||
"""
|
||||
|
||||
def __init__(self, source, execution_environment, verbosity=0):
|
||||
def __init__(self, source, verbosity=0):
|
||||
self.source = source
|
||||
self.verbosity = verbosity
|
||||
self.execution_environment = execution_environment
|
||||
|
||||
def get_base_args(self):
|
||||
bargs = ['podman', 'run', '--user=root', '--quiet']
|
||||
bargs.extend(['-v', '{0}:{0}:Z'.format(self.source)])
|
||||
for key, value in STANDARD_INVENTORY_UPDATE_ENV.items():
|
||||
bargs.extend(['-e', '{0}={1}'.format(key, value)])
|
||||
ee = self.execution_environment
|
||||
ee = get_default_execution_environment()
|
||||
|
||||
if settings.IS_K8S:
|
||||
logger.warning('This command is not able to run on kubernetes-based deployment. This action should be done using the API.')
|
||||
@@ -164,13 +163,6 @@ class Command(BaseCommand):
|
||||
metavar='v',
|
||||
help='value of host variable specified by --enabled-var that indicates host is enabled/online.',
|
||||
)
|
||||
parser.add_argument(
|
||||
'--execution-environment',
|
||||
dest='execution_environment',
|
||||
type=str,
|
||||
default='Default execution environment',
|
||||
help='name of the execution environment to use'
|
||||
)
|
||||
parser.add_argument(
|
||||
'--group-filter',
|
||||
dest='group_filter',
|
||||
@@ -859,7 +851,7 @@ class Command(BaseCommand):
|
||||
logger.info('Updating inventory %d: %s' % (inventory.pk, inventory.name))
|
||||
|
||||
# Create ad-hoc inventory source and inventory update objects
|
||||
ee = ExecutionEnvironment.objects.get(name=options.get('execution_environment'))
|
||||
ee = get_default_execution_environment()
|
||||
with ignore_inventory_computed_fields():
|
||||
source = Command.get_source_absolute_path(raw_source)
|
||||
|
||||
@@ -872,11 +864,13 @@ class Command(BaseCommand):
|
||||
execution_environment=ee,
|
||||
)
|
||||
inventory_update = inventory_source.create_inventory_update(
|
||||
_eager_fields=dict(status='running', job_args=json.dumps(sys.argv), job_env=dict(os.environ.items()), job_cwd=os.getcwd(), execution_environment=ee)
|
||||
_eager_fields=dict(
|
||||
status='running', job_args=json.dumps(sys.argv), job_env=dict(os.environ.items()), job_cwd=os.getcwd(), execution_environment=ee
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
try:
|
||||
data = AnsibleInventoryLoader(source=source,execution_environment=ee, verbosity=verbosity).load()
|
||||
data = AnsibleInventoryLoader(source=source, verbosity=verbosity).load()
|
||||
logger.debug('Finished loading from source: %s', source)
|
||||
|
||||
except SystemExit:
|
||||
|
||||
Reference in New Issue
Block a user