#761: OGAGent checks for dobule slash before connecting to REST URL.

oglive^2
Ramón M. Gómez 2019-04-29 10:48:33 +02:00
parent 198088d7f4
commit bdfcb0d1fe
6 changed files with 23 additions and 51 deletions

View File

@ -30,28 +30,13 @@ install-ogagent:
cp -r $(SOURCEDIR)/opengnsys $(LIBDIR)/opengnsys
cp -r $(SOURCEDIR)/cfg $(LIBDIR)/cfg
ln -fs $(LIBDIR)/cfg/ogagent.cfg $(CFGDIR)
ln -fs $(LIBDIR)/cfg/ogclient.cfg $(CFGDIR)
# scripts
cp scripts/ogagent $(BINDIR)
cp scripts/OGAgentTool-startup $(BINDIR)
cp scripts/OGAgentTool $(BINDIR)
# Fix permissions
chmod 755 $(BINDIR)/ogagent
chmod 755 $(BINDIR)/OGAgentTool-startup
chmod 600 $(LIBDIR)/cfg/ogagent.cfg
# If for red hat based, copy init.d
ifeq ($(DISTRO),rh)
mkdir -p $(INITDIR)
cp debian/ogagent.init $(INITDIR)/ogagent
chmod +x $(INITDIR)/ogagent
ln -fs /usr/share/OGAgent/cfg/ogagent.cfg $(CFGDIR)
ln -fs /usr/share/OGAgent/cfg/ogclient.cfg $(CFGDIR)
endif
# chmod 0755 $(BINDIR)/ogagent
uninstall:
rm -rf $(LIBDIR)
# rm -f $(BINDIR)/ogagent
rm -f $(BINDIR)/ogagent
rm -rf $(CFGDIR)

View File

@ -1,5 +0,0 @@
# Automatically added by dh_installinit
if [ -x "/etc/init.d/ogagent" ]; then
update-rc.d ogagent defaults >/dev/null || exit $?
fi
# End automatically added section

View File

@ -1,12 +0,0 @@
# Automatically added by dh_installinit
if [ "$1" = "purge" ] ; then
update-rc.d ogagent remove >/dev/null
fi
# In case this system is running systemd, we make systemd reload the unit files
# to pick up changes.
if [ -d /run/systemd/system ] ; then
systemctl --system daemon-reload >/dev/null || true
fi
# End automatically added section

View File

@ -1,6 +0,0 @@
#!/bin/sh
FOLDER=/usr/share/OGAgent
cd $FOLDER
python OGAgentUser.py $@

View File

@ -1,10 +0,0 @@
#!/bin/sh
# Simple hack to wait for systray to be present
# Exec tool if not already runned by session manager
ps -ef | grep "$USER" | grep -v grep | grep -v OGAgentTool-startup | grep 'OGAgentTool' -q
# If not already running
if [ $? -eq 1 ]; then
sleep 5
exec /usr/bin/OGAgentTool
fi

View File

@ -126,6 +126,8 @@ class OpenGnSysWorker(ServerWorker):
# Replacing server IP if its running on ogLive clinet
logger.debug('Activating on ogLive client, new server is {}'.format(os.environ['oglive']))
url = parse.urlsplit(url)._replace(netloc=os.environ['oglive']).geturl()
if not url.endswith(os.path.sep):
url += os.path.sep
self.REST = REST(url)
# Get network interfaces until they are active or timeout (5 minutes)
for t in range(0, 300):
@ -178,6 +180,24 @@ class OpenGnSysWorker(ServerWorker):
new_hosts_file = hosts_file + '.' + self.interface.ip.split('.')[0]
if os.path.isfile(new_hosts_file):
shutil.copyfile(new_hosts_file, hosts_file)
### Separate in a different function to launch browser while catching disk configuration
# Create HTML file (TEMPORARY)
message = """
<html>
<head></head>
<body>
<h1>Initializing...</h1>
</body>
</html>
"""
#f = open('/tmp/init.html', 'w')
#f.write(message)
#f.close()
# Launch browser
#subprocess.Popen(['browser', '-qws', '/tmp/init.html'])
#config = operations.get_configuration()
#self.REST.sendMessage('clients/config', {'mac': self.interface.mac, 'ip': self.interface.ip,
# 'config': config})
def onDeactivation(self):
"""