# Path: snap/snapshottarget.py
# class SnapshotTarget:
#     """Abstract entity on which to perform and restore a snapshot"""
# 
#     # actual target backends snap implements (in the order which they are to execute)
#     BACKENDS = ['repos', 'packages', 'files', 'services']
# 
#     def backup(self, basedir):
#          '''Take a snapshot of the target
# 
#             @param - basedir - directory which to store snapshot data in'''
#          raise NotImplementedError()
# 
#     def restore(self, basedir):
#         '''Restore any package management files previously backed up
#            
#            @param - basedir - directory which to restore snapshot from'''
#         raise NotImplementedError()
# 
# Path: snap/exceptions.py
# class ArgError(SnapError):
#     """An illegal arguement to the system was specified or an invalid 
#        option set was detected in ConfigManager.verify_integrity()"""
# 
#     def __init__(self,message = ''):
#         SnapError.__init__(self, message)


import os
import os.path
import optparse, ConfigParser
import snap
from snap.options import *
from snap.snapshottarget import SnapshotTarget
from snap.exceptions import ArgError
            snap.config.options.mode = ConfigOptions.BACKUP
        if options.log_level:
            snap.config.options.log_level = options.log_level
        if options.outputformat != None:
            snap.config.options.outputformat = options.outputformat
        if options.snapfile != None:
            snap.config.options.snapfile = options.snapfile
        if options.encryption_password != None:
            snap.config.options.encryption_password = options.encryption_password
        for backend in SnapshotTarget.BACKENDS:
            val = getattr(options, backend)
            if val != None:
                if type(val) == str:
                    snap.config.options.target_backends[backend] = True
                    val = ConfigFile.string_to_array(val)
                    for include in val:
                        if include[0] == '!':
                            snap.config.options.target_excludes[backend].append(include[1:])
                        else:
                            snap.config.options.target_includes[backend].append(include)
                else:
                    snap.config.options.target_backends[backend] = val

    def verify_integrity(self):
        '''
        verify the integrity of the current option set

        @raises - ArgError if the options are invalid
        '''
        if snap.config.options.mode == None: # mode not specified

# Path: snap/snapshottarget.py
# class SnapshotTarget:
#     """Abstract entity on which to perform and restore a snapshot"""
# 
#     # actual target backends snap implements (in the order which they are to execute)
#     BACKENDS = ['repos', 'packages', 'files', 'services']
# 
#     def backup(self, basedir):
#          '''Take a snapshot of the target
# 
#             @param - basedir - directory which to store snapshot data in'''
#          raise NotImplementedError()
# 
#     def restore(self, basedir):
#         '''Restore any package management files previously backed up
#            
#            @param - basedir - directory which to restore snapshot from'''
#         raise NotImplementedError()
# 
# Path: snap/exceptions.py
# class ArgError(SnapError):
#     """An illegal arguement to the system was specified or an invalid 
#        option set was detected in ConfigManager.verify_integrity()"""
# 
#     def __init__(self,message = ''):
#         SnapError.__init__(self, message)


# Path: snap/config.py
import os
import os.path
import optparse, ConfigParser
import snap
from snap.options import *
from snap.snapshottarget import SnapshotTarget
from snap.exceptions import ArgError

            snap.config.options.mode = ConfigOptions.BACKUP
        if options.log_level:
            snap.config.options.log_level = options.log_level
        if options.outputformat != None:
            snap.config.options.outputformat = options.outputformat
        if options.snapfile != None:
            snap.config.options.snapfile = options.snapfile
        if options.encryption_password != None:
            snap.config.options.encryption_password = options.encryption_password
        for backend in SnapshotTarget.BACKENDS:
            val = getattr(options, backend)
            if val != None:
                if type(val) == str:
                    snap.config.options.target_backends[backend] = True
                    val = ConfigFile.string_to_array(val)
                    for include in val:
                        if include[0] == '!':
                            snap.config.options.target_excludes[backend].append(include[1:])
                        else:
                            snap.config.options.target_includes[backend].append(include)
                else:
                    snap.config.options.target_backends[backend] = val

    def verify_integrity(self):
        '''
        verify the integrity of the current option set

        @raises - ArgError if the options are invalid
        '''
        if snap.config.options.mode == None: # mode not specified

            raise snap.exceptions.ArgError("Must specify backup or restore")