src/modules/portable/os_aix.py
author Rich Burridge <rich.burridge@sun.com>
Mon, 30 Nov 2009 13:01:40 -0800
changeset 1516 8c950a3b4171
parent 1407 56042994e222
child 3171 525f5bdb3f62
child 3518 e6b239f75e89
permissions -rw-r--r--
10485 move pkg(5) to Python 2.6 10482 upgrade to cherrypy 3.1.2 11836 shebang line for python modules should be python version-agnostic 11950 ldtp used by pkg build process not setup to easily use Python 2.6 11989 pkg python dependency analysis tests fail

#!/usr/bin/python
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
# Use is subject to license terms.
#

"""
Most if not all of the os_unix methods apply on AIX. The methods
below override the definitions from os_unix
"""

import os
import errno
from os_unix import \
    get_isainfo, get_release, get_platform, get_group_by_name, \
    get_user_by_name, get_name_by_gid, get_name_by_uid, is_admin, get_userid, \
    get_username, rename, remove, link, split_path, get_root, assert_mode, copyfile

def chown(path, owner, group):
        # The "nobody" user on AIX has uid -2, which is an invalid UID on NFS
        # file systems mounted from non-AIX hosts.
        # However, we don't want to fail an install because of this.
        try:
                return os.chown(path, owner, group)
        except EnvironmentError, e:
                if owner == -2 and e.errno == errno.EINVAL:
                        return os.chown(path, -1, group)
                raise