mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
Merge pull request #2156 from ryanpetrello/fix-iso-dev
fix a few isolated dev issues
This commit is contained in:
4
Makefile
4
Makefile
@@ -219,7 +219,7 @@ init:
|
|||||||
if [ "$(AWX_GROUP_QUEUES)" == "tower,thepentagon" ]; then \
|
if [ "$(AWX_GROUP_QUEUES)" == "tower,thepentagon" ]; then \
|
||||||
$(MANAGEMENT_COMMAND) provision_instance --hostname=isolated; \
|
$(MANAGEMENT_COMMAND) provision_instance --hostname=isolated; \
|
||||||
$(MANAGEMENT_COMMAND) register_queue --queuename='thepentagon' --hostnames=isolated --controller=tower; \
|
$(MANAGEMENT_COMMAND) register_queue --queuename='thepentagon' --hostnames=isolated --controller=tower; \
|
||||||
$(MANAGEMENT_COMMAND) generate_isolated_key | ssh -o "StrictHostKeyChecking no" root@isolated 'cat > /root/.ssh/authorized_keys'; \
|
$(MANAGEMENT_COMMAND) generate_isolated_key | ssh -o "StrictHostKeyChecking no" root@isolated 'cat >> /root/.ssh/authorized_keys'; \
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Refresh development environment after pulling new code.
|
# Refresh development environment after pulling new code.
|
||||||
@@ -560,7 +560,7 @@ docker-isolated:
|
|||||||
TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose -f tools/docker-compose.yml -f tools/docker-isolated-override.yml create
|
TAG=$(COMPOSE_TAG) DEV_DOCKER_TAG_BASE=$(DEV_DOCKER_TAG_BASE) docker-compose -f tools/docker-compose.yml -f tools/docker-isolated-override.yml create
|
||||||
docker start tools_awx_1
|
docker start tools_awx_1
|
||||||
docker start tools_isolated_1
|
docker start tools_isolated_1
|
||||||
echo "__version__ = '`python setup.py --version`'" | docker exec -i tools_isolated_1 /bin/bash -c "cat > /venv/awx/lib/python2.7/site-packages/awx.py"
|
echo "__version__ = '`git describe --long | cut -d - -f 1-1`'" | docker exec -i tools_isolated_1 /bin/bash -c "cat > /venv/awx/lib/python2.7/site-packages/awx.py"
|
||||||
if [ "`docker exec -i -t tools_isolated_1 cat /root/.ssh/authorized_keys`" == "`docker exec -t tools_awx_1 cat /root/.ssh/id_rsa.pub`" ]; then \
|
if [ "`docker exec -i -t tools_isolated_1 cat /root/.ssh/authorized_keys`" == "`docker exec -t tools_awx_1 cat /root/.ssh/id_rsa.pub`" ]; then \
|
||||||
echo "SSH keys already copied to isolated instance"; \
|
echo "SSH keys already copied to isolated instance"; \
|
||||||
else \
|
else \
|
||||||
|
|||||||
@@ -434,6 +434,7 @@ class IsolatedManager(object):
|
|||||||
task_result = {}
|
task_result = {}
|
||||||
if 'capacity_cpu' in task_result and 'capacity_mem' in task_result:
|
if 'capacity_cpu' in task_result and 'capacity_mem' in task_result:
|
||||||
cls.update_capacity(instance, task_result, awx_application_version)
|
cls.update_capacity(instance, task_result, awx_application_version)
|
||||||
|
logger.debug('Isolated instance {} successful heartbeat'.format(instance.hostname))
|
||||||
elif instance.capacity == 0:
|
elif instance.capacity == 0:
|
||||||
logger.debug('Isolated instance {} previously marked as lost, could not re-join.'.format(
|
logger.debug('Isolated instance {} previously marked as lost, could not re-join.'.format(
|
||||||
instance.hostname))
|
instance.hostname))
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ import shutil
|
|||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
from optparse import make_option
|
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
@@ -15,10 +14,9 @@ class Command(BaseCommand):
|
|||||||
"""Tests SSH connectivity between a controller and target isolated node"""
|
"""Tests SSH connectivity between a controller and target isolated node"""
|
||||||
help = 'Tests SSH connectivity between a controller and target isolated node'
|
help = 'Tests SSH connectivity between a controller and target isolated node'
|
||||||
|
|
||||||
option_list = BaseCommand.option_list + (
|
def add_arguments(self, parser):
|
||||||
make_option('--hostname', dest='hostname', type='string',
|
parser.add_argument('--hostname', dest='hostname', type=str,
|
||||||
help='Hostname of an isolated node'),
|
help='Hostname of an isolated node')
|
||||||
)
|
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
hostname = options.get('hostname')
|
hostname = options.get('hostname')
|
||||||
@@ -30,7 +28,7 @@ class Command(BaseCommand):
|
|||||||
args = [
|
args = [
|
||||||
'ansible', 'all', '-i', '{},'.format(hostname), '-u',
|
'ansible', 'all', '-i', '{},'.format(hostname), '-u',
|
||||||
settings.AWX_ISOLATED_USERNAME, '-T5', '-m', 'shell',
|
settings.AWX_ISOLATED_USERNAME, '-T5', '-m', 'shell',
|
||||||
'-a', 'hostname', '-vvv'
|
'-a', 'awx-expect -h', '-vvv'
|
||||||
]
|
]
|
||||||
if all([
|
if all([
|
||||||
getattr(settings, 'AWX_ISOLATED_KEY_GENERATION', False) is True,
|
getattr(settings, 'AWX_ISOLATED_KEY_GENERATION', False) is True,
|
||||||
|
|||||||
@@ -484,7 +484,7 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='instance',
|
model_name='instance',
|
||||||
name='last_isolated_check',
|
name='last_isolated_check',
|
||||||
field=models.DateTimeField(auto_now_add=True, null=True),
|
field=models.DateTimeField(editable=False, null=True),
|
||||||
),
|
),
|
||||||
# Migrations that don't change db schema but simply to make Django ORM happy.
|
# Migrations that don't change db schema but simply to make Django ORM happy.
|
||||||
# e.g. Choice updates, help_text updates, etc.
|
# e.g. Choice updates, help_text updates, etc.
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ class Instance(BaseModel):
|
|||||||
last_isolated_check = models.DateTimeField(
|
last_isolated_check = models.DateTimeField(
|
||||||
null=True,
|
null=True,
|
||||||
editable=False,
|
editable=False,
|
||||||
auto_now_add=True
|
|
||||||
)
|
)
|
||||||
version = models.CharField(max_length=24, blank=True)
|
version = models.CharField(max_length=24, blank=True)
|
||||||
capacity = models.PositiveIntegerField(
|
capacity = models.PositiveIntegerField(
|
||||||
|
|||||||
@@ -226,6 +226,7 @@ def handle_ha_toplogy_worker_ready(sender, **kwargs):
|
|||||||
# Expedite the first hearbeat run so a node comes online quickly.
|
# Expedite the first hearbeat run so a node comes online quickly.
|
||||||
cluster_node_heartbeat.apply([])
|
cluster_node_heartbeat.apply([])
|
||||||
apply_cluster_membership_policies.apply([])
|
apply_cluster_membership_policies.apply([])
|
||||||
|
awx_isolated_heartbeat.apply([])
|
||||||
|
|
||||||
|
|
||||||
@celeryd_after_setup.connect
|
@celeryd_after_setup.connect
|
||||||
@@ -380,7 +381,11 @@ def awx_isolated_heartbeat(self):
|
|||||||
accept_before = nowtime - timedelta(seconds=(poll_interval - 10))
|
accept_before = nowtime - timedelta(seconds=(poll_interval - 10))
|
||||||
isolated_instance_qs = Instance.objects.filter(
|
isolated_instance_qs = Instance.objects.filter(
|
||||||
rampart_groups__controller__instances__hostname=local_hostname,
|
rampart_groups__controller__instances__hostname=local_hostname,
|
||||||
|
)
|
||||||
|
isolated_instance_qs = isolated_instance_qs.filter(
|
||||||
last_isolated_check__lt=accept_before
|
last_isolated_check__lt=accept_before
|
||||||
|
) | isolated_instance_qs.filter(
|
||||||
|
last_isolated_check=None
|
||||||
)
|
)
|
||||||
# Fast pass of isolated instances, claiming the nodes to update
|
# Fast pass of isolated instances, claiming the nodes to update
|
||||||
with transaction.atomic():
|
with transaction.atomic():
|
||||||
@@ -883,6 +888,7 @@ class BaseTask(Task):
|
|||||||
stdout_handle = None
|
stdout_handle = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
kwargs['isolated'] = instance.is_isolated()
|
||||||
self.pre_run_hook(instance, **kwargs)
|
self.pre_run_hook(instance, **kwargs)
|
||||||
if instance.cancel_flag:
|
if instance.cancel_flag:
|
||||||
instance = self.update_model(instance.pk, status='canceled')
|
instance = self.update_model(instance.pk, status='canceled')
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
file: path="{{item}}" state=absent
|
file: path="{{item}}" state=absent
|
||||||
register: result
|
register: result
|
||||||
with_items: "{{cleanup_dirs}}"
|
with_items: "{{cleanup_dirs}}"
|
||||||
until: result|succeeded
|
until: result is succeeded
|
||||||
ignore_errors: yes
|
ignore_errors: yes
|
||||||
retries: 3
|
retries: 3
|
||||||
delay: 5
|
delay: 5
|
||||||
@@ -26,4 +26,4 @@
|
|||||||
- name: fail if build artifacts were not cleaned
|
- name: fail if build artifacts were not cleaned
|
||||||
fail:
|
fail:
|
||||||
msg: 'Unable to cleanup build artifacts'
|
msg: 'Unable to cleanup build artifacts'
|
||||||
when: not result|succeeded
|
when: not result is succeeded
|
||||||
|
|||||||
@@ -14,6 +14,4 @@ services:
|
|||||||
- "../awx/main/expect:/awx_devel"
|
- "../awx/main/expect:/awx_devel"
|
||||||
- "../awx/lib:/awx_lib"
|
- "../awx/lib:/awx_lib"
|
||||||
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||||
tmpfs:
|
privileged: true
|
||||||
- "/tmp:exec"
|
|
||||||
- "/run"
|
|
||||||
|
|||||||
@@ -27,7 +27,4 @@ RUN ssh-keygen -A
|
|||||||
RUN mkdir -p /root/.ssh
|
RUN mkdir -p /root/.ssh
|
||||||
RUN touch /root/.ssh/authorized_keys
|
RUN touch /root/.ssh/authorized_keys
|
||||||
|
|
||||||
STOPSIGNAL SIGRTMIN+3
|
|
||||||
|
|
||||||
|
|
||||||
CMD ["/usr/sbin/init"]
|
CMD ["/usr/sbin/init"]
|
||||||
|
|||||||
Reference in New Issue
Block a user