pref: 修改 applet host deploy

This commit is contained in:
ibuler
2022-10-28 18:19:44 +08:00
parent 8f9eb64c8d
commit 12b74093e2
12 changed files with 140 additions and 54 deletions

View File

@@ -9,8 +9,9 @@ __all__ = ['JMSInventory']
class JMSInventory:
def __init__(self, manager, assets=None, account_policy='smart',
account_prefer='root,administrator', host_callback=None):
def __init__(self, assets, account_policy='smart',
account_prefer='root,administrator',
host_callback=None):
"""
:param assets:
:param account_prefer: account username name if not set use account_policy
@@ -79,10 +80,7 @@ class JMSInventory:
ssh_protocol_matched = list(filter(lambda x: x.name == 'ssh', protocols))
ssh_protocol = ssh_protocol_matched[0] if ssh_protocol_matched else None
host['ansible_host'] = asset.address
if asset.port == 0:
host['ansible_port'] = ssh_protocol.port if ssh_protocol else 22
else:
host['ansible_port'] = asset.port
host['ansible_port'] = ssh_protocol.port if ssh_protocol else 22
su_from = account.su_from
if platform.su_enabled and su_from:

View File

@@ -99,7 +99,7 @@ class CeleryPeriodTaskViewSet(CommonApiMixin, viewsets.ModelViewSet):
class CeleryTaskViewSet(CommonApiMixin, viewsets.ReadOnlyModelViewSet):
queryset = CeleryTask.objects.filter(name__in=['ops.tasks.hello', 'ops.tasks.hello_error', 'ops.tasks.hello_random'])
queryset = CeleryTask.objects.all()
serializer_class = CeleryTaskSerializer
http_method_names = ('get', 'head', 'options',)