
import os
from oslo_config import cfg


CONF = cfg.CONF

CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')


def set_defaults(conf):
    conf.set_default('connection', 'sqlite://', group='database')
    conf.set_default('sqlite_synchronous', False, group='database')
    conf.set_default('policy_file', 'karbor.tests.unit/policy.json',
                     group='oslo_policy')
    conf.set_default('policy_dirs', [], group='oslo_policy')
    conf.set_default('auth_strategy', 'noauth')
    conf.set_default('state_path', os.path.abspath(
        os.path.join(os.path.dirname(__file__), '..', '..', '..')))
    conf.set_default('provider_config_dir',
                     os.path.join(os.path.dirname(__file__), 'fake_providers'))


import os
from oslo_config import cfg


CONF = cfg.CONF

CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')
CONF.import_opt('provider_config_dir', 'karbor.services.protection.provider')


def set_defaults(conf):
    conf.set_default('connection', 'sqlite://', group='database')
    conf.set_default('sqlite_synchronous', False, group='database')
    conf.set_default('policy_file', 'karbor.tests.unit/policy.json',
                     group='oslo_policy')
    conf.set_default('policy_dirs', [], group='oslo_policy')
    conf.set_default('auth_strategy', 'noauth')
    conf.set_default('state_path', os.path.abspath(
        os.path.join(os.path.dirname(__file__), '..', '..', '..')))
    conf.set_default('provider_config_dir',
                     os.path.join(os.path.dirname(__file__), 'fake_providers'))

Fix loading 'provider_config_dir' opt error
Fix loading 'provider_config_dir' opt error

When run unit test using 'ostestr --pdb' command. it may get
an error that can not find the config opt 'provider_config_dir'.

Change-Id: Ibc1c693a1531c791ad434ff56ee349ba3afb3d63
Closes-Bug: #1649443

  
  import os
  from oslo_config import cfg
  
  
  CONF = cfg.CONF
  
  CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')
+ CONF.import_opt('provider_config_dir', 'karbor.services.protection.provider')
  
  
  def set_defaults(conf):
      conf.set_default('connection', 'sqlite://', group='database')
      conf.set_default('sqlite_synchronous', False, group='database')
      conf.set_default('policy_file', 'karbor.tests.unit/policy.json',
                       group='oslo_policy')
      conf.set_default('policy_dirs', [], group='oslo_policy')
      conf.set_default('auth_strategy', 'noauth')
      conf.set_default('state_path', os.path.abspath(
          os.path.join(os.path.dirname(__file__), '..', '..', '..')))
      conf.set_default('provider_config_dir',
                       os.path.join(os.path.dirname(__file__), 'fake_providers'))
  
Fix loading 'provider_config_dir' opt error
## Code Before:

import os
from oslo_config import cfg


CONF = cfg.CONF

CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')


def set_defaults(conf):
    conf.set_default('connection', 'sqlite://', group='database')
    conf.set_default('sqlite_synchronous', False, group='database')
    conf.set_default('policy_file', 'karbor.tests.unit/policy.json',
                     group='oslo_policy')
    conf.set_default('policy_dirs', [], group='oslo_policy')
    conf.set_default('auth_strategy', 'noauth')
    conf.set_default('state_path', os.path.abspath(
        os.path.join(os.path.dirname(__file__), '..', '..', '..')))
    conf.set_default('provider_config_dir',
                     os.path.join(os.path.dirname(__file__), 'fake_providers'))

## Instruction:
Fix loading 'provider_config_dir' opt error
## Code After:

import os
from oslo_config import cfg


CONF = cfg.CONF

CONF.import_opt('policy_file', 'karbor.policy', group='oslo_policy')
CONF.import_opt('provider_config_dir', 'karbor.services.protection.provider')


def set_defaults(conf):
    conf.set_default('connection', 'sqlite://', group='database')
    conf.set_default('sqlite_synchronous', False, group='database')
    conf.set_default('policy_file', 'karbor.tests.unit/policy.json',
                     group='oslo_policy')
    conf.set_default('policy_dirs', [], group='oslo_policy')
    conf.set_default('auth_strategy', 'noauth')
    conf.set_default('state_path', os.path.abspath(
        os.path.join(os.path.dirname(__file__), '..', '..', '..')))
    conf.set_default('provider_config_dir',
                     os.path.join(os.path.dirname(__file__), 'fake_providers'))
