How to use the freezer.utils.winutils.is_windows function in freezer

To help you get started, we’ve selected a few freezer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github openstack / freezer / freezer / engine / osbrick / osbrick.py View on Github external
def __init__(self, storage, **kwargs):
        super(OsbrickEngine, self).__init__(storage=storage)
        self.client = client_manager.get_client_manager(CONF)
        self.cinder = self.client.create_cinder()
        self.volume_info = None

        self.compression_algo = kwargs.get('compression')
        self.encrypt_pass_file = kwargs.get('encrypt_key')
        self.dereference_symlink = kwargs.get('symlinks')
        self.exclude = kwargs.get('exclude')
        self.storage = storage
        self.is_windows = winutils.is_windows()
        self.dry_run = kwargs.get('dry_run', False)
        self.max_segment_size = kwargs.get('max_segment_size')
github openstack / freezer / freezer / utils / utils.py View on Github external
def get_executable_path(binary):
    """
    This function returns the executable path of a given binary
    if it is found in the system.
    :param binary:
    :type binary: str
    :rtype: str
    :return: Absolute Path to the executable file
    """
    from freezer.utils import winutils
    if winutils.is_windows():
        path_to_binaries = os.path.dirname(os.path.abspath(__file__))
        return '{0}\\bin\\{1}.exe'.format(path_to_binaries, binary)

    elif is_bsd():
        return (distspawn.find_executable(binary) or
                distspawn.find_executable(binary, path=':'.join(sys.path)))
    else:
        return distspawn.find_executable(binary)
github openstack / freezer / freezer / engine / rsyncv2 / rsyncv2.py View on Github external
def __init__(self, **kwargs):
        self.compression_algo = kwargs.get('compression')
        self.encrypt_pass_file = kwargs.get('encrypt_key', None)
        self.dereference_symlink = kwargs.get('symlinks')
        self.exclude = kwargs.get('exclude')
        self.storage = kwargs.get('storage')
        self.is_windows = winutils.is_windows()
        self.dry_run = kwargs.get('dry_run', False)
        self.max_segment_size = kwargs.get('max_segment_size')
        self.rsync_block_size = kwargs.get('rsync_block_size')
        self.fixed_blocks = 0
        self.modified_blocks = 0
        super(Rsyncv2Engine, self).__init__(storage=kwargs.get('storage'))
github openstack / freezer / freezer / utils / utils.py View on Github external
def openssl_path():
    from freezer.utils import winutils
    if winutils.is_windows():
        return 'openssl'
    else:
        return find_executable('openssl')
github openstack / freezer / freezer / utils / utils.py View on Github external
def get_executable_path(binary):
    """
    This function returns the executable path of a given binary
    if it is found in the system.
    :param binary:
    :type binary: str
    :rtype: str
    :return: Absolute Path to the executable file
    """
    from freezer.utils import winutils
    if winutils.is_windows():
        path_to_binaries = os.path.dirname(os.path.abspath(__file__))
        return '{0}\\bin\\{1}.exe'.format(path_to_binaries, binary)

    elif is_bsd():
        return (distspawn.find_executable(binary) or
                distspawn.find_executable(binary, path=':'.join(sys.path)))
    else:
        return distspawn.find_executable(binary)
github openstack / freezer / freezer / snapshot / snapshot.py View on Github external
def snapshot_create(backup_opt_dict):
    """
    Calls the code to take fs snapshots, depending on the platform

    :param backup_opt_dict:
    :return: boolean value, True if snapshot has been taken, false otherwise
    """
    if not backup_opt_dict.snapshot:
        return False

    if winutils.is_windows():
        if backup_opt_dict.snapshot:
            # Create a shadow copy.
            backup_opt_dict.shadow_path, backup_opt_dict.shadow = \
                vss.vss_create_shadow_copy(backup_opt_dict.windows_volume)

            backup_opt_dict.path_to_backup = winutils.use_shadow(
                backup_opt_dict.path_to_backup,
                backup_opt_dict.windows_volume)
            return True
        return False
    else:
        return lvm.lvm_snap(backup_opt_dict)
github openstack / freezer / freezer / common / config.py View on Github external
# If we have provided --proxy then overwrite the system HTTP_PROXY and
    # HTTPS_PROXY
    if backup_args.proxy:
        utils.alter_proxy(backup_args.proxy)

    # MySQLdb object
    backup_args.__dict__['mysql_db_inst'] = ''
    backup_args.__dict__['storages'] = None
    if conf and conf.storages:
        backup_args.__dict__['storages'] = conf.storages

    # Windows volume
    backup_args.__dict__['shadow'] = ''
    backup_args.__dict__['shadow_path'] = ''
    backup_args.__dict__['file_name'] = ''
    if winutils.is_windows():
        if backup_args.path_to_backup:
            backup_args.__dict__['windows_volume'] = \
                backup_args.path_to_backup[:3]

    backup_media = 'fs'
    if backup_args.cinder_vol_id or backup_args.cinder_vol_name:
        backup_media = 'cinder'
    elif backup_args.cindernative_vol_id or backup_args.cindernative_backup_id:
        backup_media = 'cindernative'
    elif backup_args.engine_name == 'nova' and (backup_args.project_id or
                                                backup_args.nova_inst_id or
                                                backup_args.nova_inst_name):
        backup_media = 'nova'
    elif backup_args.engine_name == 'glance':
        if (backup_args.project_id or backup_args.glance_image_id or
                backup_args.glance_image_name or
github openstack / freezer / freezer / scheduler / arguments.py View on Github external
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.


import os
import sys

from freezer import __version__ as FREEZER_VERSION
from freezer.utils import winutils
from oslo_config import cfg
from oslo_log import log

CONF = cfg.CONF

if winutils.is_windows():
    DEFAULT_FREEZER_SCHEDULER_CONF_D = r'C:\.freezer\scheduler\conf.d'
else:
    DEFAULT_FREEZER_SCHEDULER_CONF_D = '/etc/freezer/scheduler/conf.d'


def add_filter():

    class NoLogFilter(log.logging.Filter):
        def filter(self, record):
            return False

    log_filter = NoLogFilter()
    log.logging.getLogger("apscheduler.scheduler").\
        addFilter(log_filter)
    log.logging.getLogger("apscheduler.executors.default").\
        addFilter(log_filter)