components/openstack/heat/files/heat-upgrade
changeset 6850 f8d3bc724af7
parent 5405 66fd59fecd68
equal deleted inserted replaced
6849:f9a2279efa0d 6850:f8d3bc724af7
    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 HEAT_CONF_MAPPINGS = {
    30 HEAT_CONF_MAPPINGS = {
    31     # Deprecated group/name
    31     # Deprecated group/name in Liberty
    32     ('DEFAULT', 'log-format'): (None, None),
    32     ('DEFAULT', 'rpc_thread_pool_size'):
    33     ('DEFAULT', 'use-sylog'): (None, None),
    33         ('DEFAULT', 'executor_thread_pool_size'),
       
    34     ('DEFAULT', 'log_format'): (None, None),
       
    35     ('DEFAULT', 'use_syslog'): (None, None),
       
    36     # Deprecated group/name in Mitaka
       
    37     ('profiler', 'profiler_enabled'): ('profiler', 'enabled'),
       
    38     ('DEFAULT', 'instance_user'): (None, None),
    34     ('DEFAULT', 'list_notifier_drivers'): (None, None),
    39     ('DEFAULT', 'list_notifier_drivers'): (None, None),
       
    40     ('DEFAULT', 'matchmaker_heartbeat_freq'): (None, None),
       
    41     ('DEFAULT', 'matchmaker_heartbeat_ttl'): (None, None),
       
    42     ('DEFAULT', 'notification_driver'):
       
    43         ('oslo_messaging_notifications', 'driver'),
       
    44     ('DEFAULT', 'notification_topics'):
       
    45         ('oslo_messaging_notifications', 'topics'),
       
    46     ('DEFAULT', 'policy_default_rule'): ('oslo_policy', 'policy_default_rule'),
       
    47     ('DEFAULT', 'policy_dirs'): ('oslo_policy', 'policy_dirs'),
       
    48     ('DEFAULT', 'policy_file'): ('oslo_policy', 'policy_file'),
       
    49     ('DEFAULT', 'rpc_zmq_port'): (None, None),
       
    50     ('DEFAULT', 'use_syslog_rfc_format'): (None, None),
    35 }
    51 }
    36 
    52 
    37 HEAT_CONF_EXCEPTIONS = [
    53 HEAT_CONF_EXCEPTIONS = [
    38     ('database', 'connection'),
    54     ('database', 'connection'),
    39     ('keystone_authtoken', 'auth_uri'),
    55     ('keystone_authtoken', 'auth_uri'),
    74         modify_conf('/etc/heat/api-paste.ini')
    90         modify_conf('/etc/heat/api-paste.ini')
    75 
    91 
    76         modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS,
    92         modify_conf('/etc/heat/heat.conf', HEAT_CONF_MAPPINGS,
    77                     HEAT_CONF_EXCEPTIONS)
    93                     HEAT_CONF_EXCEPTIONS)
    78 
    94 
    79     config = iniparse.RawConfigParser()
       
    80     config.read('/etc/heat/heat.conf')
       
    81     # In certain cases the database section does not exist and the
       
    82     # default database chosen is sqlite.
       
    83     if config.has_section('database'):
       
    84         db_connection = config.get('database', 'connection')
       
    85 
       
    86         if db_connection.startswith('mysql'):
       
    87             engine = sqlalchemy.create_engine(db_connection)
       
    88             if engine.url.username != '%SERVICE_USER%':
       
    89                 alter_mysql_tables(engine)
       
    90                 print "altered character set to utf8 in heat tables"
       
    91 
       
    92     # update the current version
    95     # update the current version
    93     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'setprop',
    96     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'setprop',
    94                'config/upgrade-id', '=', pkg_ver])
    97                'config/upgrade-id', '=', pkg_ver])
    95     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'refresh'])
    98     check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'refresh'])
    96 
    99