Add an init-keystone CLI
To allow devtest to leverage the keystone initialization in this module, add a CLI script called init-keystone. Change-Id: I733fb1319b81ebc69845b08bd8ed9a933fa5d245
This commit is contained in:
parent
cc7ac908e3
commit
30ffd5bf31
@ -5,3 +5,18 @@ Usage
|
|||||||
To use os-cloud-config in a project::
|
To use os-cloud-config in a project::
|
||||||
|
|
||||||
import os_cloud_config
|
import os_cloud_config
|
||||||
|
|
||||||
|
Initializing Keystone for a host::
|
||||||
|
|
||||||
|
The init-keystone command line utility initializes Keystone for use with
|
||||||
|
normal authentication by creating the admin and service tenants, the admin
|
||||||
|
and Member roles, the admin user, configure certificates and finally
|
||||||
|
registers the initial identity endpoint.
|
||||||
|
|
||||||
|
For example::
|
||||||
|
|
||||||
|
init-keystone -o 192.0.2.1 -t unset -e admin@example.com -p unset -u root
|
||||||
|
|
||||||
|
That acts on the 192.0.2.1 host, sets the admin token and the admin password
|
||||||
|
to the string "unset", the admin e-mail address to "admin@example.com", and
|
||||||
|
uses the root user to connect to the host via ssh to configure certificates.
|
||||||
|
0
os_cloud_config/cmd/__init__.py
Normal file
0
os_cloud_config/cmd/__init__.py
Normal file
58
os_cloud_config/cmd/init_keystone.py
Normal file
58
os_cloud_config/cmd/init_keystone.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
# Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import textwrap
|
||||||
|
|
||||||
|
from os_cloud_config.keystone import initialize
|
||||||
|
|
||||||
|
|
||||||
|
def parse_args():
|
||||||
|
description = textwrap.dedent("""
|
||||||
|
Perform initial setup of keystone for a new cloud.
|
||||||
|
|
||||||
|
This will create the admin and service tenants, the admin and Member
|
||||||
|
roles, the admin user, configure certificates and finally register the
|
||||||
|
initial identity endpoint, after which Keystone may be used with normal
|
||||||
|
authentication.
|
||||||
|
""")
|
||||||
|
parser = argparse.ArgumentParser(
|
||||||
|
formatter_class=argparse.RawDescriptionHelpFormatter,
|
||||||
|
description=description)
|
||||||
|
parser.add_argument('-o', '--host', dest='host', required=True,
|
||||||
|
help="ip/hostname of node where Keystone is running")
|
||||||
|
parser.add_argument('-t', '--admin-token', dest='admin_token',
|
||||||
|
help="admin token to use with Keystone's admin "
|
||||||
|
"endpoint", required=True)
|
||||||
|
parser.add_argument('-e', '--admin-email', dest='admin_email',
|
||||||
|
help="admin user's e-mail address to be set",
|
||||||
|
required=True)
|
||||||
|
parser.add_argument('-p', '--admin-password', dest='admin_password',
|
||||||
|
help="admin user's password to be set",
|
||||||
|
required=True)
|
||||||
|
parser.add_argument('-r', '--region', dest='region', default='regionOne',
|
||||||
|
help="region to create the endpoint in")
|
||||||
|
parser.add_argument('-s', '--ssl', dest='ssl',
|
||||||
|
help="ip/hostname to use as the ssl endpoint, if "
|
||||||
|
"required")
|
||||||
|
parser.add_argument('-u', '--user', dest='user', required=True,
|
||||||
|
help="user to connect to the Keystone node via ssh")
|
||||||
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
args = parse_args()
|
||||||
|
initialize(args.host, args.admin_token, args.admin_email,
|
||||||
|
args.admin_password, args.region, args.ssl, args.user)
|
@ -1,5 +1,6 @@
|
|||||||
pbr>=0.6,<1.0
|
pbr>=0.6,<1.0
|
||||||
|
|
||||||
|
argparse
|
||||||
Babel>=1.3
|
Babel>=1.3
|
||||||
python-keystoneclient>=0.6.0
|
python-keystoneclient>=0.6.0
|
||||||
oslo.config>=1.2.0
|
oslo.config>=1.2.0
|
||||||
|
@ -23,6 +23,10 @@ classifier =
|
|||||||
packages =
|
packages =
|
||||||
os_cloud_config
|
os_cloud_config
|
||||||
|
|
||||||
|
[entry_points]
|
||||||
|
console_scripts =
|
||||||
|
init-keystone = os_cloud_config.cmd.init_keystone:main
|
||||||
|
|
||||||
[build_sphinx]
|
[build_sphinx]
|
||||||
source-dir = doc/source
|
source-dir = doc/source
|
||||||
build-dir = doc/build
|
build-dir = doc/build
|
||||||
|
Loading…
Reference in New Issue
Block a user