[openstack-heat] Updated patches from master-patches

Jeff Peeler jpeeler at fedoraproject.org
Fri Jun 13 14:05:41 UTC 2014


commit 99e885433cd61f283983c9048ed0d1d33832ae0c
Author: Jeff Peeler <jpeeler at redhat.com>
Date:   Fri Jun 13 09:56:20 2014 -0400

    Updated patches from master-patches
    
    (Added heat-keystone-setup-domain-script)

 0001-Switch-to-using-M2Crypto.patch              |    2 +-
 0002-remove-pbr-runtime-dependency.patch         |    2 +-
 0003-Add-heat-keystone-setup-domain-script.patch |  143 ++++++++++++++++++++++
 openstack-heat.spec                              |    2 +
 4 files changed, 147 insertions(+), 2 deletions(-)
---
diff --git a/0001-Switch-to-using-M2Crypto.patch b/0001-Switch-to-using-M2Crypto.patch
index ced3d7b..fe2d3e9 100644
--- a/0001-Switch-to-using-M2Crypto.patch
+++ b/0001-Switch-to-using-M2Crypto.patch
@@ -1,4 +1,4 @@
-From d4ad0053b873a488efc508cb11586c0aaf90dc66 Mon Sep 17 00:00:00 2001
+From b41893390e67bb2f4626f226991e6a9b342070fc Mon Sep 17 00:00:00 2001
 From: Jeff Peeler <jpeeler at redhat.com>
 Date: Wed, 8 May 2013 12:27:35 -0400
 Subject: [PATCH] Switch to using M2Crypto
diff --git a/0002-remove-pbr-runtime-dependency.patch b/0002-remove-pbr-runtime-dependency.patch
index fca2b37..9d16386 100644
--- a/0002-remove-pbr-runtime-dependency.patch
+++ b/0002-remove-pbr-runtime-dependency.patch
@@ -1,4 +1,4 @@
-From a60c0a4e05e5687e7c2dc590c309c58e616160c4 Mon Sep 17 00:00:00 2001
+From 43a5a9db5728f9c20ab3027f20e899040922c49d Mon Sep 17 00:00:00 2001
 From: Jeff Peeler <jpeeler at redhat.com>
 Date: Mon, 14 Oct 2013 14:30:34 -0400
 Subject: [PATCH] remove pbr runtime dependency
