예제 #1
0
 def test_register_auth_opts(self):
     keystone.register_auth_opts(TESTGROUP)
     auth_opts = ['auth_type', 'auth_section']
     sess_opts = ['certfile', 'keyfile', 'insecure', 'timeout', 'cafile']
     for o in auth_opts + sess_opts:
         self.assertIn(o, self.cfg.conf[TESTGROUP])
     self.assertEqual('password', self.cfg.conf[TESTGROUP]['auth_type'])
예제 #2
0
 def test_register_auth_opts(self):
     keystone.register_auth_opts(TESTGROUP)
     auth_opts = ['auth_type', 'auth_section']
     sess_opts = ['certfile', 'keyfile', 'insecure', 'timeout', 'cafile']
     for o in auth_opts + sess_opts:
         self.assertIn(o, self.cfg.conf[TESTGROUP])
     self.assertEqual('password', self.cfg.conf[TESTGROUP]['auth_type'])
예제 #3
0
 def test_get_session(self, auth_mock):
     keystone.register_auth_opts(TESTGROUP, 'fake-service')
     self.cfg.config(group=TESTGROUP, cafile='/path/to/ca/file')
     auth1 = mock.Mock()
     auth_mock.return_value = auth1
     sess = keystone.get_session(TESTGROUP)
     self.assertEqual('/path/to/ca/file', sess.verify)
     self.assertEqual(auth1, sess.auth)
예제 #4
0
 def test_get_session(self, auth_mock):
     keystone.register_auth_opts(TESTGROUP)
     self.cfg.config(group=TESTGROUP,
                     cafile='/path/to/ca/file')
     auth1 = mock.Mock()
     auth_mock.return_value = auth1
     sess = keystone.get_session(TESTGROUP)
     self.assertEqual('/path/to/ca/file', sess.verify)
     self.assertEqual(auth1, sess.auth)
예제 #5
0
# for the backward-compat case.
LEGACY_OPTS = [
    cfg.StrOpt('username',
               default='',
               help=_('User name for accessing Swift API.')),
    cfg.StrOpt('password',
               default='',
               help=_('Password for accessing Swift API.'),
               secret=True),
    cfg.StrOpt('tenant_name',
               default='',
               help=_('Tenant name for accessing Swift API.')),
]

CONF.register_opts(SWIFT_OPTS, group=SWIFT_GROUP)
keystone.register_auth_opts(SWIFT_GROUP)

OBJECT_NAME_PREFIX = 'inspector_data'
SWIFT_SESSION = None
LEGACY_MAP = {
    'auth_url': 'os_auth_url',
    'username': '******',
    'password': '******',
    'tenant_name': 'tenant_name',
}


def reset_swift_session():
    """Reset the global session variable.

    Mostly useful for unit tests.
예제 #6
0
               help=_('Ironic service type.')),
    cfg.StrOpt('os_endpoint_type',
               default='internalURL',
               help=_('Ironic endpoint type.')),
    cfg.IntOpt('retry_interval',
               default=2,
               help=_('Interval between retries in case of conflict error '
                      '(HTTP 409).')),
    cfg.IntOpt('max_retries',
               default=30,
               help=_('Maximum number of retries in case of conflict error '
                      '(HTTP 409).')),
]

CONF.register_opts(IRONIC_OPTS, group=IRONIC_GROUP)
keystone.register_auth_opts(IRONIC_GROUP)

IRONIC_SESSION = None


class NotFound(utils.Error):
    """Node not found in Ironic."""
    def __init__(self, node_ident, code=404, *args, **kwargs):
        msg = _('Node %s was not found in Ironic') % node_ident
        super(NotFound, self).__init__(msg, code, *args, **kwargs)


def reset_ironic_session():
    """Reset the global session variable.

    Mostly useful for unit tests.
예제 #7
0
def register_opts(conf):
    conf.register_opts(_OPTS, IRONIC_GROUP)
    keystone.register_auth_opts(IRONIC_GROUP, SERVICE_TYPE)
예제 #8
0
    cfg.StrOpt('os_endpoint_type',
               default='internalURL',
               help=_('Ironic endpoint type.')),
    cfg.IntOpt('retry_interval',
               default=2,
               help=_('Interval between retries in case of conflict error '
                      '(HTTP 409).')),
    cfg.IntOpt('max_retries',
               default=30,
               help=_('Maximum number of retries in case of conflict error '
                      '(HTTP 409).')),
]


CONF.register_opts(IRONIC_OPTS, group=IRONIC_GROUP)
keystone.register_auth_opts(IRONIC_GROUP)

IRONIC_SESSION = None
LEGACY_MAP = {
    'auth_url': 'os_auth_url',
    'username': '******',
    'password': '******',
    'tenant_name': 'os_tenant_name'
}


class NotFound(utils.Error):
    """Node not found in Ironic."""

    def __init__(self, node_ident, code=404, *args, **kwargs):
        msg = _('Node %s was not found in Ironic') % node_ident
예제 #9
0
def register_opts(conf):
    conf.register_opts(_OPTS, SWIFT_GROUP)
    keystone.register_auth_opts(SWIFT_GROUP, SERVICE_TYPE)
예제 #10
0
                      'object).')),
    cfg.StrOpt('container',
               default='ironic-inspector',
               help=_('Default Swift container to use when creating '
                      'objects.')),
    cfg.StrOpt('os_service_type',
               default='object-store',
               help=_('Swift service type.')),
    cfg.StrOpt('os_endpoint_type',
               default='internalURL',
               help=_('Swift endpoint type.')),
    cfg.StrOpt('os_region', help=_('Keystone region to get endpoint for.')),
]

CONF.register_opts(SWIFT_OPTS, group=SWIFT_GROUP)
keystone.register_auth_opts(SWIFT_GROUP)

OBJECT_NAME_PREFIX = 'inspector_data'
SWIFT_SESSION = None


def reset_swift_session():
    """Reset the global session variable.

    Mostly useful for unit tests.
    """
    global SWIFT_SESSION
    SWIFT_SESSION = None


class SwiftAPI(object):
예제 #11
0
def register_opts(conf):
    keystone.register_auth_opts('service_catalog', 'baremetal-introspection')
예제 #12
0
def register_opts(conf):
    conf.register_opts(_OPTS, SWIFT_GROUP)
    keystone.register_auth_opts(SWIFT_GROUP, SERVICE_TYPE)
예제 #13
0
def register_opts(conf):
    conf.register_opts(_OPTS, IRONIC_GROUP)
    keystone.register_auth_opts(IRONIC_GROUP, SERVICE_TYPE)