components/openstack/heat/files/heat-upgrade
branchs11u3-sru
changeset 6035 c9748fcc32de
parent 4625 18adb92d4193
equal deleted inserted replaced
6016:a477397bba8b 6035:c9748fcc32de
     1 #!/usr/bin/python2.7
     1 #!/usr/bin/python2.7
     2 
     2 
     3 # Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     3 # Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     4 #
     4 #
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     5 #    Licensed under the Apache License, Version 2.0 (the "License"); you may
     6 #    not use this file except in compliance with the License. You may obtain
     6 #    not use this file except in compliance with the License. You may obtain
     7 #    a copy of the License at
     7 #    a copy of the License at
     8 #
     8 #
    25 import sqlalchemy
    25 import sqlalchemy
    26 
    26 
    27 from openstack_common import alter_mysql_tables, create_backups, modify_conf, \
    27 from openstack_common import alter_mysql_tables, create_backups, modify_conf, \
    28     move_conf
    28     move_conf
    29 
    29 
    30 
       
    31 HEAT_CONF_MAPPINGS = {
    30 HEAT_CONF_MAPPINGS = {
    32     # Deprecated group/name
    31     # Deprecated group/name
    33     ('DEFAULT', 'stack_user_domain'): ('DEFAULT', 'stack_user_domain_id'),
    32     ('DEFAULT', 'log-format'): (None, None),
    34     ('DEFAULT', 'rabbit_durable_queues'): ('DEFAULT', 'amqp_durable_queues'),
    33     ('DEFAULT', 'use-sylog'): (None, None),
    35     ('rpc_notifier2', 'topics'): ('DEFAULT', 'notification_topics'),
       
    36     ('DEFAULT', 'log_config'): ('DEFAULT', 'log_config_append'),
       
    37     ('DEFAULT', 'logfile'): ('DEFAULT', 'log_file'),
       
    38     ('DEFAULT', 'logdir'): ('DEFAULT', 'log_dir'),
       
    39     ('DEFAULT', 'db_backend'): ('database', 'backend'),
       
    40     ('DEFAULT', 'sql_connection'): ('database', 'connection'),
       
    41     ('DATABASE', 'sql_connection'): ('database', 'connection'),
       
    42     ('sql', 'connection'): ('database', 'connection'),
       
    43     ('DEFAULT', 'sql_idle_timeout'): ('database', 'idle_timeout'),
       
    44     ('DATABASE', 'sql_idle_timeout'): ('database', 'idle_timeout'),
       
    45     ('sql', 'idle_timeout'): ('database', 'idle_timeout'),
       
    46     ('DEFAULT', 'sql_min_pool_size'): ('database', 'min_pool_size'),
       
    47     ('DATABASE', 'sql_min_pool_size'): ('database', 'min_pool_size'),
       
    48     ('DEFAULT', 'sql_max_pool_size'): ('database', 'max_pool_size'),
       
    49     ('DATABASE', 'sql_max_pool_size'): ('database', 'max_pool_size'),
       
    50     ('DEFAULT', 'sql_max_retries'): ('database', 'max_retries'),
       
    51     ('DATABASE', 'sql_max_retries'): ('database', 'max_retries'),
       
    52     ('DEFAULT', 'sql_retry_interval'): ('database', 'retry_interval'),
       
    53     ('DATABASE', 'reconnect_interval'): ('database', 'retry_interval'),
       
    54     ('DEFAULT', 'sql_max_overflow'): ('database', 'max_overflow'),
       
    55     ('DATABASE', 'sqlalchemy_max_overflow'): ('database', 'max_overflow'),
       
    56     ('DEFAULT', 'sql_connection_debug'): ('database', 'connection_debug'),
       
    57     ('DEFAULT', 'sql_connection_trace'): ('database', 'connection_trace'),
       
    58     ('DATABASE', 'sqlalchemy_pool_timeout'): ('database', 'pool_timeout'),
       
    59     ('DEFAULT', 'memcache_servers'):
       
    60         ('keystone_authtoken', 'memcached_servers'),
       
    61     ('DEFAULT', 'matchmaker_ringfile'): ('matchmaker_ring', 'ringfile'),
       
    62     # No longer referenced by the service or causes a DeprecationWarning
       
    63     ('DEFAULT', 'instance_user'): (None, None),
       
    64     ('DEFAULT', 'onready'): (None, None),
       
    65     ('DEFAULT', 'list_notifier_drivers'): (None, None),
    34     ('DEFAULT', 'list_notifier_drivers'): (None, None),
    66 }
    35 }
    67 
    36 
    68 HEAT_CONF_EXCEPTIONS = [
    37 HEAT_CONF_EXCEPTIONS = [
    69     ('database', 'connection'),
    38     ('database', 'connection'),
    72     ('keystone_authtoken', 'admin_user'),
    41     ('keystone_authtoken', 'admin_user'),
    73     ('keystone_authtoken', 'admin_password'),
    42     ('keystone_authtoken', 'admin_password'),
    74     ('keystone_authtoken', 'admin_tenant_name'),
    43     ('keystone_authtoken', 'admin_tenant_name'),
    75     ('keystone_authtoken', 'signing_dir'),
    44     ('keystone_authtoken', 'signing_dir'),
    76 ]
    45 ]
    77 
       
    78 HEAT_MOVE_CONFIG = {
       
    79     ('filter:authtoken', 'auth_uri'): ('keystone_authtoken', 'auth_uri'),
       
    80     ('filter:authtoken', 'identity_uri'):
       
    81         ('keystone_authtoken', 'identity_uri'),
       
    82     ('filter:authtoken', 'admin_tenant_name'):
       
    83         ('keystone_authtoken', 'admin_tenant_name'),
       
    84     ('filter:authtoken', 'admin_user'): ('keystone_authtoken', 'admin_user'),
       
    85     ('filter:authtoken', 'admin_password'):
       
    86         ('keystone_authtoken', 'admin_password'),
       
    87 }
       
    88 
    46 
    89 
    47 
    90 def start():
    48 def start():
    91     # pull out the current version of config/upgrade-id
    49     # pull out the current version of config/upgrade-id
    92     p = Popen(['/usr/bin/svcprop', '-p', 'config/upgrade-id',
    50     p = Popen(['/usr/bin/svcprop', '-p', 'config/upgrade-id',
   112 
    70 
   113         # backup all the old configuration files
    71         # backup all the old configuration files
   114         create_backups('/etc/heat')
    72         create_backups('/etc/heat')
   115 
    73 
   116         modify_conf('/etc/heat/api-paste.ini')
    74         modify_conf('/etc/heat/api-paste.ini')
   117 
       
   118         # before modifying heat.conf, move the [filter:authtoken] entries from
       
   119         # the updated api-paste.ini to the old heat.conf
       
   120         move_conf('/etc/heat/api-paste.ini', '/etc/heat/heat.conf',
       
   121                   HEAT_MOVE_CONFIG)
       
   122 
    75 
   123         modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS,
    76         modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS,
   124                     HEAT_CONF_EXCEPTIONS)
    77                     HEAT_CONF_EXCEPTIONS)
   125 
    78 
   126     config = iniparse.RawConfigParser()
    79     config = iniparse.RawConfigParser()