logs symlinks for plugins

This commit is contained in:
Arseniy Fomchenko 2016-10-24 21:34:42 +03:00
parent 372293d67c
commit b04ef7b102
3 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import logging import logging
import os
class AbstractPlugin(object): class AbstractPlugin(object):
@ -87,6 +88,12 @@ class AbstractPlugin(object):
""" """
pass pass
def make_symlink(self, name):
PLUGIN_DIR = os.path.join(self.core.artifacts_base_dir, self.SECTION)
if not os.path.exists(PLUGIN_DIR):
os.makedirs(PLUGIN_DIR)
os.symlink(self.core.artifacts_dir, os.path.join(PLUGIN_DIR, str(name)))
class MonitoringDataListener(object): class MonitoringDataListener(object):
""" Monitoring interface """ Monitoring interface

View File

@ -521,6 +521,7 @@ class TankCore(object):
if not os.path.isdir(self.artifacts_dir): if not os.path.isdir(self.artifacts_dir):
os.makedirs(self.artifacts_dir) os.makedirs(self.artifacts_dir)
os.chmod(self._artifacts_dir, 0o755) os.chmod(self._artifacts_dir, 0o755)
self._artifacts_dir = os.path.abspath(self._artifacts_dir)
return self._artifacts_dir return self._artifacts_dir

View File

@ -10,8 +10,6 @@ import pwd
import socket import socket
import sys import sys
from ...common.interfaces import AbstractPlugin, MonitoringDataListener, AggregateResultListener, AbstractInfoWidget
from .client import OverloadClient from .client import OverloadClient
from ..Aggregator import Plugin as AggregatorPlugin from ..Aggregator import Plugin as AggregatorPlugin
from ..Autostop import Plugin as AutostopPlugin from ..Autostop import Plugin as AutostopPlugin
@ -21,6 +19,7 @@ from ..Monitoring import Plugin as MonitoringPlugin
from ..Pandora import Plugin as PandoraPlugin from ..Pandora import Plugin as PandoraPlugin
from ..Phantom import Plugin as PhantomPlugin from ..Phantom import Plugin as PhantomPlugin
from ..Telegraf import Plugin as TelegrafPlugin from ..Telegraf import Plugin as TelegrafPlugin
from ...common.interfaces import AbstractPlugin, MonitoringDataListener, AggregateResultListener, AbstractInfoWidget
logger = logging.getLogger(__name__) # pylint: disable=C0103 logger = logging.getLogger(__name__) # pylint: disable=C0103
@ -229,9 +228,9 @@ class Plugin(AbstractPlugin, AggregateResultListener, MonitoringDataListener):
logger.info("Web link: %s", web_link) logger.info("Web link: %s", web_link)
self.publish("jobno", self.jobno) self.publish("jobno", self.jobno)
self.publish("web_link", web_link) self.publish("web_link", web_link)
if not self._core_with_tank_api():
self.core.artifacts_dir = self.core.artifacts_base_dir + \ self.make_symlink(self.jobno)
'/' + str(self.jobno)
self.set_option("jobno", self.jobno) self.set_option("jobno", self.jobno)
if self.jobno_file: if self.jobno_file:
logger.debug("Saving jobno to: %s", self.jobno_file) logger.debug("Saving jobno to: %s", self.jobno_file)