diff --git a/app.py b/app.py index 8ec39fb..ab47d7f 100644 --- a/app.py +++ b/app.py @@ -28,6 +28,7 @@ class User(db.Model): hosts = db.relationship('Host', backref='user', lazy=True) hostfiles = db.relationship('HostFile', backref='user', lazy=True) settings = db.relationship('UserSettings', backref='user', uselist=False) + class Host(db.Model): id = db.Column(db.Integer, primary_key=True) hostname = db.Column(db.String(255), nullable=False) @@ -55,18 +56,6 @@ class Host(db.Model): except Exception: return self.hostname - - def resolved_daemon(self): - if self.use_daemon and self.daemon_url: - try: - daemon_str = self.daemon_url.split("://")[-1] - daemon_ip = daemon_str.split(":")[0] - return socket.gethostbyaddr(daemon_ip)[0] - except Exception: - return daemon_ip - return self.resolved_hostname - - class DeployLog(db.Model): id = db.Column(db.Integer, primary_key=True) timestamp = db.Column(db.DateTime, default=db.func.current_timestamp())