示例#1
0
 def test_check_config_ignore(self):
     self.assertEqual(('https://example.org/auth/v1.0',
                      'username',
                      'password',
                      '10',
                       False),
                      c.check_config('examples/bu2sw_ignore_verify.conf'))
示例#2
0
 def test_check_config(self):
     self.assertEqual(('https://example.org/auth/v1.0',
                      'username',
                      'password',
                      '10',
                       True),
                      c.check_config('examples/bu2sw.conf'))
示例#3
0
def execute_swift_client(args):
    """Execute swift client.

    Argument:
        args: argument object
    """
    config_file = check_config_file(args.config)
    (auth_url, username, password, rotate_limit, verify, timeout,
     tenant_id) = config.check_config(config_file)
    if args.container:
        container_name = args.container
    else:
        container_name = utils.FQDN
    bkup = backup.Backup(auth_url,
                         username,
                         password,
                         rotate_limit=rotate_limit,
                         verify=verify,
                         timeout=timeout,
                         tenant_id=tenant_id,
                         container_name=container_name)
    if args.list:
        # listing backup data
        backup_l = bkup.retrieve_backup_data_list(args.verbose)
        utils.list_data(backup_l)
    elif args.path:
        # backup data to swift
        bkup.backup(args.path)
    elif args.stdin:
        # backup via stdin pipe
        if sys.version_info > (3, 0):
            # for python3
            bkup.backup_file(args.stdin, data=sys.stdin.buffer.raw)
        else:
            # for python2
            bkup.backup_file(args.stdin, data=sys.stdin)
    elif args.retrieve:
        # retrive backup data
        bkup.retrieve_backup_data(args.retrieve, args.output)
    elif args.delete:
        # delete backup data
        bkup.delete_backup_data(args.delete)
示例#4
0
def execute_swift_client(args):
    """Execute swift client.

    Argument:
        args: argument object
    """
    config_file = check_config_file(args.config)
    (auth_url, username, password, rotate_limit,
     verify, timeout, tenant_id) = config.check_config(config_file)
    if args.container:
        container_name = args.container
    else:
        container_name = utils.FQDN
    bkup = backup.Backup(auth_url, username, password,
                         rotate_limit=rotate_limit,
                         verify=verify,
                         timeout=timeout,
                         tenant_id=tenant_id,
                         container_name=container_name)
    if args.list:
        # listing backup data
        backup_l = bkup.retrieve_backup_data_list(args.verbose)
        utils.list_data(backup_l)
    elif args.path:
        # backup data to swift
        bkup.backup(args.path)
    elif args.stdin:
        # backup via stdin pipe
        if sys.version_info > (3, 0):
            # for python3
            bkup.backup_file(args.stdin, data=sys.stdin.buffer.raw)
        else:
            # for python2
            bkup.backup_file(args.stdin, data=sys.stdin)
    elif args.retrieve:
        # retrive backup data
        bkup.retrieve_backup_data(args.retrieve, args.output)
    elif args.delete:
        # delete backup data
        bkup.delete_backup_data(args.delete)
示例#5
0
 def test_check_config_ignore(self):
     self.assertEqual(('https://example.org/auth/v1.0', 'username',
                       'password', '10', False),
                      c.check_config('examples/bu2sw_ignore_verify.conf'))
示例#6
0
 def test_check_config(self):
     self.assertEqual(('https://example.org/auth/v1.0', 'username',
                       'password', '10', True),
                      c.check_config('examples/bu2sw.conf'))
示例#7
0
 def test_check_config(self):
     """ unit test for check_config """
     self.assertEqual(('https://example.org/auth/v1.0', 'username',
                       'password', 10, True, 5.0, None),
                      c.check_config('examples/bu2sw.conf'))
示例#8
0
 def test_check_config_timeout(self):
     """ unit test for check_config ignore case """
     self.assertEqual(('https://example.org/auth/v1.0', 'username',
                       'password', 10, True, 10.0, None),
                      c.check_config('examples/bu2sw_timeout.conf'))
示例#9
0
 def test_check_config_ignore(self):
     """ unit test for check_config ignore case """
     self.assertEqual(('https://example.org/auth/v1.0', 'username',
                       'password', 10, False, 5.0, None),
                      c.check_config('examples/bu2sw_ignore_verify.conf'))