mirror of https://github.com/jumpserver/jumpserver
merge: with dev
commit
e5081fd6a9
|
@ -87,8 +87,9 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
|||
|
||||
accounts = accounts.filter(secret_type=self.secret_type)
|
||||
if not accounts:
|
||||
msg = '没有发现待改密账号: %s 用户名: %s 类型: %s' % (asset.name, account.username, self.secret_type)
|
||||
print(msg)
|
||||
print('没有发现待改密账号: %s 用户名: %s 类型: %s' % (
|
||||
asset.name, self.snapshot_account_usernames, self.secret_type
|
||||
))
|
||||
return []
|
||||
|
||||
method_attr = getattr(automation, self.method_type() + '_method')
|
||||
|
@ -99,8 +100,7 @@ class ChangeSecretManager(AccountBasePlaybookManager):
|
|||
host['secret_type'] = self.secret_type
|
||||
|
||||
if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY:
|
||||
msg = f'Windows {asset} does not support ssh key push \n'
|
||||
print(msg)
|
||||
print(f'Windows {asset} does not support ssh key push \n')
|
||||
return inventory_hosts
|
||||
|
||||
for account in accounts:
|
||||
|
|
|
@ -59,7 +59,6 @@ class PushAccountManager(ChangeSecretManager, AccountBasePlaybookManager):
|
|||
|
||||
accounts = asset.accounts.all()
|
||||
accounts = self.get_accounts(account, accounts)
|
||||
|
||||
inventory_hosts = []
|
||||
host['secret_type'] = self.secret_type
|
||||
if asset.type == HostTypes.WINDOWS and self.secret_type == SecretType.SSH_KEY:
|
||||
|
|
|
@ -101,9 +101,10 @@ class AccountSerializer(AccountSerializerCreateMixin, BaseAccountSerializer):
|
|||
|
||||
class Meta(BaseAccountSerializer.Meta):
|
||||
model = Account
|
||||
fields = BaseAccountSerializer.Meta.fields \
|
||||
+ ['su_from', 'asset'] \
|
||||
+ ['template', 'push_now', 'source']
|
||||
fields = BaseAccountSerializer.Meta.fields + [
|
||||
'su_from', 'asset', 'template',
|
||||
'push_now', 'source', 'connectivity'
|
||||
]
|
||||
extra_kwargs = {
|
||||
**BaseAccountSerializer.Meta.extra_kwargs,
|
||||
'name': {'required': False, 'allow_null': True},
|
||||
|
|
|
@ -329,9 +329,8 @@ class AllTypes(ChoicesMixin):
|
|||
internal_platforms.append(d['name'])
|
||||
|
||||
user_platforms = platform_cls.objects.exclude(name__in=internal_platforms)
|
||||
user_platforms.update(internal=False)
|
||||
|
||||
for platform in user_platforms:
|
||||
print("\t- Update platform: {}".format(platform.name))
|
||||
platform_data = cls.get_type_default_platform(platform.category, platform.type)
|
||||
cls.create_or_update_by_platform_data(platform.name, platform_data, platform_cls=platform_cls)
|
||||
user_platforms.update(internal=False)
|
||||
|
|
|
@ -60,6 +60,7 @@ exclude_permissions = (
|
|||
('accounts', 'automationexecution', '*', 'automationexecution'),
|
||||
('accounts', 'accountbackupexecution', 'delete,change', 'accountbackupexecution'),
|
||||
('accounts', 'changesecretrecord', 'add,delete,change', 'changesecretrecord'),
|
||||
('accounts', 'account', 'change', 'accountsecret'),
|
||||
|
||||
('perms', 'userassetgrantedtreenoderelation', '*', '*'),
|
||||
('perms', 'permedaccount', '*', '*'),
|
||||
|
|
|
@ -58,7 +58,7 @@ class AppletHostDeploymentViewSet(viewsets.ModelViewSet):
|
|||
def applets(self, request, *args, **kwargs):
|
||||
serializer = self.get_serializer(data=request.data)
|
||||
serializer.is_valid(raise_exception=True)
|
||||
applet_id = serializer.validated_data.pop('applet_id')
|
||||
applet_id = serializer.validated_data.pop('applet_id', '')
|
||||
instance = serializer.save()
|
||||
task = run_applet_host_deployment_install_applet.delay(instance.id, applet_id)
|
||||
instance.save_task(task.id)
|
||||
|
|
Loading…
Reference in New Issue