Merge "Add --os-interface and --os-region-name options"
This commit is contained in:
commit
dd72283e1e
@ -158,3 +158,14 @@ def add_global_identity_args(parser):
|
||||
'--os-access-info', dest='access_info', metavar='ACCESS_INFO',
|
||||
default=utils.env('OS_ACCESS_INFO'),
|
||||
help=_('Access info, defaults to env[OS_ACCESS_INFO]'))
|
||||
|
||||
parser.add_argument(
|
||||
'--os-interface', dest='interface', metavar='INTERFACE',
|
||||
default=utils.env('OS_INTERFACE', default='internal'),
|
||||
help=_('API Interface to use [public, internal, admin]'
|
||||
', defaults to env[OS_INTERFACE]'))
|
||||
|
||||
parser.add_argument(
|
||||
'--os-region-name', dest='region_name', metavar='REGION_NAME',
|
||||
default=utils.env('OS_REGION_NAME'),
|
||||
help=_('Region of the cloud to use, defaults to env[OS_REGION_NAME]'))
|
||||
|
@ -18,12 +18,13 @@ from osc_lib import utils
|
||||
|
||||
DEFAULT_HA_API_VERSION = '1'
|
||||
API_VERSION_OPTION = 'os_ha_api_version'
|
||||
API_NAME = 'ha'
|
||||
|
||||
|
||||
def make_client(instance):
|
||||
"""Returns a ha proxy"""
|
||||
conn = connection.Connection(session=instance.session)
|
||||
"""Returns a instance_ha proxy"""
|
||||
conn = connection.Connection(session=instance.session,
|
||||
interface=instance.interface,
|
||||
region_name=instance.region_name)
|
||||
return conn.instance_ha
|
||||
|
||||
|
||||
|
@ -111,6 +111,8 @@ class MasakariShell(object):
|
||||
'verify': args.verify,
|
||||
'token': args.token,
|
||||
'trust_id': args.trust_id,
|
||||
'interface': args.interface,
|
||||
'region_name': args.region_name,
|
||||
}
|
||||
|
||||
return masakari_client.Client(api_ver, user_agent=USER_AGENT, **kwargs)
|
||||
|
@ -41,7 +41,9 @@ class TestCliArgs(testtools.TestCase):
|
||||
'--os-password',
|
||||
'--os-trust-id',
|
||||
'--os-token',
|
||||
'--os-access-info'
|
||||
'--os-access-info',
|
||||
'--os-interface',
|
||||
'--os-region-name'
|
||||
]
|
||||
|
||||
options = [arg[0][0] for arg in parser.add_argument.call_args_list]
|
||||
|
@ -59,13 +59,17 @@ class TestV1Client(base.TestCase):
|
||||
fake_user_domain_id = 'fake_user_domain_id'
|
||||
fake_project_name = 'fake_project_name'
|
||||
fake_project_domain_id = 'fake_project_domain_id'
|
||||
fake_interface = 'fake_interface'
|
||||
fake_region_name = 'fake_region_name'
|
||||
|
||||
res = mc.Client(auth_url=fake_auth_url,
|
||||
username=fake_username,
|
||||
password=fake_password,
|
||||
user_domain_id=fake_user_domain_id,
|
||||
project_name=fake_project_name,
|
||||
project_domain_id=fake_project_domain_id)
|
||||
project_domain_id=fake_project_domain_id,
|
||||
interface=fake_interface,
|
||||
region_name=fake_region_name)
|
||||
|
||||
self.assertEqual(self.conn.instance_ha, res.service)
|
||||
mock_password.assert_called_once_with(
|
||||
@ -76,4 +80,6 @@ class TestV1Client(base.TestCase):
|
||||
project_name=fake_project_name,
|
||||
project_domain_id=fake_project_domain_id)
|
||||
mock_session.assert_called_once_with(auth=self.auth)
|
||||
mock_connection.assert_called_once_with(session=self.session)
|
||||
mock_connection.assert_called_once_with(
|
||||
session=self.session, interface=fake_interface,
|
||||
region_name=fake_region_name)
|
||||
|
@ -30,5 +30,8 @@ class Client(object):
|
||||
project_domain_id=kwargs.get('project_domain_id'))
|
||||
session = ks_session.Session(auth=auth)
|
||||
|
||||
self.con = connection.Connection(session=session)
|
||||
self.con = connection.Connection(
|
||||
session=session,
|
||||
interface=kwargs.get('interface'),
|
||||
region_name=kwargs.get('region_name'))
|
||||
self.service = self.con.instance_ha
|
||||
|
10
releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml
Normal file
10
releasenotes/notes/bug-1764931-889d9fe4cfb80b01.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
features:
|
||||
- |
|
||||
Added ``--os-region-name`` and ``--os-interface`` options to select which
|
||||
endpoint it should use to connect to the masakari service.
|
||||
If masakari services are running in multiple regions of your cloud,
|
||||
you can specify `--os-region-name` in order to get OpenStack service
|
||||
client for the specified region. By default, keystoneauth always selects
|
||||
`public` interface endpoint from the service catalog. Now you can also
|
||||
specify `admin` or `internal` in the --os-interface option.
|
@ -12,7 +12,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Glance Release Notes documentation build configuration file, created by
|
||||
# Masakari Release Notes documentation build configuration file, created by
|
||||
# sphinx-quickstart on Tue Nov 3 17:40:50 2015.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
@ -55,7 +55,7 @@ source_suffix = '.rst'
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'masakariclient Release Notes'
|
||||
project = u'PythonMasakariClient Release Notes'
|
||||
copyright = u'2016, OpenStack Foundation'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
@ -189,7 +189,7 @@ html_static_path = ['_static']
|
||||
# html_file_suffix = None
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'GlanceReleaseNotesdoc'
|
||||
htmlhelp_basename = 'MasakariClientReleaseNotesdoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
@ -209,8 +209,9 @@ latex_elements = {
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
('index', 'GlanceReleaseNotes.tex', u'Glance Release Notes Documentation',
|
||||
u'Glance Developers', 'manual'),
|
||||
('index', 'MasakariClientReleaseNotes.tex',
|
||||
u'MasakariClient Release Notes Documentation',
|
||||
u'MasakariClient Developers', 'manual'),
|
||||
]
|
||||
|
||||
# The name of an image file (relative to this directory) to place at the top of
|
||||
@ -239,8 +240,9 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
('index', 'glancereleasenotes', u'Glance Release Notes Documentation',
|
||||
[u'Glance Developers'], 1)
|
||||
('index', 'MasakariClientreleasenotes',
|
||||
u'MasakariClient Release Notes Documentation',
|
||||
[u'MasakariClient Developers'], 1)
|
||||
]
|
||||
|
||||
# If true, show URL addresses after external links.
|
||||
@ -253,12 +255,11 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
('index', 'GlanceReleaseNotes', u'Glance Release Notes Documentation',
|
||||
u'Glance Developers', 'GlanceReleaseNotes',
|
||||
'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
('index', 'PythonMasakariClient',
|
||||
u'PythonMasakariClient Release Notes Documentation',
|
||||
u'Masakari developers', 'PythonMasakariClient',
|
||||
'One line description of project.', 'Miscellaneous')
|
||||
]
|
||||
|
||||
# Documents to append as an appendix to all manuals.
|
||||
# texinfo_appendices = []
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user