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 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.3) 
29  # Project  : Cedar Backup, release 2 
30  # Revision : $Id: initialize.py 742 2007-03-25 17:18:41Z pronovic $ 
31  # Purpose  : Implements the standard 'initialize' action. 
32  # 
33  # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # 
34   
35  ######################################################################## 
36  # Module documentation 
37  ######################################################################## 
38   
39  """ 
40  Implements the standard 'initialize' action. 
41  @sort: executeInitialize 
42  @author: Kenneth J. Pronovici <pronovic@ieee.org> 
43  """ 
44   
45   
46  ######################################################################## 
47  # Imported modules 
48  ######################################################################## 
49   
50  # System modules 
51  import logging 
52   
53  # Cedar Backup modules 
54  from CedarBackup2.actions.util import initializeMediaState 
55   
56   
57  ######################################################################## 
58  # Module-wide constants and variables 
59  ######################################################################## 
60   
61  logger = logging.getLogger("CedarBackup2.log.actions.initialize") 
62   
63   
64  ######################################################################## 
65  # Public functions 
66  ######################################################################## 
67   
68  ############################### 
69  # executeInitialize() function 
70  ############################### 
71   
72 -def executeInitialize(configPath, options, config):
73 """ 74 Executes the initialize action. 75 76 The initialize action initializes the media currently in the writer 77 device so that Cedar Backup can recognize it later. This is an optional 78 step; it's only required if checkMedia is set on the store configuration. 79 80 @param configPath: Path to configuration file on disk. 81 @type configPath: String representing a path on disk. 82 83 @param options: Program command-line options. 84 @type options: Options object. 85 86 @param config: Program configuration. 87 @type config: Config object. 88 """ 89 logger.debug("Executing the 'initialize' action.") 90 if config.options is None or config.store is None: 91 raise ValueError("Store configuration is not properly filled in.") 92 initializeMediaState(config) 93 logger.info("Executed the 'initialize' action successfully.")
94