pep8
This commit is contained in:
parent
1fefd63c72
commit
4517880846
|
@ -93,12 +93,21 @@ def status(config, containers):
|
|||
|
||||
if container.volume_backup_enabled:
|
||||
for mount in container.filter_mounts():
|
||||
logger.info(' - volume: %s -> %s', mount.source, container.get_volume_backup_destination(mount, '/volumes'))
|
||||
logger.info(
|
||||
' - volume: %s -> %s',
|
||||
mount.source,
|
||||
container.get_volume_backup_destination(mount, '/volumes'),
|
||||
)
|
||||
|
||||
if container.database_backup_enabled:
|
||||
instance = container.instance
|
||||
ping = instance.ping()
|
||||
logger.info(' - %s (is_ready=%s) -> %s', instance.container_type, ping == 0, instance.backup_destination_path())
|
||||
logger.info(
|
||||
' - %s (is_ready=%s) -> %s',
|
||||
instance.container_type,
|
||||
ping == 0,
|
||||
instance.backup_destination_path(),
|
||||
)
|
||||
if ping != 0:
|
||||
logger.error("Database '%s' in service %s cannot be reached",
|
||||
instance.container_type, container.service_name)
|
||||
|
|
|
@ -72,7 +72,8 @@ class Container:
|
|||
@property
|
||||
def service_name(self) -> str:
|
||||
"""Name of the container/service"""
|
||||
return self.get_label('com.docker.compose.service', default='') or self.get_label('com.docker.swarm.service.name', default='')
|
||||
return self.get_label('com.docker.compose.service', default='') or \
|
||||
self.get_label('com.docker.swarm.service.name', default='')
|
||||
|
||||
@property
|
||||
def backup_process_label(self) -> str:
|
||||
|
|
|
@ -22,7 +22,7 @@ def setup(level: str = 'warning'):
|
|||
|
||||
ch = logging.StreamHandler(stream=sys.stdout)
|
||||
ch.setLevel(level)
|
||||
# ch.setFormatter(logging.Formatter(f'%(asctime)s - {HOSTNAME} - %(name)s - %(levelname)s - %(message)s'))
|
||||
# ch.setFormatter(logging.Formatter(f'%(asctime)s - {HOSTNAME} - %(levelname)s - %(message)s'))
|
||||
ch.setFormatter(logging.Formatter(f'%(asctime)s - %(levelname)s: %(message)s'))
|
||||
# ch.setFormatter(logging.Formatter('%(asctime)s - {HOSTNAME} - %(name)s - %(levelname)s - %(message)s'))
|
||||
# ch.setFormatter(logging.Formatter('%(asctime)s - {HOSTNAME} - %(levelname)s - %(message)s'))
|
||||
ch.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: %(message)s'))
|
||||
logger.addHandler(ch)
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
import os
|
||||
import logging
|
||||
from typing import List
|
||||
from typing import List, TYPE_CHECKING
|
||||
from contextlib import contextmanager
|
||||
import docker
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from restic_compose_backup.containers import Container
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
TRUE_VALUES = ['1', 'true', 'True', True, 1]
|
||||
|
|
Loading…
Reference in New Issue