Skip to content

Commit

Permalink
Fix charm_version and moves to self.hostname
Browse files Browse the repository at this point in the history
  • Loading branch information
phvalguima committed Oct 7, 2024
1 parent 6d76daf commit ada906f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion charm_version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty+49ef051-dirty
1.0
8 changes: 4 additions & 4 deletions src/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,12 @@ def password_rotated(self) -> bool:
return bool(self.relation_data.get("password-rotated", None))

@property
def hostname(self) -> str | None:
def hostname(self) -> str:
"""The hostname for the unit."""
return socket.gethostname()

@property
def fqdn(self) -> str | None:
def fqdn(self) -> str:
"""The Fully Qualified Domain Name for the unit."""
return socket.getfqdn(self.private_ip)

Expand All @@ -196,7 +196,7 @@ def private_ip(self) -> str:
else None
)
# Optional fallback, if no binding is found
return address or socket.gethostbyname(socket.gethostname())
return address or socket.gethostbyname(self.hostname)

@property
def public_ip(self) -> str:
Expand All @@ -212,7 +212,7 @@ def public_ip(self) -> str:
else None
)
# Optional fallback, if no binding is found
return address or socket.gethostbyname(socket.gethostname())
return address or socket.gethostbyname(self.hostname)

@property
def host(self) -> str:
Expand Down

0 comments on commit ada906f

Please sign in to comment.