isort the repo

This commit is contained in:
Franzi 2023-02-05 17:30:58 +01:00
parent 429bc2a7c6
commit 4122a7ccf8
Signed by: kunsi
GPG key ID: 12E3D2136B818350
33 changed files with 36 additions and 32 deletions

View file

@ -1,6 +1,7 @@
repo.libs.tools.require_bundle(node, 'zfs') repo.libs.tools.require_bundle(node, 'zfs')
from os.path import join from os.path import join
from bundlewrap.metadata import metadata_to_json from bundlewrap.metadata import metadata_to_json
dataset = node.metadata.get('backup-server/zfs-base') dataset = node.metadata.get('backup-server/zfs-base')

View file

@ -1,4 +1,5 @@
from ipaddress import ip_network from ipaddress import ip_network
from bundlewrap.exceptions import NoSuchNode from bundlewrap.exceptions import NoSuchNode
from bundlewrap.metadata import atomic from bundlewrap.metadata import atomic

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from requests import get
from sys import argv, exit from sys import argv, exit
from requests import get
meshviewer_url = argv[1] meshviewer_url = argv[1]
node_id = argv[2] node_id = argv[2]
node = None node = None

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from requests import get
from sys import exit from sys import exit
from requests import get
SIPGATE_USER = '${node.metadata['icinga2']['sipgate_user']}' SIPGATE_USER = '${node.metadata['icinga2']['sipgate_user']}'
SIPGATE_PASS = '${node.metadata['icinga2']['sipgate_pass']}' SIPGATE_PASS = '${node.metadata['icinga2']['sipgate_pass']}'

View file

