Exemple #1
0
    def __init__(self, backup_extract_path, limits=[], rollback=True, simulate=False):
        extras_path = backup_extract_path + backup.ExtrasPaths.PATH
        if not isdir(extras_path):
            raise self.Error("illegal backup_extract_path: can't find '%s'" % extras_path)

        if simulate:
            rollback = False

        self.simulate = simulate
        self.rollback = Rollback.create() if rollback else None
        self.extras = backup.ExtrasPaths(extras_path)
        self.limits = conf.Limits(limits)
        self.backup_extract_path = backup_extract_path
Exemple #2
0
    def __init__(self, backup_extract_path, limits=[], rollback=True, simulate=False):
        self.extras = backup.ExtrasPaths(backup_extract_path)
        if not isdir(self.extras.path):
            raise self.Error("illegal backup_extract_path: can't find '%s'" % self.extras.path)

        if simulate:
            rollback = False

        self.conf = AttrDict(simplejson.loads(file(self.extras.backup_conf).read())) \
                    if exists(self.extras.backup_conf) else None

        self.simulate = simulate
        self.rollback = Rollback.create() if rollback else None
        self.limits = conf.Limits(limits)
        self.backup_extract_path = backup_extract_path
Exemple #3
0
    def __init__(self,
                 backup_extract_path,
                 limits=[],
                 rollback=True,
                 simulate=False):
        self.extras = backup.ExtrasPaths(backup_extract_path)
        if not isdir(self.extras.path):
            raise self.Error("illegal backup_extract_path: can't find '%s'" %
                             self.extras.path)

        if simulate:
            rollback = False

        self.conf = AttrDict(simplejson.loads(file(self.extras.backup_conf).read())) \
                    if exists(self.extras.backup_conf) else None

        self.simulate = simulate
        self.rollback = Rollback.create() if rollback else None
        self.limits = conf.Limits(limits)
        self.backup_extract_path = backup_extract_path
                                       ['force', 'help'])
    except getopt.GetoptError, e:
        usage(e)

    opt_force = False
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        if opt == '--force':
            opt_force = True

    if args:
        usage()

    try:
        rollback = Rollback()
    except Rollback.Error:
        fatal("nothing to rollback")

    if not opt_force:
        print "DATA LOSS WARNING: this will rollback your system to the pre-restore"
        print "snapshot from " + rollback.timestamp.ctime()
        print

        while True:
            answer = raw_input("Is this really what you want? [yes/no] ")
            if answer:
                break

        if answer.lower() != "yes":
            print "You didn't answer 'yes'. Aborting!"
        opts, args = getopt.gnu_getopt(sys.argv[1:], 'h', ['force', 'help'])
    except getopt.GetoptError, e:
        usage(e)

    opt_force = False
    for opt, val in opts:
        if opt in ('-h', '--help'):
            usage()
        if opt == '--force':
            opt_force = True

    if args:
        usage()

    try:
        rollback = Rollback()
    except Rollback.Error:
        fatal("nothing to rollback")

    if not opt_force:
        print "DATA LOSS WARNING: this will rollback your system to the pre-restore"
        print "snapshot from " + rollback.timestamp.ctime()
        print

        while True:
            answer = raw_input("Is this really what you want? [yes/no] ")
            if answer:
                break

        if answer.lower() != "yes":
            print "You didn't answer 'yes'. Aborting!"