summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTin Lam <tin@irrational.io>2018-11-12 01:07:52 -0600
committerTin Lam <tin@irrational.io>2018-11-13 14:50:42 -0600
commita3da86e3119d150a4f36fd93657455e6ec0c51ed (patch)
tree2a19b119e17d087ef5c4cc6e709a1a7d2c27e0d6
parentb7556bd89e99f2a6539e97d5a4ac6738751b9c55 (diff)
Flake8 fix
This removes all PEP8 ignores and places in default settings for flake8. Change-Id: I3c4df02dea959dfe58f44e7c0e0ac58078a81abc Signed-off-by: Tin Lam <tin@irrational.io>
Notes
Notes (review): Code-Review+2: Felipe Monteiro <felipe.monteiro@att.com> Workflow+1: Felipe Monteiro <felipe.monteiro@att.com> Verified+2: Zuul Submitted-by: Zuul Submitted-at: Tue, 13 Nov 2018 22:48:52 +0000 Reviewed-on: https://review.openstack.org/617233 Project: openstack/airship-pegleg Branch: refs/heads/master
-rw-r--r--pegleg/cli.py17
-rw-r--r--pegleg/engine/secrets.py9
-rw-r--r--pegleg/engine/util/git.py4
-rw-r--r--pegleg/engine/util/pegleg_secret_management.py3
-rw-r--r--tox.ini6
5 files changed, 20 insertions, 19 deletions
diff --git a/pegleg/cli.py b/pegleg/cli.py
index a7c3b43..84b03e4 100644
--- a/pegleg/cli.py
+++ b/pegleg/cli.py
@@ -46,9 +46,8 @@ MAIN_REPOSITORY_OPTION = click.option(
46 '--site-repository', 46 '--site-repository',
47 'site_repository', 47 'site_repository',
48 required=True, 48 required=True,
49 help= 49 help=('Path or URL to the primary repository (containing '
50 'Path or URL to the primary repository (containing site_definition.yaml) ' 50 'site_definition.yaml) repo.'))
51 'repo.')
52 51
53EXTRA_REPOSITORY_OPTION = click.option( 52EXTRA_REPOSITORY_OPTION = click.option(
54 '-e', 53 '-e',
@@ -72,10 +71,10 @@ REPOSITORY_USERNAME_OPTION = click.option(
72 '-u', 71 '-u',
73 '--repo-username', 72 '--repo-username',
74 'repo_username', 73 'repo_username',
75 help= 74 help=('The SSH username to use when cloning remote authenticated '
76 'The SSH username to use when cloning remote authenticated repositories ' 75 'repositories specified in the site-definition file. Any '
77 'specified in the site-definition file. Any occurrences of REPO_USERNAME ' 76 'occurrences of REPO_USERNAME will be replaced with this '
78 'will be replaced with this value.') 77 'value.'))
79 78
80REPOSITORY_CLONE_PATH_OPTION = click.option( 79REPOSITORY_CLONE_PATH_OPTION = click.option(
81 '-p', 80 '-p',
@@ -96,8 +95,8 @@ ALLOW_MISSING_SUBSTITUTIONS_OPTION = click.option(
96 required=False, 95 required=False,
97 type=click.BOOL, 96 type=click.BOOL,
98 default=True, 97 default=True,
99 help= 98 help=("Raise Deckhand exception on missing substition sources. "
100 "Raise Deckhand exception on missing substition sources. Defaults to True." 99 "Defaults to True.")
101) 100)
102 101
103EXCLUDE_LINT_OPTION = click.option( 102EXCLUDE_LINT_OPTION = click.option(
diff --git a/pegleg/engine/secrets.py b/pegleg/engine/secrets.py
index 4812ea1..08688bc 100644
--- a/pegleg/engine/secrets.py
+++ b/pegleg/engine/secrets.py
@@ -78,8 +78,8 @@ def decrypt(file_path, site_name):
78 """ 78 """
79 79
80 LOG.info('Started decrypting...') 80 LOG.info('Started decrypting...')
81 if os.path.isfile(file_path) \ 81 if (os.path.isfile(file_path) and
82 and [s for s in file_path.split(os.path.sep) if s == site_name]: 82 [s for s in file_path.split(os.path.sep) if s == site_name]):
83 PeglegSecretManagement(file_path).decrypt_secrets() 83 PeglegSecretManagement(file_path).decrypt_secrets()
84 else: 84 else:
85 LOG.info('File: {} was not found. Check your file path and name, ' 85 LOG.info('File: {} was not found. Check your file path and name, '
@@ -101,9 +101,8 @@ def _get_dest_path(repo_base, file_path, save_location):
101 :rtype: string 101 :rtype: string
102 """ 102 """
103 103
104 if save_location \ 104 if (save_location and save_location != os.path.sep and
105 and save_location != os.path.sep \ 105 save_location.endswith(os.path.sep)):
106 and save_location.endswith(os.path.sep):
107 save_location = save_location.rstrip(os.path.sep) 106 save_location = save_location.rstrip(os.path.sep)
108 if repo_base and repo_base.endswith(os.path.sep): 107 if repo_base and repo_base.endswith(os.path.sep):
109 repo_base = repo_base.rstrip(os.path.sep) 108 repo_base = repo_base.rstrip(os.path.sep)
diff --git a/pegleg/engine/util/git.py b/pegleg/engine/util/git.py
index b1ab65f..616e0a6 100644
--- a/pegleg/engine/util/git.py
+++ b/pegleg/engine/util/git.py
@@ -198,8 +198,8 @@ def _try_git_clone(repo_url,
198 except git_exc.GitCommandError as e: 198 except git_exc.GitCommandError as e:
199 LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url, 199 LOG.exception('Failed to clone repo_url=%s using ref=%s.', repo_url,
200 ref) 200 ref)
201 if (ssh_cmd and ssh_cmd in e.stderr 201 if (ssh_cmd and ssh_cmd in e.stderr or
202 or 'permission denied' in e.stderr.lower()): 202 'permission denied' in e.stderr.lower()):
203 raise exceptions.GitAuthException( 203 raise exceptions.GitAuthException(
204 repo_url=repo_url, ssh_key_path=auth_key) 204 repo_url=repo_url, ssh_key_path=auth_key)
205 elif 'could not resolve proxy' in e.stderr.lower(): 205 elif 'could not resolve proxy' in e.stderr.lower():
diff --git a/pegleg/engine/util/pegleg_secret_management.py b/pegleg/engine/util/pegleg_secret_management.py
index 993e2d3..a939f2d 100644
--- a/pegleg/engine/util/pegleg_secret_management.py
+++ b/pegleg/engine/util/pegleg_secret_management.py
@@ -42,8 +42,7 @@ class PeglegSecretManagement():
42 provided. 42 provided.
43 """ 43 """
44 44
45 if all([file_path, docs]) or \ 45 if all([file_path, docs]) or not any([file_path, docs]):
46 not any([file_path, docs]):
47 raise ValueError('Either `file_path` or `docs` must be specified.') 46 raise ValueError('Either `file_path` or `docs` must be specified.')
48 47
49 self.__check_environment() 48 self.__check_environment()
diff --git a/tox.ini b/tox.ini
index 5f1f07b..070a0d9 100644
--- a/tox.ini
+++ b/tox.ini
@@ -63,4 +63,8 @@ commands =
63commands = {posargs} 63commands = {posargs}
64 64
65[flake8] 65[flake8]
66ignore = E125,E251,W503 66filename = *.py
67show-source = true
68ignore =
69exclude=.venv,.git,.tox,build,dist,*lib/python*,*egg,tools,*.ini,*.po,*.pot
70max-complexity = 24