@ -1,12 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from concurrent.futures import ThreadPoolExecutor, as_completed from concurrent.futures import ThreadPoolExecutor, as_completed
from ipaddress import ip_address, IPv6Address from ipaddress import IPv6Address, ip_address
from subprocess import check_output from subprocess import check_output
from sys import argv, exit from sys import argv, exit
BLOCKLISTS = [ BLOCKLISTS = [
'0spam.fusionzero.com', '0spam.fusionzero.com',
'bl.mailspike.org', 'bl.mailspike.org',

View file

@ -4,10 +4,11 @@ import email.mime.text
import smtplib import smtplib
from argparse import ArgumentParser from argparse import ArgumentParser
from json import dumps from json import dumps
from requests import post
from subprocess import run from subprocess import run
from sys import argv from sys import argv
from requests import post
SIPGATE_USER='${node.metadata['icinga2']['sipgate_user']}' SIPGATE_USER='${node.metadata['icinga2']['sipgate_user']}'
SIPGATE_PASS='${node.metadata['icinga2']['sipgate_pass']}' SIPGATE_PASS='${node.metadata['icinga2']['sipgate_pass']}'

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from os import environ from os import environ
from requests import get, post
from sys import argv, exit from sys import argv, exit
from requests import get, post
SYNAPSE_MAX_ROOMS_TO_GET = 20000 SYNAPSE_MAX_ROOMS_TO_GET = 20000
SYNAPSE_HOST = 'http://[::1]:20080/' SYNAPSE_HOST = 'http://[::1]:20080/'

View file

@ -7,7 +7,6 @@ from time import sleep
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
BROKER_HOST = argv[1] BROKER_HOST = argv[1]
BROKER_TOPIC = argv[2] BROKER_TOPIC = argv[2]

View file

@ -1,6 +1,5 @@
from bundlewrap.metadata import atomic from bundlewrap.metadata import atomic
defaults = { defaults = {
'apt': { 'apt': {
'packages': { 'packages': {

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from requests import get
from sys import exit from sys import exit
from requests import get
api_key = '${api_key}' api_key = '${api_key}'
try: try:

View file

@ -4,7 +4,6 @@
from json import loads from json import loads
from subprocess import check_output from subprocess import check_output
queue_counts = {} queue_counts = {}
queue_json = check_output(['sudo', '/usr/sbin/postqueue', '-j']) queue_json = check_output(['sudo', '/usr/sbin/postqueue', '-j'])

View file

@ -1,4 +1,4 @@
from ipaddress import ip_address, IPv4Address, IPv6Address from ipaddress import IPv4Address, IPv6Address, ip_address
from bundlewrap.metadata import atomic from bundlewrap.metadata import atomic

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import requests
from sys import argv from sys import argv
import requests
INTERFACE = argv[1] INTERFACE = argv[1]
LOCAL_IP = argv[4] LOCAL_IP = argv[4]

View file

@ -1,9 +1,10 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import psycopg2
from configparser import ConfigParser from configparser import ConfigParser
from sys import argv, exit from sys import argv, exit
import psycopg2
def main(): def main():
try: try:

View file

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
from requests import get
from sys import argv, stderr from sys import argv, stderr
from requests import get
try: try:
r = get('http://127.0.0.1:11334/stat') r = get('http://127.0.0.1:11334/stat')
r.raise_for_status() r.raise_for_status()

View file

@ -1,7 +1,7 @@
#!/usr/bin/env python #!/usr/bin/env python
from subprocess import check_output
from json import loads from json import loads
from subprocess import check_output
from sys import stderr from sys import stderr
devices = check_output(['smartctl', '--scan']).decode().splitlines() devices = check_output(['smartctl', '--scan']).decode().splitlines()

View file

@ -2,8 +2,8 @@
#this is actually a python https requests query, its called check_http_wget cause it got replaced #this is actually a python https requests query, its called check_http_wget cause it got replaced
from sys import exit
from argparse import ArgumentParser from argparse import ArgumentParser
from sys import exit
import requests import requests

View file

@ -5,7 +5,6 @@ from argparse import ArgumentParser
from subprocess import check_output from subprocess import check_output
from tempfile import TemporaryFile from tempfile import TemporaryFile
check_filesystem_types = { check_filesystem_types = {
'ext2', 'ext2',
'ext3', 'ext3',

View file

@ -1,4 +1,4 @@
from os.path import join, exists from os.path import exists, join
files = { files = {
'/etc/bash.bashrc': { '/etc/bash.bashrc': {

View file

@ -3,7 +3,6 @@ from ipaddress import ip_network
from bundlewrap.exceptions import NoSuchNode from bundlewrap.exceptions import NoSuchNode
from bundlewrap.metadata import atomic from bundlewrap.metadata import atomic
defaults = { defaults = {
'apt': { 'apt': {
'packages': { 'packages': {

View file

@ -1,9 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import re
from subprocess import check_output from subprocess import check_output
from sys import argv, exit from sys import argv, exit
import re
def to_bytes(size): def to_bytes(size):

View file

@ -2,7 +2,6 @@
import re import re
from datetime import datetime from datetime import datetime
from json import loads from json import loads
from subprocess import check_call, check_output from subprocess import check_call, check_output

View file

@ -1,5 +1,4 @@
from json import dumps from json import dumps
#from os.path import join
from bundlewrap.metadata import MetadataJSONEncoder from bundlewrap.metadata import MetadataJSONEncoder

View file

@ -2,6 +2,7 @@ from bundlewrap.exceptions import BundleError
from bundlewrap.utils.text import bold, green, yellow from bundlewrap.utils.text import bold, green, yellow
from bundlewrap.utils.ui import io from bundlewrap.utils.ui import io
def test_node(repo, node, **kwargs): def test_node(repo, node, **kwargs):
if not node.has_bundle('backup-client'): if not node.has_bundle('backup-client'):
return return

View file

@ -4,6 +4,7 @@ from bundlewrap.exceptions import BundleError
from bundlewrap.utils.text import bold, green from bundlewrap.utils.text import bold, green
from bundlewrap.utils.ui import io from bundlewrap.utils.ui import io
def test_underscore_vs_dash(node, metadata, path=[]): def test_underscore_vs_dash(node, metadata, path=[]):
for k, v in metadata.items(): for k, v in metadata.items():
if not isinstance(k, str): if not isinstance(k, str):

View file

@ -1,4 +1,4 @@
from json import loads, dumps from json import dumps, loads
from bundlewrap.metadata import metadata_to_json from bundlewrap.metadata import metadata_to_json
from bundlewrap.utils import Fault from bundlewrap.utils import Fault

View file

@ -1,5 +1,5 @@
from ipaddress import IPv4Network, ip_network
from os.path import abspath, dirname, join from os.path import abspath, dirname, join
from ipaddress import ip_network, IPv4Network
REPO_PATH = dirname(dirname(abspath(__file__))) REPO_PATH = dirname(dirname(abspath(__file__)))

View file

@ -1,8 +1,11 @@
import base64 import base64
from nacl.public import PrivateKey
from nacl.encoding import Base64Encoder from nacl.encoding import Base64Encoder
from nacl.public import PrivateKey
from bundlewrap.utils import Fault from bundlewrap.utils import Fault
def gen_privkey(repo, identifier): def gen_privkey(repo, identifier):
return repo.vault.random_bytes_as_base64_for(identifier) return repo.vault.random_bytes_as_base64_for(identifier)

View file

@ -1,9 +1,10 @@
from ipaddress import ip_address, ip_network, IPv4Address, IPv4Network from ipaddress import IPv4Address, IPv4Network, ip_address, ip_network
from bundlewrap.exceptions import NoSuchGroup, NoSuchNode, BundleError from bundlewrap.exceptions import BundleError, NoSuchGroup, NoSuchNode
from bundlewrap.utils.text import bold, red from bundlewrap.utils.text import bold, red
from bundlewrap.utils.ui import io from bundlewrap.utils.ui import io
def resolve_identifier(repo, identifier): def resolve_identifier(repo, identifier):
""" """
Try to resolve an identifier (group or node). Return a set of ip Try to resolve an identifier (group or node). Return a set of ip

View file

@ -3,6 +3,7 @@ from os.path import join
from pathlib import Path from pathlib import Path
import bwpass import bwpass
from bundlewrap.metadata import atomic from bundlewrap.metadata import atomic
from bundlewrap.utils import error_context from bundlewrap.utils import error_context

View file

@ -5,7 +5,6 @@ from sys import argv
from bundlewrap.repo import Repository from bundlewrap.repo import Repository
path = environ.get('BW_REPO_PATH', '.') path = environ.get('BW_REPO_PATH', '.')
repo = Repository(path) repo = Repository(path)

View file

@ -5,7 +5,6 @@ from sys import argv
from bundlewrap.repo import Repository from bundlewrap.repo import Repository
from bundlewrap.utils.dicts import merge_dict from bundlewrap.utils.dicts import merge_dict
path = environ.get('BW_REPO_PATH', '.') path = environ.get('BW_REPO_PATH', '.')
repo = Repository(path) repo = Repository(path)

View file

@ -2,10 +2,9 @@
from os import environ from os import environ
from sys import argv from sys import argv
from bundlewrap.exceptions import FaultUnavailable
from bundlewrap.repo import Repository from bundlewrap.repo import Repository
from bundlewrap.utils import Fault from bundlewrap.utils import Fault
from bundlewrap.exceptions import FaultUnavailable
path = environ.get('BW_REPO_PATH', '.') path = environ.get('BW_REPO_PATH', '.')
repo = Repository(path) repo = Repository(path)