mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-10-22 08:19:04 +00:00
[Update] 修改Inverntoy,增加更多属性
This commit is contained in:
@@ -96,7 +96,7 @@ class Asset(models.Model):
|
||||
return False, warning
|
||||
|
||||
def is_unixlike(self):
|
||||
if self.platform not in ("Windows", "Other"):
|
||||
if self.platform not in ("Windows",):
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
@@ -132,6 +132,15 @@ class Asset(models.Model):
|
||||
info["gateways"] = [d.id for d in self.domain.gateway_set.all()]
|
||||
return info
|
||||
|
||||
def get_auth_info(self):
|
||||
if self.admin_user:
|
||||
return {
|
||||
'username': self.admin_user.username,
|
||||
'password': self.admin_user.password,
|
||||
'private_key': self.admin_user.private_key_file,
|
||||
'become': self.admin_user.become_info,
|
||||
}
|
||||
|
||||
def _to_secret_json(self):
|
||||
"""
|
||||
Ansible use it create inventory, First using asset user,
|
||||
@@ -175,4 +184,3 @@ class Asset(models.Model):
|
||||
except IntegrityError:
|
||||
print('Error continue')
|
||||
continue
|
||||
|
||||
|
Reference in New Issue
Block a user