Exemplo n.º 1
0
 def updateSnapshots(self):
     if self.sid:
         self.comboSnapshots.clear()
         for sid in snapshots.iterSnapshots(self.config):
             self.comboSnapshots.addSnapshotID(sid)
             if sid == self.sid:
                 self.comboSnapshots.setCurrentSnapshotID(sid)
Exemplo n.º 2
0
def snapshotsListPath(args):
    """
    Command for printing a list of all snapshots pathes in current profile.

    Args:
        args (argparse.Namespace):
                        previously parsed arguments

    Raises:
        SystemExit:     0
    """
    force_stdout = setQuiet(args)
    cfg = getConfig(args)
    _mount(cfg)

    if args.quiet:
        msg = '{}'
    else:
        msg = 'SnapshotPath: {}'
    no_sids = True
    for sid in snapshots.iterSnapshots(cfg):
        print(msg.format(sid.path()), file=force_stdout)
        no_sids = False
    if no_sids:
        logger.error("There are no snapshots in '%s'" % cfg.get_profile_name())
    if not args.keep_mount:
        _umount(cfg)
    sys.exit(RETURN_OK)
Exemplo n.º 3
0
 def test_iter_snapshots(self):
     for i, sid in enumerate(snapshots.iterSnapshots(self.cfg)):
         self.assertIn(sid, [
             '20151219-040324-123', '20151219-030324-123',
             '20151219-020324-123', '20151219-010324-123'
         ])
         self.assertIsInstance(sid, snapshots.SID)
     self.assertEqual(i, 3)
Exemplo n.º 4
0
 def test_iter_snapshots(self):
     for i, sid in enumerate(snapshots.iterSnapshots(self.cfg)):
         self.assertIn(sid, ['20151219-040324-123',
                             '20151219-030324-123',
                             '20151219-020324-123',
                             '20151219-010324-123'])
         self.assertIsInstance(sid, snapshots.SID)
     self.assertEqual(i, 3)
Exemplo n.º 5
0
def snapshotsListPath(args):
    """
    Command for printing a list of all snapshots pathes in current profile.

    args:   argparse.ArgumentParser instance
    """
    force_stdout = setQuiet(args)
    cfg = getConfig(args)
    _mount(cfg)
    no_sids = True
    for sid in snapshots.iterSnapshots(cfg):
        print('SnapshotPath: %s' % sid.path(), file=force_stdout)
        no_sids = False
    if no_sids:
        logger.error("There are no snapshots in '%s'" % cfg.get_profile_name())
    if not args.keep_mount:
        _umount(cfg)
    sys.exit(RETURN_OK)
Exemplo n.º 6
0
def snapshotsListPath(args):
    """
    Command for printing a list of all snapshots pathes in current profile.

    args:   argparse.ArgumentParser instance
    """
    force_stdout = setQuiet(args)
    cfg = getConfig(args)
    _mount(cfg)
    no_sids = True
    for sid in snapshots.iterSnapshots(cfg):
        print('SnapshotPath: %s' % sid.path(), file=force_stdout)
        no_sids = False
    if no_sids:
        logger.error("There are no snapshots in '%s'" % cfg.get_profile_name())
    if not args.keep_mount:
        _umount(cfg)
    sys.exit(RETURN_OK)
Exemplo n.º 7
0
 def test_iterSnapshots(self):
     for item in snapshots.iterSnapshots(self.cfg):
         self.fail('got unexpected snapshot')
Exemplo n.º 8
0
 def test_iterSnapshots(self):
     for item in snapshots.iterSnapshots(self.cfg):
         self.fail('got unexpected snapshot')