Skip to content

Commit

Permalink
Apply fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Dec 3, 2020
1 parent 006f1dc commit f2e3fc4
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ See [https://github.com/camptocamp/c2cwsgiutils] for other parameters.
### Template engines

* `type`: can be `mako` or `shell`
* `data`: a dictionay of key/value to pass as a parameter to the template engine
* `data`: a dictionary of key/value to pass as a parameter to the template engine
* `environment_variables`: If `true`, take into account the process' environment variables
if not found in `data`. Only variables starting with a prefix listed in `SCM_ENV_PREFIXES`
(list separated by `:`) are allowed.
Expand Down
4 changes: 3 additions & 1 deletion acceptance_tests/acceptance/normal/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def what() -> bool:
if r.status_code == 200:
json = r.json()
if len(json["slaves"]) != 3:
raise Exception(f"Not seeing 3 slaves but {len(json['slaves'])}.",)
raise Exception(
f"Not seeing 3 slaves but {len(json['slaves'])}.",
)
for name, status in json["slaves"].items():
if name == "slave-others":
if set(status["sources"].keys()) != {"master"}:
Expand Down
1 change: 0 additions & 1 deletion acceptance_tests/acceptance/normal/test_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time

import pytest

from acceptance import get_hash, wait_sync


Expand Down
3 changes: 2 additions & 1 deletion app/shared_config_manager/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import os

import c2cwsgiutils.pyramid
from c2cwsgiutils.health_check import HealthCheck
import os
from pyramid.config import Configurator

from . import sources
Expand Down
3 changes: 2 additions & 1 deletion app/shared_config_manager/scripts/shared_config_slave.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

from c2cwsgiutils import setup_process

from shared_config_manager import slave_status # noqa: F401, pylint: disable=unused-import
from shared_config_manager import \
slave_status # noqa: F401, pylint: disable=unused-import
from shared_config_manager import sources

setup_process.init()
Expand Down
3 changes: 1 addition & 2 deletions app/shared_config_manager/sources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
from typing import Any, Dict, Mapping, Optional, Tuple

import yaml
from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPNotFound

from c2cwsgiutils import broadcast
from pyramid.httpexceptions import HTTPBadRequest, HTTPForbidden, HTTPNotFound

from . import base, git, mode, rclone, rsync

Expand Down
6 changes: 3 additions & 3 deletions app/shared_config_manager/sources/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ def _do_fetch(self):
while True:
try:
LOG.info("Doing a fetch of %s", self.get_id())
responce = requests.get(url, stream=True)
responce.raise_for_status()
response = requests.get(url, stream=True)
response.raise_for_status()
if os.path.exists(path):
shutil.rmtree(path)
os.makedirs(path, exist_ok=True)
Expand All @@ -106,7 +106,7 @@ def _do_fetch(self):
cwd=path,
stdin=subprocess.PIPE,
)
shutil.copyfileobj(responce.raw, tar.stdin) # type: ignore
shutil.copyfileobj(response.raw, tar.stdin) # type: ignore
tar.stdin.close() # type: ignore
assert tar.wait() == 0
return
Expand Down
4 changes: 2 additions & 2 deletions app/shared_config_manager/sources/rclone.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from .base import BaseSource

import os
import re

from .base import BaseSource


class RcloneSource(BaseSource):
def __init__(self, id_, config, is_master, default_key):
Expand Down
3 changes: 2 additions & 1 deletion app/shared_config_manager/template_engines/mako.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from .base import BaseEngine
import mako.template

from .base import BaseEngine


class MakoEngine(BaseEngine):
def __init__(self, source_id, config):
Expand Down
3 changes: 2 additions & 1 deletion app/tests/sources/test_git.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import os
import pytest
import subprocess
import tempfile

import pytest

from shared_config_manager import sources

TEMP_DIR = tempfile.gettempdir()
Expand Down
3 changes: 2 additions & 1 deletion app/tests/template_engines/conftest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import pytest
import shutil
from tempfile import mkdtemp

import pytest


@pytest.yield_fixture()
def temp_dir():
Expand Down
2 changes: 1 addition & 1 deletion app/tests/template_engines/test_mako.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pathlib
import os
import pathlib

from shared_config_manager import template_engines

Expand Down

0 comments on commit f2e3fc4

Please sign in to comment.