Commit 903c4b05 by Szeberényi Imre

Notify fix

parent 1f863982
...@@ -22,17 +22,20 @@ VM kontextualizálását végzi. A felhő menedzserrel egy virtuális soros vona ...@@ -22,17 +22,20 @@ VM kontextualizálását végzi. A felhő menedzserrel egy virtuális soros vona
``` ```
sudo -i sudo -i
cd /root cd /root
chmod oug+x . # fontos a pont!
mkvirtualenv agent mkvirtualenv agent
workon agent workon agent
git clone https://git.ik.bme.hu/CIRCLE3/agent.git git clone https://git.ik.bme.hu/CIRCLE3/agent.git
chmod oug+rx agent
cd agent cd agent
python agent.py --install python agent.py --install
``` ```
Ez utóbbi parancs Ez utóbbi parancs
- bemásolja az agent.service-t /etc/systemd/system -be, engedélyezi, de nem indítja el - bemásolja az agent.service-t /etc/systemd/system -be, engedélyezi, de nem indítja el
- bemásolja a vm_renewal-t a /usr/bin/ -be - bemásolja a vm_renewal-t a /usr/bin/ -be
* Célszerűen a cloud usernek van sudo joga jelszó nélkül.
Ha nincs, akkor a /root/.virtualenv/agent és /root/agent katalógusoknak kereshetőknek kell lenniük, és a benne levő
fájloknak olvashatóknak kell lennie a cloud user számára, hogy a vm_reneval működjön.
Ekkor a wm_renewal-bol kivehető a sudo. (Esetleg spec sudo engedéllyel is megoldhato a dolog)
## Windows ## ## Windows ##
* Bundled python alkalmazások, melyekből az első kettő szervízként fut, a harmadik a cloud user belépésekor indul * Bundled python alkalmazások, melyekből az első kettő szervízként fut, a harmadik a cloud user belépésekor indul
......
...@@ -158,8 +158,9 @@ def open_in_browser(url): ...@@ -158,8 +158,9 @@ def open_in_browser(url):
if display: if display:
import webbrowser import webbrowser
webbrowser.open(url, new=2, autoraise=True) logger.debug("webbrowser.open(%s)" % url)
ret = webbrowser.open(url, new=2, autoraise=True)
logger.debug("ret: %s" % ret)
def mount_smb(url): def mount_smb(url):
data = urlsplit(url) data = urlsplit(url)
...@@ -201,6 +202,14 @@ def search_display(): ...@@ -201,6 +202,14 @@ def search_display():
if env: if env:
return env return env
# guess a logged user name
user = "cloud"
try:
process = subprocess.run(["who"], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL, encoding="utf-8", timeout=5)
user = process.stdout.split()[0]
except Exception:
pass
for pid in os.listdir("/proc"): for pid in os.listdir("/proc"):
if not pid.isdigit(): if not pid.isdigit():
continue continue
...@@ -209,14 +218,13 @@ def search_display(): ...@@ -209,14 +218,13 @@ def search_display():
with open(env, "r") as f: with open(env, "r") as f:
envs = dict(line.split("=", 1) envs = dict(line.split("=", 1)
for line in f.read().split("\0") if "=" in line) for line in f.read().split("\0") if "=" in line)
if "DISPLAY" in envs and ":" in envs["DISPLAY"]: if "DISPLAY" in envs and ":" in envs["DISPLAY"] and "USER" in envs and user == envs["USER"]:
p = os.stat(os.path.join("/proc", pid)) p = os.stat(os.path.join("/proc", pid))
return envs["DISPLAY"], p.st_uid, p.st_gid return envs["DISPLAY"], p.st_uid, p.st_gid
except Exception: except Exception:
continue continue
return None return None
if win: if win:
from twisted.internet import protocol from twisted.internet import protocol
from twisted.protocols import basic from twisted.protocols import basic
......
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 sign in to comment