Skip to content

Commit

Permalink
Merge pull request #508 from nettorta/develop
Browse files Browse the repository at this point in the history
symlinks failover patch
  • Loading branch information
fomars committed Feb 12, 2018
2 parents 3e8189d + e1ba6b2 commit c68fe98
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 12 deletions.
8 changes: 6 additions & 2 deletions yandextank/plugins/DataUploader/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,12 @@ def get_plugin_dir(shooting_dir):
def make_symlink(shooting_dir, name):
plugin_dir = get_plugin_dir(shooting_dir)
link_name = os.path.join(plugin_dir, str(name))
os.symlink(os.path.relpath(shooting_dir, plugin_dir), link_name)
logger.info('Symlink created: {}'.format(os.path.abspath(link_name)))
try:
os.symlink(os.path.relpath(shooting_dir, plugin_dir), link_name)
except OSError:
logger.warning('Unable to create symlink for artifact: %s', link_name)
else:
logger.info('Symlink created: {}'.format(os.path.abspath(link_name)))


class ConfigError(Exception):
Expand Down
18 changes: 11 additions & 7 deletions yandextank/plugins/DataUploader/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,13 +494,17 @@ def make_symlink(self, name):
PLUGIN_DIR = os.path.join(self.core.artifacts_base_dir, 'lunapark')
if not os.path.exists(PLUGIN_DIR):
os.makedirs(PLUGIN_DIR)
os.symlink(
os.path.relpath(
self.core.artifacts_dir,
PLUGIN_DIR),
os.path.join(
PLUGIN_DIR,
str(name)))
try:
os.symlink(
os.path.relpath(
self.core.artifacts_dir,
PLUGIN_DIR),
os.path.join(
PLUGIN_DIR,
str(name)))
# this exception catch for filesystems w/o symlinks
except OSError:
logger.warning('Unable to create symlink for artifact: %s', name)

def _get_user_agent(self):
plugin_agent = 'Uploader/{}'.format(self.VERSION)
Expand Down
4 changes: 1 addition & 3 deletions yandextank/plugins/Influx/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@
import logging
import sys
import datetime
from uuid import uuid4

from uuid import uuid4
from builtins import str


from influxdb import InfluxDBClient

from ...common.interfaces import AbstractPlugin, \
Expand Down

0 comments on commit c68fe98

Please sign in to comment.