diff --git a/solar/setup.py b/solar/setup.py index 187305f1..b331c80f 100644 --- a/solar/setup.py +++ b/solar/setup.py @@ -16,6 +16,7 @@ import os from setuptools import find_packages from setuptools import setup + def find_requires(): prj_root = os.path.dirname(os.path.realpath(__file__)) requirements = [] diff --git a/solar/solar/cli/executors.py b/solar/solar/cli/executors.py index e67c30a1..d09ac50e 100644 --- a/solar/solar/cli/executors.py +++ b/solar/solar/cli/executors.py @@ -7,8 +7,6 @@ class DryRunExecutor(object): from fabric.contrib import project as fabric_project import mock - from solar.core.handlers import puppet - self.executed = [] self.mapping = mapping or {} diff --git a/solar/solar/core/handlers/ansible_template.py b/solar/solar/core/handlers/ansible_template.py index 89572e50..acf5282a 100644 --- a/solar/solar/core/handlers/ansible_template.py +++ b/solar/solar/core/handlers/ansible_template.py @@ -1,5 +1,4 @@ # -*- coding: utf-8 -*- -from fabric import api as fabric_api from fabric.state import env import os @@ -11,6 +10,7 @@ from solar import errors # otherwise fabric will sys.exit(1) in case of errors env.warn_only = True + # if we would have something like solard that would render this then # we would not need to render it there # for now we redender it locally, sync to remote, run ansible on remote host as local @@ -40,7 +40,6 @@ class AnsibleTemplate(TempFileHandler): # if out.failed: # raise errors.SolarError(out) - def _create_inventory(self, r): directory = self.dirs[r.name] inventory_path = os.path.join(directory, 'inventory') @@ -70,4 +69,3 @@ class AnsibleTemplate(TempFileHandler): args = super(AnsibleTemplate, self)._make_args(resource) args['host'] = 'localhost' return args - diff --git a/solar/solar/core/handlers/puppet.py b/solar/solar/core/handlers/puppet.py index 00cc4244..6fdf92b5 100644 --- a/solar/solar/core/handlers/puppet.py +++ b/solar/solar/core/handlers/puppet.py @@ -1,9 +1,4 @@ # -*- coding: utf-8 -*- -from contextlib import nested -from functools import partial - -from fabric import api as fabric_api -from fabric.contrib import project as fabric_project import os from solar.core.log import log diff --git a/solar/solar/core/resource/resource.py b/solar/solar/core/resource/resource.py index bf1f7eb9..8a0ea2ae 100644 --- a/solar/solar/core/resource/resource.py +++ b/solar/solar/core/resource/resource.py @@ -1,13 +1,8 @@ # -*- coding: utf-8 -*- -import os - from copy import deepcopy -import solar - from solar.core import actions from solar.core import observer -from solar.core import signals from solar.core import validation from solar.interfaces.db import get_db diff --git a/solar/solar/core/transports/rsync.py b/solar/solar/core/transports/rsync.py index 08b79aad..47acc9e5 100644 --- a/solar/solar/core/transports/rsync.py +++ b/solar/solar/core/transports/rsync.py @@ -1,7 +1,3 @@ -import os -from functools import partial -from contextlib import nested - from fabric import api as fabric_api from solar.core.log import log diff --git a/solar/solar/core/transports/ssh.py b/solar/solar/core/transports/ssh.py index de973042..433a4e93 100644 --- a/solar/solar/core/transports/ssh.py +++ b/solar/solar/core/transports/ssh.py @@ -1,5 +1,4 @@ import os -from functools import partial from contextlib import nested from fabric import api as fabric_api diff --git a/solar/solar/events/api.py b/solar/solar/events/api.py index 624447fb..7c6fe726 100644 --- a/solar/solar/events/api.py +++ b/solar/solar/events/api.py @@ -6,7 +6,7 @@ import networkx as nx from solar.core.log import log from solar.interfaces.db import get_db -from solar.events.controls import Dep, React, StateChange +from solar.events.controls import Dep, React db = get_db() diff --git a/solar/solar/events/controls.py b/solar/solar/events/controls.py index 665825a0..6a9e0c31 100644 --- a/solar/solar/events/controls.py +++ b/solar/solar/events/controls.py @@ -17,8 +17,6 @@ trigger action even if no changes noticed on dependent resource. - parent:update -> ok -> dependent:update """ -import re - class Event(object): diff --git a/solar/solar/interfaces/db/redis_db.py b/solar/solar/interfaces/db/redis_db.py index 5000ba67..4fc54d48 100644 --- a/solar/solar/interfaces/db/redis_db.py +++ b/solar/solar/interfaces/db/redis_db.py @@ -3,9 +3,6 @@ import json import redis import fakeredis -from solar import utils -from solar import errors - class RedisDB(object): COLLECTIONS = Enum( @@ -18,7 +15,6 @@ class RedisDB(object): } REDIS_CLIENT = redis.StrictRedis - def __init__(self): self._r = self.REDIS_CLIENT(**self.DB) self.entities = {} diff --git a/solar/solar/orchestration/filters.py b/solar/solar/orchestration/filters.py index 10007c8f..cd5695b7 100644 --- a/solar/solar/orchestration/filters.py +++ b/solar/solar/orchestration/filters.py @@ -2,7 +2,6 @@ import networkx as nx from .traversal import VISITED, states -from solar import errors def get_dfs_postorder_subgraph(dg, nodes): diff --git a/solar/solar/orchestration/limits.py b/solar/solar/orchestration/limits.py index 7e5841b9..8cefc5e3 100644 --- a/solar/solar/orchestration/limits.py +++ b/solar/solar/orchestration/limits.py @@ -38,7 +38,7 @@ def type_based_rule(dg, inprogress, item): type_limit: 2 """ _type = dg.node[item].get('resource_type') - if not 'type_limit' in dg.node[item]: return True + if 'type_limit' not in dg.node[item]: return True if not _type: return True type_count = 0 diff --git a/solar/solar/orchestration/tasks.py b/solar/solar/orchestration/tasks.py index 8d1d117a..3c1abc0b 100644 --- a/solar/solar/orchestration/tasks.py +++ b/solar/solar/orchestration/tasks.py @@ -1,6 +1,5 @@ -from functools import partial, wraps -from itertools import islice +from functools import partial import subprocess import time @@ -8,7 +7,6 @@ from celery.app import task import redis from solar.orchestration import graph -from solar.orchestration import filters from solar.core import actions from solar.core import resource from solar.system_log.tasks import commit_logitem, error_logitem @@ -24,6 +22,7 @@ r = redis.StrictRedis(host='10.0.0.2', port=6379, db=1) __all__ = ['solar_resource', 'cmd', 'sleep', 'error', 'fault_tolerance', 'schedule_start', 'schedule_next'] + # NOTE(dshulyak) i am not using celery.signals because it is not possible # to extract task_id from *task_success* signal class ReportTask(task.Task): diff --git a/solar/solar/system_log/change.py b/solar/solar/system_log/change.py index d83812c0..b73f83ae 100644 --- a/solar/solar/system_log/change.py +++ b/solar/solar/system_log/change.py @@ -1,6 +1,4 @@ - - -from dictdiffer import diff, patch, revert +from dictdiffer import diff import networkx as nx from solar.core.log import log @@ -8,7 +6,6 @@ from solar.core import signals from solar.core import resource from solar import utils from solar.interfaces.db import get_db -from solar.core import actions from solar.system_log import data from solar.orchestration import graph from solar.events import api as evapi diff --git a/solar/solar/system_log/data.py b/solar/solar/system_log/data.py index cbfd8306..d6dd737d 100644 --- a/solar/solar/system_log/data.py +++ b/solar/solar/system_log/data.py @@ -1,7 +1,4 @@ - -import os import collections -from collections import deque from functools import partial from solar import utils diff --git a/solar/solar/utils.py b/solar/solar/utils.py index 5c54e227..0130fc8d 100644 --- a/solar/solar/utils.py +++ b/solar/solar/utils.py @@ -39,7 +39,7 @@ def yaml_dump_to(data, file_path): def find_by_mask(mask): - for file_path in glob.glob(mask): + for file_path in glob.glob(mask): yield os.path.abspath(file_path)