Commit f992347f authored by ibuler's avatar ibuler

[Update] 修改become信息

parent e2044498
......@@ -152,11 +152,7 @@ class Asset(models.Model):
'username': admin_user.username,
'password': admin_user.password,
'private_key': admin_user.private_key_file,
'become': {
'method': admin_user.become_method,
'user': admin_user.become_user,
'pass': admin_user.become_pass,
}
'become': admin_user.become_info,
})
return data
......
......@@ -158,6 +158,19 @@ class AdminUser(AssetUser):
def become_pass(self, password):
self._become_pass = signer.sign(password)
@property
def become_info(self):
if self.become:
info = {
"method": self.become_method,
"user": self.become_user,
"pass": self.become_pass,
}
else:
info = None
return info
def get_related_assets(self):
assets = []
for cluster in self.cluster_set.all():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment