Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Ftrack: Fix receive of host ip on MacOs #4288

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import getpass

from openpype_modules.ftrack.lib import BaseAction
from openpype_modules.ftrack.ftrack_server.lib import get_host_ip


class ActionWhereIRun(BaseAction):
Expand Down Expand Up @@ -53,8 +54,7 @@ def _show_info(self, event):
try:
host_name = socket.gethostname()
msgs["Hostname"] = host_name
host_ip = socket.gethostbyname(host_name)
msgs["IP"] = host_ip
msgs["IP"] = get_host_ip() or "N/A"
except Exception:
pass

Expand Down
5 changes: 4 additions & 1 deletion openpype/modules/ftrack/ftrack_server/event_server_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
)
from openpype_modules.ftrack.lib import credentials
from openpype_modules.ftrack.ftrack_server import socket_thread
from openpype_modules.ftrack.ftrack_server.lib import get_host_ip


class MongoPermissionsError(Exception):
Expand Down Expand Up @@ -245,11 +246,13 @@ def on_exit(processor_thread, storer_thread, statuser_thread):
)

host_name = socket.gethostname()
host_ip = get_host_ip()

main_info = [
["created_at", datetime.datetime.now().strftime("%Y.%m.%d %H:%M:%S")],
["Username", getpass.getuser()],
["Host Name", host_name],
["Host IP", socket.gethostbyname(host_name)],
["Host IP", host_ip or "N/A"],
["OpenPype executable", get_openpype_execute_args()[-1]],
["OpenPype version", get_openpype_version() or "N/A"],
["OpenPype build version", get_build_version() or "N/A"]
Expand Down
13 changes: 12 additions & 1 deletion openpype/modules/ftrack/ftrack_server/lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
import queue
import collections
import appdirs
import pymongo
import socket

import pymongo
import requests
import ftrack_api
import ftrack_api.session
Expand All @@ -32,6 +33,16 @@
TOPIC_STATUS_SERVER_RESULT = "openpype.event.server.status.result"


def get_host_ip():
host_name = socket.gethostname()
try:
return socket.gethostbyname(host_name)
except Exception:
pass

return None


class SocketBaseEventHub(ftrack_api.event.hub.EventHub):

hearbeat_msg = b"hearbeat"
Expand Down
7 changes: 4 additions & 3 deletions openpype/modules/ftrack/scripts/sub_event_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
SocketSession,
StatusEventHub,
TOPIC_STATUS_SERVER,
TOPIC_STATUS_SERVER_RESULT
TOPIC_STATUS_SERVER_RESULT,
get_host_ip
)
from openpype.lib import (
Logger,
Expand All @@ -29,10 +30,10 @@
action_identifier = (
"event.server.status" + os.environ["FTRACK_EVENT_SUB_ID"]
)
host_ip = socket.gethostbyname(socket.gethostname())
host_ip = get_host_ip()
action_data = {
"label": "OpenPype Admin",
"variant": "- Event server Status ({})".format(host_ip),
"variant": "- Event server Status ({})".format(host_ip or "IP N/A"),
"description": "Get Infromation about event server",
"actionIdentifier": action_identifier
}
Expand Down