Exemple #1
0
def fixture_metadata(
    owner=FILE_OWNER, group=FILE_GROUP, permissions=FILE_PERMISSIONS,
    binary=FILE_IS_BINARY
):
    return FileMetadata(
        FILE_TYPE_CODE, FILE_PATH, owner, group, permissions, binary
    )
Exemple #2
0
def _for_pcs_known_hosts() -> FileMetadata:
    return FileMetadata(
        file_type_code=code.PCS_KNOWN_HOSTS,
        path=settings.pcsd_known_hosts_location,
        owner_user_name="root",
        owner_group_name="root",
        permissions=0o600,
        is_binary=False,
    )
Exemple #3
0
def _for_pcs_dr_config() -> FileMetadata:
    return FileMetadata(
        file_type_code=code.PCS_DR_CONFIG,
        path=settings.pcsd_dr_config_location,
        owner_user_name="root",
        owner_group_name="root",
        permissions=0o600,
        is_binary=False,
    )
Exemple #4
0
def _for_pacemaker_authkey() -> FileMetadata:
    return FileMetadata(
        file_type_code=code.PACEMAKER_AUTHKEY,
        path=settings.pacemaker_authkey_file,
        owner_user_name=settings.pacemaker_uname,
        owner_group_name=settings.pacemaker_gname,
        permissions=0o400,
        is_binary=True,
    )
Exemple #5
0
def _for_corosync_conf() -> FileMetadata:
    return FileMetadata(
        file_type_code=code.COROSYNC_CONF,
        path=settings.corosync_conf_file,
        owner_user_name="root",
        owner_group_name="root",
        permissions=0o644,
        is_binary=False,
    )
Exemple #6
0
def _for_booth_config(filename: str) -> FileMetadata:
    return FileMetadata(
        # The filename is expected to be complete (i.e. booth.conf) and verified
        # (i.e. no slashes in it). The caller is responsible for doing both.
        file_type_code=code.BOOTH_CONFIG,
        path=os.path.join(settings.booth_config_dir, filename),
        owner_user_name="root",
        owner_group_name="root",
        permissions=0o644,
        is_binary=False,
    )
Exemple #7
0
def _for_booth_key(filename: str) -> FileMetadata:
    return FileMetadata(
        # The filename is expected to be complete (i.e. booth.key) and verified
        # (i.e. no slashes in it). The caller is responsible for doing both.
        file_type_code=code.BOOTH_KEY,
        path=os.path.join(settings.booth_config_dir, filename),
        owner_user_name=settings.pacemaker_uname,
        owner_group_name=settings.pacemaker_gname,
        permissions=settings.booth_authkey_file_mode,
        is_binary=True,
    )
Exemple #8
0
import os.path

from pcs import settings
from pcs.common import file_type_codes as code
from pcs.common.file import FileMetadata

_metadata = {
    code.BOOTH_CONFIG:
    lambda filename: FileMetadata(
        # The filename is expected to be complete (i.e. booth.conf) and verified
        # (i.e. no slashes in it). The caller is responsible for doing both.
        file_type_code=code.BOOTH_CONFIG,
        path=os.path.join(settings.booth_config_dir, filename),
        owner_user_name="root",
        owner_group_name="root",
        permissions=0o644,
        is_binary=False,
    ),
    code.BOOTH_KEY:
    lambda filename: FileMetadata(
        # The filename is expected to be complete (i.e. booth.key) and verified
        # (i.e. no slashes in it). The caller is responsible for doing both.
        file_type_code=code.BOOTH_KEY,
        path=os.path.join(settings.booth_config_dir, filename),
        owner_user_name=settings.pacemaker_uname,
        owner_group_name=settings.pacemaker_gname,
        permissions=settings.booth_authkey_file_mode,
        is_binary=True,
    ),
    code.COROSYNC_CONF:
    lambda: FileMetadata(
Exemple #9
0
import os.path

from pcs.common import file_type_codes as code
from pcs.common.file import FileMetadata

_metadata = {
    code.BOOTH_CONFIG: lambda path: FileMetadata(
        file_type_code=code.BOOTH_CONFIG,
        path=path,
        owner_user_name=None,
        owner_group_name=None,
        permissions=None,
        is_binary=False,
    ),
    code.BOOTH_KEY: lambda path: FileMetadata(
        file_type_code=code.BOOTH_KEY,
        path=path,
        owner_user_name=None,
        owner_group_name=None,
        permissions=0o600,
        is_binary=True,
    ),
    code.COROSYNC_CONF: lambda path: FileMetadata(
        file_type_code=code.COROSYNC_CONF,
        path=path,
        owner_user_name=None,
        owner_group_name=None,
        permissions=0o644,
        is_binary=False,
    ),
    code.PCS_KNOWN_HOSTS: lambda: FileMetadata(