CedarBackup2.actions.initialize

Package CedarBackup2 :: Package actions :: Module initialize |
[hide private]
[frames] | no frames]

# Source Code for Module CedarBackup2.actions.initialize

     1  # -*- coding: iso-8859-1 -*-
     2  # vim: set ft=python ts=3 sw=3 expandtab:
     3  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
     4  #
     5  #              C E D A R
     6  #          S O L U T I O N S       "Software done right."
     7  #           S O F T W A R E
     8  #
     9  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    10  #
    11  # Copyright (c) 2007,2010 Kenneth J. Pronovici.
    12  # All rights reserved.
    13  #
    14  # This program is free software; you can redistribute it and/or
    15  # modify it under the terms of the GNU General Public License,
    16  # Version 2, as published by the Free Software Foundation.
    17  #
    18  # This program is distributed in the hope that it will be useful,
    19  # but WITHOUT ANY WARRANTY; without even the implied warranty of
    20  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    21  #
    22  # Copies of the GNU General Public License are available from
    23  # the Free Software Foundation website, http://www.gnu.org/.
    24  #
    25  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    26  #
    27  # Author   : Kenneth J. Pronovici <pronovic@ieee.org>
    28  # Language : Python 2 (>= 2.7)
    29  # Project  : Cedar Backup, release 2
    30  # Purpose  : Implements the standard 'initialize' action.
    31  #
    32  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
    33
    34  ########################################################################
    35  # Module documentation
    36  ########################################################################
    37
    38  """
    39  Implements the standard 'initialize' action.
    40  @sort: executeInitialize
    41  @author: Kenneth J. Pronovici <pronovic@ieee.org>
    42  """
    43
    44
    45  ########################################################################
    46  # Imported modules
    47  ########################################################################
    48
    49  # System modules
    50  import logging
    51
    52  # Cedar Backup modules
    53  from CedarBackup2.actions.util import initializeMediaState
    54
    55
    56  ########################################################################
    57  # Module-wide constants and variables
    58  ########################################################################
    59
    60  logger = logging.getLogger("CedarBackup2.log.actions.initialize")
    61
    62
    63  ########################################################################
    64  # Public functions
    65  ########################################################################
    66
    67  ###############################
    68  # executeInitialize() function
    69  ###############################
    70
    71 -def executeInitialize(configPath, options, config):
    72     """
    73     Executes the initialize action.
    74
    75     The initialize action initializes the media currently in the writer
    76     device so that Cedar Backup can recognize it later.  This is an optional
    77     step; it's only required if checkMedia is set on the store configuration.
    78
    79     @param configPath: Path to configuration file on disk.
    80     @type configPath: String representing a path on disk.
    81
    82     @param options: Program command-line options.
    83     @type options: Options object.
    84
    85     @param config: Program configuration.
    86     @type config: Config object.
    87     """
    88     logger.debug("Executing the 'initialize' action.")
    89     if config.options is None or config.store is None:
    90        raise ValueError("Store configuration is not properly filled in.")
    91     initializeMediaState(config)
    92     logger.info("Executed the 'initialize' action successfully.")
    93