Verified Commit bc08544c authored by Pilou's avatar Pilou
Browse files

Fix pyflakes error: f-string is missing placeholders

parent c87538ec
......@@ -122,7 +122,7 @@ class Enough(object):
'--exclude=group_vars/all/internal_network.yml',
f'{self.config_dir}/', f'{config_dir}/')
all_dir = f'{config_dir}/inventory/group_vars/all'
open(f'{all_dir}/internal_network.yml', 'w').write(textwrap.dedent(f"""\
open(f'{all_dir}/internal_network.yml', 'w').write(textwrap.dedent("""\
---
openstack_internal_network_prefix: "10.11.10"
openstack_internal_network_cidr: "10.11.10.0/24"
......
......@@ -125,7 +125,7 @@ class DotEnough(object):
@staticmethod
def _set_bind_service_group(services_pathname):
if not os.path.exists(services_pathname):
open(services_pathname, 'w').write(textwrap.dedent(f"""\
open(services_pathname, 'w').write(textwrap.dedent("""\
---
essential-service-group:
hosts:
......
......@@ -56,7 +56,7 @@ class GitLab(object):
return any([x['username'] == username for x in self.group_members(group)])
def is_self_member_of_group(self, group):
r = self.s.get(self.s.api + f'/user')
r = self.s.get(self.s.api + '/user')
r.raise_for_status()
user = r.json()
return self.is_member_of_group(group, user['username'])
......
......@@ -16,7 +16,7 @@ import sys
# Build paths inside the project like this: os.path.join(CONFIG_DIR, ...)
ENOUGH_DOMAIN = os.environ.get('ENOUGH_DOMAIN', 'enough.community')
ENOUGH_DOT = os.environ.get('ENOUGH_DOT', os.path.expanduser(f'~/.enough'))
ENOUGH_DOT = os.environ.get('ENOUGH_DOT', os.path.expanduser('~/.enough'))
if os.path.exists('setup.cfg'): # running from sources
if 'ENOUGH_DOMAIN' in os.environ:
......
......@@ -169,7 +169,7 @@ def test_delegate_dns(request, pytestconfig, host):
url = f"https://api.{domain}"
s = requests.Session()
data = {
"name": f"bar",
"name": "bar",
"ip": "5.6.7.8",
}
r = s.post(f'{url}/delegate-dns/', json=data, timeout=60, verify=certs)
......
......@@ -6,7 +6,7 @@ testinfra_hosts = ['ansible://icinga-host']
def test_bind(host):
domain = host.run("hostname -d").stdout.strip()
bind_host = host.get_host(f'ansible://bind-host',
bind_host = host.get_host('ansible://bind-host',
ansible_inventory=host.backend.ansible_inventory)
address = bind_host.ansible.get_variables()['ansible_host']
for h in ('ns1', 'bind', 'bind-host'):
......
......@@ -81,7 +81,7 @@ def pytest_sessionstart(session):
bind_host = e.service.service2group.get('bind')[0]
e.playbook.run([
'--private-key', f'{e.config_dir}/infrastructure_key',
'-i', f'playbooks/openvpn/inventory',
'-i', 'playbooks/openvpn/inventory',
f'--limit={vpn_host},{bind_host},localhost',
'playbooks/openvpn/conftest-playbook.yml',
])
......
......@@ -80,7 +80,7 @@ class Wazuh(object):
@retry.retry(AssertionError, tries=8)
def wait_for_syscheck():
current_last = self.get_syscheck_end(agent)
assert current_last is not None, f'syscheck in progress'
assert current_last is not None, 'syscheck in progress'
assert current_last > last, f'{current_last} > {last}'
wait_for_syscheck()
......
......@@ -26,7 +26,7 @@ def prepare_config_dir(domain, enough_dot_dir):
os.makedirs(all_dir)
shutil.copyfile('tests/clouds.yml', f'{all_dir}/clouds.yml')
shutil.copyfile('inventory/group_vars/all/provision.yml', f'{all_dir}/provision.yml')
open(f'{all_dir}/certificate.yml', 'w').write(textwrap.dedent(f"""\
open(f'{all_dir}/certificate.yml', 'w').write(textwrap.dedent("""\
---
certificate_authority: letsencrypt_staging
"""))
......@@ -92,7 +92,7 @@ class InfrastructureOpenStack(Infrastructure):
dotenough.set_bind_service_group()
shutil.copyfile('tests/clouds.yml', f'{self.all_dir}/clouds.yml')
shutil.copyfile('inventory/group_vars/all/provision.yml', f'{self.all_dir}/provision.yml')
open(f'{self.all_dir}/certificate.yml', 'w').write(textwrap.dedent(f"""\
open(f'{self.all_dir}/certificate.yml', 'w').write(textwrap.dedent("""\
---
certificate_authority: letsencrypt_staging
"""))
......@@ -137,7 +137,7 @@ class InfrastructureLibvirt(Infrastructure):
#
shutil.copyfile('tests/clouds.yml', f'{self.all_dir}/clouds.yml')
shutil.copyfile('inventory/group_vars/all/provision.yml', f'{self.all_dir}/provision.yml')
open(f'{self.all_dir}/certificate.yml', 'w').write(textwrap.dedent(f"""\
open(f'{self.all_dir}/certificate.yml', 'w').write(textwrap.dedent("""\
---
certificate_authority: ownca
"""))
......
......@@ -339,7 +339,7 @@ def test_volume_from_snapshot():
def test_host_from_snapshot(tmpdir):
e = create_enough(tmpdir, 'backup')
host = 'sample-host'
snapshot = f'2010-07-08-sample-volume'
snapshot = '2010-07-08-sample-volume'
assert e.host_from_snapshot(snapshot) == host
......@@ -421,7 +421,7 @@ def test_info_internal(tmpdir):
}))
f = f'{config_dir}/inventory/services.yml'
open(f, 'w').write(yaml.dump({
f'bind-service-group': {
'bind-service-group': {
'hosts': {
'some-host': None,
}
......
......@@ -77,7 +77,7 @@ class IcingaHelper(object):
if host:
url += f'/objects/hosts/{host}?attrs=name&attrs=state'
else:
url += f'/objects/hosts?attrs=name&attrs=state'
url += '/objects/hosts?attrs=name&attrs=state'
answer = requests.get(url, **self.connection_params())
answer.raise_for_status()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment