From 49dc267ed288692b6bd4a06abc756806f887313b Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 12 Feb 2017 17:42:38 +0100 Subject: [PATCH 01/10] Fix pylint on runners Python modules - previously we didn't lint runners because pylint simply silently ignores invalid / inexistent paths. --- Makefile | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9590cc4860..7a96c6473f 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,10 @@ BINARIES := bin # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) -COMPONENTS += $(wildcard contrib/runners/*) +COMPONENTS_RUNNERS += $(wildcard contrib/runners/*) + +COMPONENTS_WITH_RUNNERS := $(wildcard st2*) +COMPONENTS_WITH_RUNNERS += $(wildcard contrib/runners/*) # Components that implement a component-controlled test-runner. These components provide an # in-component Makefile. (Temporary fix until I can generalize the pecan unittest setup. -mar) @@ -19,7 +22,7 @@ space_char := space_char += comma := , COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS))) -COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS)),$(component)) +COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS_WITH_RUNNERS)),$(component)) COMPONENTS_TEST_COMMA := $(subst $(space_char),$(comma),$(COMPONENTS_TEST)) PYTHON_TARGET := 2.7 @@ -86,6 +89,14 @@ configgen: echo "==========================================================="; \ . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models --load-plugins=pylint_plugins.db_models $$component/$$component || exit 1; \ done + # Lint runner modules and packages + @for component in $(COMPONENTS_RUNNERS); do\ + echo "==========================================================="; \ + echo "Running pylint on" $$component; \ + echo "==========================================================="; \ + . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models --load-plugins=pylint_plugins.db_models $$component/*.py || exit 1; \ + done + # Lint Python pack management actions . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/ || exit 1; # Lint other packs @@ -105,6 +116,7 @@ flake8: requirements .flake8 @echo "==================== flake ====================" @echo . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 $(COMPONENTS) + . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 $(COMPONENTS_RUNNER) . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/packs/actions/ . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/linux . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/chatops/ @@ -120,7 +132,7 @@ bandit: requirements .bandit @echo @echo "==================== bandit ====================" @echo - . $(VIRTUALENV_DIR)/bin/activate; bandit -r $(COMPONENTS) -lll + . $(VIRTUALENV_DIR)/bin/activate; bandit -r $(COMPONENTS_WITH_RUNNERS) -lll .PHONY: lint lint: requirements .lint @@ -140,7 +152,7 @@ compile: .PHONY: .cleanpycs .cleanpycs: @echo "Removing all .pyc files" - find $(COMPONENTS) -name \*.pyc -type f -print0 | xargs -0 -I {} rm {} + find $(COMPONENTS_WITH_RUNNERS) -name \*.pyc -type f -print0 | xargs -0 -I {} rm {} .PHONY: .st2client-dependencies-check .st2client-dependencies-check: From 29958065b61f1a146f41cdd8cc53fa0ebd570750 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 12 Feb 2017 17:47:16 +0100 Subject: [PATCH 02/10] Fix assignment. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 7a96c6473f..9d10316d3d 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,7 @@ BINARIES := bin # All components are prefixed by st2 COMPONENTS := $(wildcard st2*) -COMPONENTS_RUNNERS += $(wildcard contrib/runners/*) +COMPONENTS_RUNNERS := $(wildcard contrib/runners/*) COMPONENTS_WITH_RUNNERS := $(wildcard st2*) COMPONENTS_WITH_RUNNERS += $(wildcard contrib/runners/*) From f1cf556d6aea42a6a24ff123afd307022603410e Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 12 Feb 2017 18:02:40 +0100 Subject: [PATCH 03/10] Fix pylint on some Python modules. Pylint either requires path to a package or a module, passing a path to a directory which is not a package doesn't work and such directory is simply skipped so we need to pass paths to actual Python files / modules. --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 9d10316d3d..d128613a97 100644 --- a/Makefile +++ b/Makefile @@ -96,12 +96,12 @@ configgen: echo "==========================================================="; \ . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models --load-plugins=pylint_plugins.db_models $$component/*.py || exit 1; \ done - # Lint Python pack management actions - . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/ || exit 1; + . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/*.py || exit 1; + . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/packs/actions/*/*.py || exit 1; # Lint other packs - . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/linux || exit 1; - . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/chatops || exit 1; + . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/linux/*/*.py || exit 1; + . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models contrib/chatops/*/*.py || exit 1; # Lint Python scripts . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models scripts/*.py || exit 1; . $(VIRTUALENV_DIR)/bin/activate; pylint -E --rcfile=./lint-configs/python/.pylintrc --load-plugins=pylint_plugins.api_models tools/*.py || exit 1; From de6536852d93427c59c458eeac8dbac6da86979c Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 12 Feb 2017 18:05:25 +0100 Subject: [PATCH 04/10] Fix pylint false negatives. --- contrib/packs/actions/pack_mgmt/download.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/packs/actions/pack_mgmt/download.py b/contrib/packs/actions/pack_mgmt/download.py index c68c077353..31fc7995de 100644 --- a/contrib/packs/actions/pack_mgmt/download.py +++ b/contrib/packs/actions/pack_mgmt/download.py @@ -138,7 +138,7 @@ def _clone_repo(temp_dir, repo_url, verifyssl=True, ref='master'): # We're trying to figure out which branch the ref is actually on, # since there's no direct way to check for this in git-python. - branches = repo.git.branch('-a', '--contains', gitref.hexsha) + branches = repo.git.branch('-a', '--contains', gitref.hexsha) # pylint: disable=no-member branches = branches.replace('*', '').split() if active_branch.name not in branches or use_branch: @@ -149,8 +149,8 @@ def _clone_repo(temp_dir, repo_url, verifyssl=True, ref='master'): else: branch = repo.active_branch.name - repo.git.checkout(gitref.hexsha) - repo.git.branch('-f', branch, gitref.hexsha) + repo.git.checkout(gitref.hexsha) # pylint: disable=no-member + repo.git.branch('-f', branch, gitref.hexsha) # pylint: disable=no-member repo.git.checkout(branch) return temp_dir From 27726effd00ceef32f03863a43841f727999f8ac Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Sun, 12 Feb 2017 16:53:27 +0100 Subject: [PATCH 05/10] Upgrade astroid and pylint dependency. --- test-requirements.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test-requirements.txt b/test-requirements.txt index 36971721d6..0ae6cb9605 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,8 +1,8 @@ coverage pep8==1.7.0 flake8==3.0.4 -astroid==1.4.5 -pylint==1.5.5 +astroid==1.4.9 +pylint==1.6.5 pylint-plugin-utils>=0.2.3,<0.3 bandit>=1.0.1,<1.1 ipython From 6e5649eca0c8e5e613bc89f2976eb86b55bbb6d6 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 13 Feb 2017 10:46:47 +0100 Subject: [PATCH 06/10] Fix typo. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d128613a97..d4436be024 100644 --- a/Makefile +++ b/Makefile @@ -116,7 +116,7 @@ flake8: requirements .flake8 @echo "==================== flake ====================" @echo . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 $(COMPONENTS) - . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 $(COMPONENTS_RUNNER) + . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 $(COMPONENTS_RUNNERS) . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/packs/actions/ . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/linux . $(VIRTUALENV_DIR)/bin/activate; flake8 --config ./lint-configs/python/.flake8 contrib/chatops/ From 63156030262890e17dfdd3ad3b51dc82000540b9 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 13 Feb 2017 10:43:20 +0100 Subject: [PATCH 07/10] Also upgrade flake8. --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 0ae6cb9605..4572752f2d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,6 +1,6 @@ coverage pep8==1.7.0 -flake8==3.0.4 +flake8==3.3.0 astroid==1.4.9 pylint==1.6.5 pylint-plugin-utils>=0.2.3,<0.3 From 074ceb6dad58ee9f7c9eb94f021f00437732c143 Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 13 Feb 2017 11:15:04 +0100 Subject: [PATCH 08/10] Fix PYTHONPATH for tests. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d4436be024..2529762b63 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ COMPONENT_SPECIFIC_TESTS := st2tests st2client.egg-info space_char := space_char += comma := , -COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS))) +COMPONENT_PYTHONPATH = $(subst $(space_char),:,$(realpath $(COMPONENTS_WITH_RUNNERS))) COMPONENTS_TEST := $(foreach component,$(filter-out $(COMPONENT_SPECIFIC_TESTS),$(COMPONENTS_WITH_RUNNERS)),$(component)) COMPONENTS_TEST_COMMA := $(subst $(space_char),$(comma),$(COMPONENTS_TEST)) From 1d80e05b6d2ca271960227e78165f12fc2149f5a Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 13 Feb 2017 13:07:54 +0100 Subject: [PATCH 09/10] Fix lint violations reported by new version of flake8. --- st2api/st2api/controllers/resource.py | 1 + st2client/st2client/commands/action.py | 1 + .../v1.5/st2-migrate-datastore-to-include-scope-secret.py | 1 + st2common/bin/migrations/v2.1/st2-migrate-datastore-scopes.py | 1 + st2common/st2common/content/bootstrap.py | 2 ++ st2common/st2common/log.py | 1 + st2common/st2common/models/db/action.py | 1 + st2common/st2common/models/db/executionstate.py | 1 + st2common/st2common/models/db/marker.py | 1 + st2common/st2common/models/db/rbac.py | 1 + st2common/st2common/models/db/rule.py | 1 + st2common/st2common/models/db/rule_enforcement.py | 1 + st2common/st2common/models/db/runner.py | 1 + st2common/st2common/models/db/sensor.py | 1 + st2common/st2common/models/db/trace.py | 1 + st2common/st2common/operators.py | 1 + st2common/tests/unit/test_db_model_uids.py | 4 ++-- st2reactor/st2reactor/garbage_collector/config.py | 1 + tools/diff-db-disk.py | 1 + tools/migrate_rules_to_include_pack.py | 2 ++ tools/visualize_action_chain.py | 1 + 21 files changed, 24 insertions(+), 2 deletions(-) diff --git a/st2api/st2api/controllers/resource.py b/st2api/st2api/controllers/resource.py index 03aa64affa..0de2161e5b 100644 --- a/st2api/st2api/controllers/resource.py +++ b/st2api/st2api/controllers/resource.py @@ -51,6 +51,7 @@ def split_id_value(value): return split + DEFAULT_FILTER_TRANSFORM_FUNCTIONS = { # Support for filtering on multiple ids when a commona delimited string is provided # (e.g. ?id=1,2,3) diff --git a/st2client/st2client/commands/action.py b/st2client/st2client/commands/action.py index 59a26edba8..68a7f2ed8a 100644 --- a/st2client/st2client/commands/action.py +++ b/st2client/st2client/commands/action.py @@ -105,6 +105,7 @@ def format_parameters(value): return value + # String for indenting etc. WF_PREFIX = '+ ' NON_WF_PREFIX = ' ' diff --git a/st2common/bin/migrations/v1.5/st2-migrate-datastore-to-include-scope-secret.py b/st2common/bin/migrations/v1.5/st2-migrate-datastore-to-include-scope-secret.py index e74ecc21f1..763628bd91 100755 --- a/st2common/bin/migrations/v1.5/st2-migrate-datastore-to-include-scope-secret.py +++ b/st2common/bin/migrations/v1.5/st2-migrate-datastore-to-include-scope-secret.py @@ -67,5 +67,6 @@ def main(): db_teardown() sys.exit(exit_code) + if __name__ == '__main__': main() diff --git a/st2common/bin/migrations/v2.1/st2-migrate-datastore-scopes.py b/st2common/bin/migrations/v2.1/st2-migrate-datastore-scopes.py index 25d3dd68f5..4841a8f1e3 100755 --- a/st2common/bin/migrations/v2.1/st2-migrate-datastore-scopes.py +++ b/st2common/bin/migrations/v2.1/st2-migrate-datastore-scopes.py @@ -71,5 +71,6 @@ def main(): db_teardown() sys.exit(exit_code) + if __name__ == '__main__': main() diff --git a/st2common/st2common/content/bootstrap.py b/st2common/st2common/content/bootstrap.py index 49317fd3cf..bd5c8acbd7 100644 --- a/st2common/st2common/content/bootstrap.py +++ b/st2common/st2common/content/bootstrap.py @@ -74,6 +74,8 @@ def register_opts(): cfg.CONF.register_cli_opts(content_opts, group='register') except: sys.stderr.write('Failed registering opts.\n') + + register_opts() diff --git a/st2common/st2common/log.py b/st2common/st2common/log.py index 8560c494ac..94749a5fe1 100644 --- a/st2common/st2common/log.py +++ b/st2common/st2common/log.py @@ -161,6 +161,7 @@ def _audit(logger, msg, *args, **kwargs): if logger.isEnabledFor(logging.AUDIT): logger._log(logging.AUDIT, msg, args, **kwargs) + logging.Logger.audit = _audit diff --git a/st2common/st2common/models/db/action.py b/st2common/st2common/models/db/action.py index 0f386b545e..80a63a7c67 100644 --- a/st2common/st2common/models/db/action.py +++ b/st2common/st2common/models/db/action.py @@ -95,6 +95,7 @@ def is_workflow(self): # pylint: disable=unsubscriptable-object return self.runner_type['name'] in WORKFLOW_RUNNER_TYPES + # specialized access objects action_access = MongoDBAccess(ActionDB) diff --git a/st2common/st2common/models/db/executionstate.py b/st2common/st2common/models/db/executionstate.py index bcfc458b38..244a8a9804 100644 --- a/st2common/st2common/models/db/executionstate.py +++ b/st2common/st2common/models/db/executionstate.py @@ -48,6 +48,7 @@ class ActionExecutionStateDB(stormbase.StormFoundationDB): 'indexes': ['query_module'] } + # specialized access objects actionexecstate_access = MongoDBAccess(ActionExecutionStateDB) diff --git a/st2common/st2common/models/db/marker.py b/st2common/st2common/models/db/marker.py index 66aedd9cc9..5f325f31b9 100644 --- a/st2common/st2common/models/db/marker.py +++ b/st2common/st2common/models/db/marker.py @@ -52,4 +52,5 @@ class DumperMarkerDB(MarkerDB): """ pass + MODELS = [MarkerDB, DumperMarkerDB] diff --git a/st2common/st2common/models/db/rbac.py b/st2common/st2common/models/db/rbac.py index 6b04ade516..5e645d76d3 100644 --- a/st2common/st2common/models/db/rbac.py +++ b/st2common/st2common/models/db/rbac.py @@ -75,6 +75,7 @@ class PermissionGrantDB(stormbase.StormFoundationDB): resource_type = me.StringField(required=False) permission_types = me.ListField(field=me.StringField()) + # Specialized access objects role_access = MongoDBAccess(RoleDB) user_role_assignment_access = MongoDBAccess(UserRoleAssignmentDB) diff --git a/st2common/st2common/models/db/rule.py b/st2common/st2common/models/db/rule.py index 4bc1e9a9a5..fba3098bb3 100644 --- a/st2common/st2common/models/db/rule.py +++ b/st2common/st2common/models/db/rule.py @@ -98,6 +98,7 @@ def __init__(self, *args, **values): self.ref = self.get_reference().ref self.uid = self.get_uid() + rule_access = MongoDBAccess(RuleDB) rule_type_access = MongoDBAccess(RuleTypeDB) diff --git a/st2common/st2common/models/db/rule_enforcement.py b/st2common/st2common/models/db/rule_enforcement.py index 101efb5cd9..80e0d3c4f5 100644 --- a/st2common/st2common/models/db/rule_enforcement.py +++ b/st2common/st2common/models/db/rule_enforcement.py @@ -65,6 +65,7 @@ def get_uid(self): uid = [self.RESOURCE_TYPE, str(self.id)] return ':'.join(uid) + rule_enforcement_access = MongoDBAccess(RuleEnforcementDB) MODELS = [RuleEnforcementDB] diff --git a/st2common/st2common/models/db/runner.py b/st2common/st2common/models/db/runner.py index ecdc42f515..b931f89eb8 100644 --- a/st2common/st2common/models/db/runner.py +++ b/st2common/st2common/models/db/runner.py @@ -67,6 +67,7 @@ def __init__(self, *args, **values): super(RunnerTypeDB, self).__init__(*args, **values) self.uid = self.get_uid() + # specialized access objects runnertype_access = MongoDBAccess(RunnerTypeDB) diff --git a/st2common/st2common/models/db/sensor.py b/st2common/st2common/models/db/sensor.py index 4dacd178e2..72a279aa1b 100644 --- a/st2common/st2common/models/db/sensor.py +++ b/st2common/st2common/models/db/sensor.py @@ -59,6 +59,7 @@ def __init__(self, *args, **values): self.ref = self.get_reference().ref self.uid = self.get_uid() + sensor_type_access = MongoDBAccess(SensorTypeDB) MODELS = [SensorTypeDB] diff --git a/st2common/st2common/models/db/trace.py b/st2common/st2common/models/db/trace.py index 684003fe6e..e5a7235d65 100644 --- a/st2common/st2common/models/db/trace.py +++ b/st2common/st2common/models/db/trace.py @@ -84,6 +84,7 @@ class TraceDB(stormbase.StormFoundationDB): ] } + # specialized access objects trace_access = MongoDBAccess(TraceDB) diff --git a/st2common/st2common/operators.py b/st2common/st2common/operators.py index bd20845571..bdc2257817 100644 --- a/st2common/st2common/operators.py +++ b/st2common/st2common/operators.py @@ -185,6 +185,7 @@ def exists(value, criteria_pattern): def nexists(value, criteria_pattern): return value is None + # operator match strings MATCH_WILDCARD = 'matchwildcard' MATCH_REGEX = 'matchregex' diff --git a/st2common/tests/unit/test_db_model_uids.py b/st2common/tests/unit/test_db_model_uids.py index 0b269ea062..a9d1f343d3 100644 --- a/st2common/tests/unit/test_db_model_uids.py +++ b/st2common/tests/unit/test_db_model_uids.py @@ -51,11 +51,11 @@ def test_get_uid(self): self.assertTrue(trigger_db.get_uid().startswith('trigger:tpack:tname:')) # Verify that same set of parameters always results in the same hash - parameters = {'a': 1, 'b': 2, 'c': [1, 2, 3], 'd': {'g': 1, 'h': 2}, 'b': u'unicode'} + parameters = {'a': 1, 'b': 'unicode', 'c': [1, 2, 3], 'd': {'g': 1, 'h': 2}} paramers_hash = json.dumps(parameters, sort_keys=True) paramers_hash = hashlib.md5(paramers_hash).hexdigest() - parameters = {'a': 1, 'b': 2, 'c': [1, 2, 3], 'b': u'unicode', 'd': {'g': 1, 'h': 2}} + parameters = {'a': 1, 'b': 'unicode', 'c': [1, 2, 3], 'd': {'g': 1, 'h': 2}} trigger_db = TriggerDB(name='tname', pack='tpack', parameters=parameters) self.assertEqual(trigger_db.get_uid(), 'trigger:tpack:tname:%s' % (paramers_hash)) diff --git a/st2reactor/st2reactor/garbage_collector/config.py b/st2reactor/st2reactor/garbage_collector/config.py index 1153e3d4d1..9c0920575a 100644 --- a/st2reactor/st2reactor/garbage_collector/config.py +++ b/st2reactor/st2reactor/garbage_collector/config.py @@ -63,4 +63,5 @@ def _register_garbage_collector_opts(): ] CONF.register_opts(ttl_opts, group='garbagecollector') + register_opts() diff --git a/tools/diff-db-disk.py b/tools/diff-db-disk.py index 840242d56e..75aa1f2c72 100755 --- a/tools/diff-db-disk.py +++ b/tools/diff-db-disk.py @@ -270,5 +270,6 @@ def main(): # Disconnect from db. db_teardown() + if __name__ == '__main__': main() diff --git a/tools/migrate_rules_to_include_pack.py b/tools/migrate_rules_to_include_pack.py index a859b9fa37..4c090f80f2 100755 --- a/tools/migrate_rules_to_include_pack.py +++ b/tools/migrate_rules_to_include_pack.py @@ -57,6 +57,7 @@ class RuleDB(stormbase.StormFoundationDB, stormbase.TagsMixin, 'indexes': stormbase.TagsMixin.get_indices() } + # specialized access objects rule_access_with_pack = MongoDBAccess(Migration.RuleDB) @@ -82,6 +83,7 @@ class RuleDB(stormbase.StormBaseDB, stormbase.TagsMixin): 'indexes': stormbase.TagsMixin.get_indices() } + rule_access_without_pack = MongoDBAccess(RuleDB) diff --git a/tools/visualize_action_chain.py b/tools/visualize_action_chain.py index 98360ac04a..fc2dd6ac66 100755 --- a/tools/visualize_action_chain.py +++ b/tools/visualize_action_chain.py @@ -107,6 +107,7 @@ def main(metadata_path, output_path, print_source=False): print('Graph saved at %s' % (output_path + '.png')) + if __name__ == '__main__': parser = argparse.ArgumentParser(description='Action chain visualization') parser.add_argument('--metadata-path', action='store', required=True, From af6b201adc2c9a43244a4cbe8805ec9d854848eb Mon Sep 17 00:00:00 2001 From: Tomaz Muraus Date: Mon, 13 Feb 2017 13:21:07 +0100 Subject: [PATCH 10/10] Upgrade mock to 2.0.0. --- test-requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-requirements.txt b/test-requirements.txt index 4572752f2d..95f3f49ce4 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -6,7 +6,7 @@ pylint==1.6.5 pylint-plugin-utils>=0.2.3,<0.3 bandit>=1.0.1,<1.1 ipython -mock>=1.0 +mock==2.0.0 nose>=1.3.7 tabulate unittest2