components/openstack/swift/files/swift-upgrade
author Devjani Ray <devjani.ray@oracle.com>
Fri, 05 Feb 2016 17:54:17 -0500
changeset 5405 66fd59fecd68
parent 4287 aba3ed31b37a
permissions -rw-r--r--
PSARC 2015/535 OpenStack service updates for Kilo PSARC 2015/458 aioeventlet - asyncio event loop scheduling callbacks in eventlet PSARC 2015/460 msgpack - C/Python bindings for MessagePack (de)serializer data PSARC 2015/466 openstackclient - OpenStack Command-line Client PSARC 2015/467 oslo.versionedobjects - Oslo Versioned Objects library PSARC 2015/468 pint - A physical quantities module PSARC 2015/469 pysaml2 - A pure Python implementation of SAML2 PSARC 2015/471 semantic_version - A library implementing the 'SemVer' scheme PSARC 2015/472 testresources - PyUnit extension for managing expensive test resources PSARC 2015/473 testscenarios - Extensions to Python unittest to support scenarios PSARC 2015/474 trollius - Port of the Tulip project (asyncio module, PEP 3156) on Python 2 PSARC 2015/475 urllib3 - HTTP library with thread-safe connection pooling, file post, and more PSARC 2015/520 oslo.concurrency - Oslo Concurrency library PSARC 2015/521 oslo.log - Oslo Logging Configuration library PSARC 2015/529 oslo.policy - Oslo Policy library PSARC 2015/530 psutil - Python system and process utilities PSARC 2015/538 fixtures - Python module to support reusable state for writing clean tests PSARC 2015/539 sqlparse - An SQL parser module for Python PSARC 2016/017 extras - Useful extra utilities for Python PSARC 2016/018 linecache2 - Port of the standard linecache module PSARC 2016/019 python-mimeparse - Basic functions for parsing mime-types PSARC 2016/020 testtools - Extensions to the Python unit testing framework PSARC 2016/021 traceback2 - Port of the standard traceback module PSARC 2016/014 OpenStack Cinder NFS driver for Solaris 22384068 OpenStack service updates for Kilo (Umbrella) 21974208 The Python module msgpack should be added to Userland 22010630 The Python trollius module should be added to Userland 22011755 The Python module pint should be added to Userland 22012256 The Python aioeventlet module should be added to Userland 22012282 The Python oslo.versionedobjects module should be added to Userland 22012317 The Python semantic_version module should be added to Userland 22012321 The Python testresources module should be added to Userland 22012329 The Python testscenarios module should be added to Userland 22012336 The Python urllib3 module should be added to Userland 22012343 The Python openstackclient module should be added to Userland 22299389 The Python oslo.concurrency module should be added to Userland 22299409 The Python oslo.log module should be added to Userland 22299418 The Python oslo.policy module should be added to Userland 22299469 The Python psutil module should be added to Userland 22337793 The Python sqlparse module should be added to Userland 22338325 The Python fixtures module should be added to Userland 22535728 The Python testtools module should be added to Userland 22535739 The Python extras module should be added to Userland 22535748 The Python linecache2 module should be added to Userland 22535753 The Python traceback2 module should be added to Userland 22535760 The Python python-mimeparse module should be added to Userland 18961001 Image filtering does not function as expected 21678935 NFS for Cinder in Solaris OpenStack 22548630 derived manifest should not enforce presence of global when installing from UAR 22629795 problem in SERVICE/KEYSTONE
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4049
150852e281c4 20816335 move the core OpenStack components to Python 2.7
Drew Fisher <drew.fisher@oracle.com>
parents: 3998
diff changeset
     1
#!/usr/bin/python2.7
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     2
5405
66fd59fecd68 PSARC 2015/535 OpenStack service updates for Kilo
Devjani Ray <devjani.ray@oracle.com>
parents: 4287
diff changeset
     3
# Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     4
#
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     5
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     6
#    not use this file except in compliance with the License. You may obtain
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     7
#    a copy of the License at
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     8
#
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
     9
