mirror of
https://github.com/ansible/awx.git
synced 2026-02-22 13:36:02 -03:30
stubs and docs for management cmd renames
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
from optparse import make_option
|
from optparse import make_option
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import warnings
|
||||||
|
|
||||||
from django.db import transaction
|
from django.db import transaction
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
@@ -17,15 +18,23 @@ class Command(BaseCommand):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
option_list = BaseCommand.option_list + (
|
option_list = BaseCommand.option_list + (
|
||||||
make_option('--name', dest='name', type='string',
|
make_option('--hostname', dest='hostname', type='string',
|
||||||
help='Hostname used during provisioning'),
|
help='Hostname used during provisioning'),
|
||||||
|
make_option('--name', dest='name', type='string',
|
||||||
|
help='(PENDING DEPRECIATION) Hostname used during provisioning'),
|
||||||
)
|
)
|
||||||
|
|
||||||
@transaction.atomic
|
@transaction.atomic
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
hostname = options.get('name')
|
# TODO: remove in 3.3
|
||||||
|
if options.get('name'):
|
||||||
|
warnings.warn("`--name` is depreciated in favor of `--hostname`, and will be removed in release 3.3.")
|
||||||
|
if options.get('hostname'):
|
||||||
|
raise CommandError("Cannot accept both --name and --hostname.")
|
||||||
|
options['hostname'] = options['name']
|
||||||
|
hostname = options.get('hostname')
|
||||||
if not hostname:
|
if not hostname:
|
||||||
raise CommandError("--name is a required argument")
|
raise CommandError("--hostname is a required argument")
|
||||||
with advisory_lock('instance_registration_%s' % hostname):
|
with advisory_lock('instance_registration_%s' % hostname):
|
||||||
instance = Instance.objects.filter(hostname=hostname)
|
instance = Instance.objects.filter(hostname=hostname)
|
||||||
if instance.exists():
|
if instance.exists():
|
||||||
@@ -33,7 +42,8 @@ class Command(BaseCommand):
|
|||||||
print("Instance Removed")
|
print("Instance Removed")
|
||||||
result = subprocess.Popen("rabbitmqctl forget_cluster_node rabbitmq@{}".format(hostname), shell=True).wait()
|
result = subprocess.Popen("rabbitmqctl forget_cluster_node rabbitmq@{}".format(hostname), shell=True).wait()
|
||||||
if result != 0:
|
if result != 0:
|
||||||
print("Node deprovisioning may have failed when attempting to remove the RabbitMQ instance from the cluster")
|
print("Node deprovisioning may have failed when attempting to "
|
||||||
|
"remove the RabbitMQ instance {} from the cluster".format(hostname))
|
||||||
else:
|
else:
|
||||||
print('Successfully deprovisioned {}'.format(hostname))
|
print('Successfully deprovisioned {}'.format(hostname))
|
||||||
print('(changed: True)')
|
print('(changed: True)')
|
||||||
|
|||||||
17
awx/main/management/commands/deprovision_node.py
Normal file
17
awx/main/management/commands/deprovision_node.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2017 Ansible by Red Hat
|
||||||
|
# All Rights Reserved
|
||||||
|
|
||||||
|
# Borrow from another AWX command
|
||||||
|
from awx.main.management.commands.deprovision_instance import Command as OtherCommand
|
||||||
|
|
||||||
|
# Python
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
|
class Command(OtherCommand):
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
# TODO: delete this entire file in 3.3
|
||||||
|
warnings.warn('This command is replaced with `deprovision_instance` and will '
|
||||||
|
'be removed in release 3.3.')
|
||||||
|
return super(Command, self).handle(*args, **options)
|
||||||
17
awx/main/management/commands/register_instance.py
Normal file
17
awx/main/management/commands/register_instance.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Copyright (c) 2017 Ansible by Red Hat
|
||||||
|
# All Rights Reserved
|
||||||
|
|
||||||
|
# Borrow from another AWX command
|
||||||
|
from awx.main.management.commands.provision_instance import Command as OtherCommand
|
||||||
|
|
||||||
|
# Python
|
||||||
|
import warnings
|
||||||
|
|
||||||
|
|
||||||
|
class Command(OtherCommand):
|
||||||
|
|
||||||
|
def handle(self, *args, **options):
|
||||||
|
# TODO: delete this entire file in 3.3
|
||||||
|
warnings.warn('This command is replaced with `provision_instance` and will '
|
||||||
|
'be removed in release 3.3.')
|
||||||
|
return super(Command, self).handle(*args, **options)
|
||||||
@@ -49,3 +49,7 @@
|
|||||||
[[#5783](https://github.com/ansible/ansible-tower/pull/5783)]
|
[[#5783](https://github.com/ansible/ansible-tower/pull/5783)]
|
||||||
* Remove Rackspace as a supported inventory source type and credential type.
|
* Remove Rackspace as a supported inventory source type and credential type.
|
||||||
[[#6117](https://github.com/ansible/ansible-tower/pull/6117)]
|
[[#6117](https://github.com/ansible/ansible-tower/pull/6117)]
|
||||||
|
* Changed names of tower-mange commands `register_instance` -> `provision_instance`,
|
||||||
|
`deprovision_node` -> `deprovision_instance`, and `instance_group_remove` -> `remove_from_queue`,
|
||||||
|
which backward compatibility support for 3.1 use pattern
|
||||||
|
[[#6915](https://github.com/ansible/ansible-tower/issues/6915)]
|
||||||
|
|||||||
@@ -189,15 +189,15 @@ Recommendations for system configuration with isolated groups:
|
|||||||
variable - the behavior in this case can not be predicted.
|
variable - the behavior in this case can not be predicted.
|
||||||
- Do not put an isolated instance in more than 1 isolated group.
|
- Do not put an isolated instance in more than 1 isolated group.
|
||||||
|
|
||||||
Isolated Node Authentication
|
Isolated Instance Authentication
|
||||||
----------------------------
|
--------------------------------
|
||||||
By default - at installation time - a randomized RSA key is generated and
|
By default - at installation time - a randomized RSA key is generated and
|
||||||
distributed as an authorized key to all "isolated" instances. The private half
|
distributed as an authorized key to all "isolated" instances. The private half
|
||||||
of the key is encrypted and stored within Tower, and is used to authenticate
|
of the key is encrypted and stored within Tower, and is used to authenticate
|
||||||
from "controller" instances to "isolated" instances when jobs are run.
|
from "controller" instances to "isolated" instances when jobs are run.
|
||||||
|
|
||||||
For users who wish to manage SSH authentication from controlling nodes to
|
For users who wish to manage SSH authentication from controlling instances to
|
||||||
isolated nodes via some system _outside_ of Tower (such as externally-managed
|
isolated instances via some system _outside_ of Tower (such as externally-managed
|
||||||
passwordless SSH keys), this behavior can be disabled by unsetting two Tower
|
passwordless SSH keys), this behavior can be disabled by unsetting two Tower
|
||||||
API settings values:
|
API settings values:
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ Tower does not automatically de-provision instances since we can't distinguish b
|
|||||||
Instead the procedure for deprovisioning an instance is to shut it down (or stop the `ansible-tower-service`) and run the Tower deprovision command:
|
Instead the procedure for deprovisioning an instance is to shut it down (or stop the `ansible-tower-service`) and run the Tower deprovision command:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ tower-manage deprovision-node <nodename>
|
$ awx-manage deprovision_instance --hostname=<hostname>
|
||||||
```
|
```
|
||||||
|
|
||||||
* Removing/Deprovisioning Instance Groups
|
* Removing/Deprovisioning Instance Groups
|
||||||
@@ -223,7 +223,7 @@ Tower does not automatically de-provision or remove instance groups, even though
|
|||||||
show up in api endpoints and stats monitoring. These groups can be removed with the following command:
|
show up in api endpoints and stats monitoring. These groups can be removed with the following command:
|
||||||
|
|
||||||
```
|
```
|
||||||
$ tower-manage unregister_queue --queuename=<name>
|
$ awx-manage unregister_queue --queuename=<name>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Status and Monitoring
|
### Status and Monitoring
|
||||||
|
|||||||
Reference in New Issue
Block a user