diff --git a/0003-Add-heat-keystone-setup-domain-script.patch b/0003-Add-heat-keystone-setup-domain-script.patch
new file mode 100644
index 0000000..bd625d0
--- /dev/null
+++ b/0003-Add-heat-keystone-setup-domain-script.patch
@@ -0,0 +1,143 @@
+From 0d2e0df470bc8c3a7dc0de45fae7b6b3557a6f76 Mon Sep 17 00:00:00 2001
+From: Jeff Peeler <jpeeler at redhat.com>
+Date: Fri, 13 Jun 2014 09:51:30 -0400
+Subject: [PATCH] Add heat-keystone-setup-domain script
+
+Resolves: rhbz#1104709
+---
+ bin/heat-keystone-setup-domain | 113 +++++++++++++++++++++++++++++++++++++++++
+ setup.cfg                      |   1 +
+ 2 files changed, 114 insertions(+)
+ create mode 100644 bin/heat-keystone-setup-domain
+
+diff --git a/bin/heat-keystone-setup-domain b/bin/heat-keystone-setup-domain
+new file mode 100644
+index 0000000..f5737e9
+--- /dev/null
++++ b/bin/heat-keystone-setup-domain
+@@ -0,0 +1,113 @@
++#!/usr/bin/env python
++#
++#    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 logging
++import os
++import sys
++
++import keystoneclient.exceptions as kc_exception
++from keystoneclient.v3 import client
++from oslo.config import cfg
++
++logger = logging.getLogger(__name__)
++
++DEBUG = False
++USERNAME = os.environ.get('OS_USERNAME', None)
++PASSWORD = os.environ.get('OS_PASSWORD', None)
++AUTH_URL = os.environ.get('OS_AUTH_URL', '').replace('v2.0', 'v3')
++
++opts = [
++    cfg.StrOpt('stack-user-domain-name',
++               default="heat",
++               help="Name of domain to create for stack users."),
++    cfg.StrOpt('stack-domain-admin',
++               default="heat_stack_admin",
++               help="Keystone username with roles sufficient to manage users"
++                    " and projects in the stack-user-domain"),
++    cfg.StrOpt('stack-domain-admin-password',
++               help="Password to set for stack-domain-admin"),
++]
++for opt in opts:
++    cfg.CONF.register_opt(opt, cli=True)
++cfg.CONF(sys.argv[1:], project='heat', prog='heat-keystone-setup-domain')
++
++HEAT_DOMAIN_NAME = os.environ.get(
++    'HEAT_DOMAIN', cfg.CONF.stack_user_domain_name)
++HEAT_DOMAIN_ADMIN = os.environ.get('HEAT_DOMAIN_ADMIN',
++                                   cfg.CONF.stack_domain_admin)
++HEAT_DOMAIN_PASSWORD = os.environ.get('HEAT_DOMAIN_PASSWORD',
++                                      cfg.CONF.stack_domain_admin_password)
++HEAT_DOMAIN_DESCRIPTION = 'Contains users and projects created by heat'
++
++logger.debug("USERNAME=%s" % USERNAME)
++logger.debug("PASSWORD=%s" % PASSWORD)
++logger.debug("AUTH_URL=%s" % AUTH_URL)
++
++
++def main():
++    log_lvl = logging.DEBUG if DEBUG else logging.INFO
++    logging.basicConfig(
++        format="%(levelname)s (%(module)s:%(lineno)d) %(message)s",
++        level=log_lvl)
++
++    c = client.Client(debug=DEBUG,
++                      username=USERNAME,
++                      password=PASSWORD,
++                      auth_url=AUTH_URL,
++                      endpoint=AUTH_URL)
++    c.authenticate()
++
++    # Create the heat domain
++    logger.info("Creating domain %s" % HEAT_DOMAIN_NAME)
++    try:
++        heat_domain = c.domains.create(name=HEAT_DOMAIN_NAME,
++                                       description=HEAT_DOMAIN_DESCRIPTION)
++    except kc_exception.Conflict:
++        logger.warning("Domain %s already exists" % HEAT_DOMAIN_NAME)
++        heat_domain = c.domains.list(name=HEAT_DOMAIN_NAME)[0]
++        if heat_domain.name != HEAT_DOMAIN_NAME:
++            logger.error("Unexpected filtered list response, please upgrade "
++                         "keystoneclient to >= 0.5")
++            sys.exit(1)
++
++    # Create heat domain admin user
++    if not HEAT_DOMAIN_PASSWORD:
++        logger.error("Must export HEAT_DOMAIN_PASSWORD or use"
++                     " --stack-domain-admin-password")
++        sys.exit(1)
++
++    try:
++        domain_admin = c.users.create(name=HEAT_DOMAIN_ADMIN,
++                                      password=HEAT_DOMAIN_PASSWORD,
++                                      domain=heat_domain,
++                                      description="Heat domain admin")
++    except kc_exception.Conflict:
++        logger.warning("User %s already exists" % HEAT_DOMAIN_ADMIN)
++        domain_admin = c.users.list(name=HEAT_DOMAIN_ADMIN)[0]
++
++    # Make the user a domain admin
++    roles_list = c.roles.list()
++    # FIXME(shardy): seems filtering roles by name currently doesn't work
++    admin_role = [r for r in roles_list
++                  if r.name == 'admin'][0]
++    c.roles.grant(role=admin_role, user=domain_admin, domain=heat_domain)
++
++    print("\nPlease update your heat.conf with the following in [DEFAULT]\n")
++    print("stack_user_domain=%s" % heat_domain.id)
++    print("stack_domain_admin=%s" % HEAT_DOMAIN_ADMIN)
++    print("stack_domain_admin_password=%s" % HEAT_DOMAIN_PASSWORD)
++
++
++if __name__ == "__main__":
++    main()
+diff --git a/setup.cfg b/setup.cfg
+index 8cf6f86..fe6b108 100644
+--- a/setup.cfg
++++ b/setup.cfg
+@@ -29,6 +29,7 @@ scripts =
+ 	bin/heat-db-setup
+ 	bin/heat-engine
+ 	bin/heat-keystone-setup
++	bin/heat-keystone-setup-domain
+ 	bin/heat-manage
+ 
+ [global]
diff --git a/openstack-heat.spec b/openstack-heat.spec
index 5cb61f7..774793f 100644
--- a/openstack-heat.spec
+++ b/openstack-heat.spec
@@ -28,6 +28,7 @@ Source20:   heat-dist.conf
 #
 Patch0001: 0001-Switch-to-using-M2Crypto.patch
 Patch0002: 0002-remove-pbr-runtime-dependency.patch
+Patch0003: 0003-Add-heat-keystone-setup-domain-script.patch
 
 BuildArch: noarch
 BuildRequires: git
@@ -79,6 +80,7 @@ Requires: %{name}-api-cloudwatch = %{version}-%{release}
 
 %patch0001 -p1
 %patch0002 -p1
+%patch0003 -p1
 sed -i s/REDHATHEATVERSION/%{version}/ heat/version.py
 sed -i s/REDHATHEATRELEASE/%{release}/ heat/version.py
 


More information about the scm-commits mailing list