#         http://www.apache.org/licenses/LICENSE-2.0
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    10
#
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    11
#    Unless required by applicable law or agreed to in writing, software
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    12
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    13
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    14
#    License for the specific language governing permissions and limitations
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    15
#    under the License.
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    16
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    17
import glob
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    18
import os
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    19
from subprocess import check_call, Popen, PIPE
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    20
import sys
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    21
import traceback
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    22
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    23
import smf_include
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    24
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    25
from openstack_common import create_backups, modify_conf
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    26
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    27
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    28
ACCOUNT_SERVER_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    29
    ('DEFAULT', 'bind_port'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    30
    ('DEFAULT', 'workers'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    31
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    32
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    33
CONTAINER_SERVER_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    34
    ('DEFAULT', 'bind_port'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    35
    ('DEFAULT', 'workers'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    36
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    37
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    38
DISPERSION_CONF_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    39
    ('dispersion', 'auth_url'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    40
    ('dispersion', 'auth_user'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    41
    ('dispersion', 'auth_key'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    42
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    43
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    44
OBJECT_SERVER_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    45
    ('DEFAULT', 'bind_port'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    46
    ('DEFAULT', 'workers'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    47
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    48
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    49
PROXY_SERVER_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    50
    ('DEFAULT', 'bind_port'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    51
    ('filter:authtoken', 'auth_uri'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    52
    ('filter:authtoken', 'identity_uri'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    53
    ('filter:authtoken', 'admin_tenant_name'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    54
    ('filter:authtoken', 'admin_user'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    55
    ('filter:authtoken', 'admin_password'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    56
    ('filter:authtoken', 'delay_auth_decision'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    57
    ('filter:authtoken', 'cache'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    58
    ('filter:authtoken', 'include_service_catalog'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    59
    ('filter:authtoken', 'signing_dir'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    60
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    61
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    62
SWIFT_CONF_EXCEPTIONS = [
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    63
    ('swift-hash', 'swift_hash_path_suffix'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    64
    ('swift-hash', 'swift_hash_path_prefix'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    65
    ('storage-policy:0', 'name'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    66
    ('storage-policy:0', 'default'),
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    67
]
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    68
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    69
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    70
def start():
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    71
    # pull out the current version of config/upgrade-id
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    72
    p = Popen(['/usr/bin/svcprop', '-p', 'config/upgrade-id',
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    73
               os.environ['SMF_FMRI']], stdout=PIPE, stderr=PIPE)
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    74
    curr_ver, _err = p.communicate()
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    75
    curr_ver = curr_ver.strip()
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    76
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    77
    # extract the openstack-upgrade-id from the pkg
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    78
    p = Popen(['/usr/bin/pkg', 'contents', '-H', '-t', 'set', '-o', 'value',
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    79
               '-a', 'name=openstack.upgrade-id',
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    80
               'pkg:/cloud/openstack/swift'], stdout=PIPE, stderr=PIPE)
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    81
    pkg_ver, _err = p.communicate()
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    82
    pkg_ver = pkg_ver.strip()
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    83
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    84
    if curr_ver == pkg_ver:
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    85
        # No need to upgrade
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    86
        sys.exit(smf_include.SMF_EXIT_OK)
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    87
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    88
    # look for any .new files
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    89
    if glob.glob('/etc/swift/*.new'):
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    90
        # the versions are different, so perform an upgrade
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    91
        # modify the configuration files
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    92
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    93
        # backup all the old configuration files
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    94
        create_backups('/etc/swift')
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    95
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    96
        modify_conf('/etc/swift/account-server.conf', None,
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    97
                    ACCOUNT_SERVER_EXCEPTIONS)
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
    98
        modify_conf('/etc/swift/container-reconciler.conf')
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
    99
        modify_conf('/etc/swift/container-server.conf', None,
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   100
                    CONTAINER_SERVER_EXCEPTIONS)
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   101
        modify_conf('/etc/swift/container-sync-realms.conf')
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   102
        modify_conf('/etc/swift/dispersion.conf', None,
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   103
                    DISPERSION_CONF_EXCEPTIONS)
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   104
        modify_conf('/etc/swift/memcache.conf')
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   105
        modify_conf('/etc/swift/object-expirer.conf')
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   106
        modify_conf('/etc/swift/object-server.conf', None,
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   107
                    OBJECT_SERVER_EXCEPTIONS)
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   108
        modify_conf('/etc/swift/proxy-server.conf', None,
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   109
                    PROXY_SERVER_EXCEPTIONS)
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   110
        modify_conf('/etc/swift/swift.conf', None, SWIFT_CONF_EXCEPTIONS)
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   111
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   112
    # update the current version
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   113
    check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'setprop',
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   114
               'config/upgrade-id', '=', pkg_ver])
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   115
    check_call(['/usr/sbin/svccfg', '-s', os.environ['SMF_FMRI'], 'refresh'])
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   116
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   117
    sys.exit(smf_include.SMF_EXIT_OK)
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   118
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   119
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   120
if __name__ == '__main__':
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   121
    os.putenv('LC_ALL', 'C')
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   122
    try:
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   123
        smf_include.smf_main()
4287
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   124
    except RuntimeError:
aba3ed31b37a PSARC/2015/233 OpenStack Common Package
Drew Fisher <drew.fisher@oracle.com>
parents: 4181
diff changeset
   125
        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)
3998
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   126
    except Exception as err:
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   127
        print 'Unknown error:  %s' % err
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   128
        print
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   129
        traceback.print_exc(file=sys.stdout)
5bd484384122 PSARC 2015/110 OpenStack service updates for Juno
Danek Duvall <danek.duvall@oracle.com>
parents:
diff changeset
   130
        sys.exit(smf_include.SMF_EXIT_ERR_FATAL)