1cdf0c1d5Smjnelson#! /usr/bin/python 2cdf0c1d5Smjnelson# 3cdf0c1d5Smjnelson# CDDL HEADER START 4cdf0c1d5Smjnelson# 5cdf0c1d5Smjnelson# The contents of this file are subject to the terms of the 6cdf0c1d5Smjnelson# Common Development and Distribution License (the "License"). 7cdf0c1d5Smjnelson# You may not use this file except in compliance with the License. 8cdf0c1d5Smjnelson# 9cdf0c1d5Smjnelson# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10cdf0c1d5Smjnelson# or http://www.opensolaris.org/os/licensing. 11cdf0c1d5Smjnelson# See the License for the specific language governing permissions 12cdf0c1d5Smjnelson# and limitations under the License. 13cdf0c1d5Smjnelson# 14cdf0c1d5Smjnelson# When distributing Covered Code, include this CDDL HEADER in each 15cdf0c1d5Smjnelson# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16cdf0c1d5Smjnelson# If applicable, add the following below this CDDL HEADER, with the 17cdf0c1d5Smjnelson# fields enclosed by brackets "[]" replaced with your own identifying 18cdf0c1d5Smjnelson# information: Portions Copyright [yyyy] [name of copyright owner] 19cdf0c1d5Smjnelson# 20cdf0c1d5Smjnelson# CDDL HEADER END 21cdf0c1d5Smjnelson# 22cdf0c1d5Smjnelson 23cdf0c1d5Smjnelson# 24*bfed486aSAli Bahrami# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25cdf0c1d5Smjnelson# Use is subject to license terms. 26cdf0c1d5Smjnelson# 27cdf0c1d5Smjnelson 28cdf0c1d5Smjnelson# 29cdf0c1d5Smjnelson# The 'checks' package contains various checks that may be run 30cdf0c1d5Smjnelson# 31cdf0c1d5Smjnelson 32cdf0c1d5Smjnelson__all__ = [ 33cdf0c1d5Smjnelson 'Cddl', 34cdf0c1d5Smjnelson 'Comments', 35cdf0c1d5Smjnelson 'Copyright', 36cdf0c1d5Smjnelson 'CStyle', 37cdf0c1d5Smjnelson 'HdrChk', 38cdf0c1d5Smjnelson 'JStyle', 39cdf0c1d5Smjnelson 'Keywords', 40*bfed486aSAli Bahrami 'Mapfile', 41cdf0c1d5Smjnelson 'Rti', 42cdf0c1d5Smjnelson 'onSWAN'] 43cdf0c1d5Smjnelson 44cdf0c1d5Smjnelson 45cdf0c1d5Smjnelsonimport socket 46cdf0c1d5Smjnelson 47cdf0c1d5Smjnelson# 48cdf0c1d5Smjnelson# Generic check to test if a host is on SWAN 49cdf0c1d5Smjnelson# 50cdf0c1d5Smjnelsondef onSWAN(): 51cdf0c1d5Smjnelson try: 52cdf0c1d5Smjnelson if socket.gethostbyname("sunweb.central.sun.com."): 53cdf0c1d5Smjnelson return True 54cdf0c1d5Smjnelson else: 55cdf0c1d5Smjnelson return False 56cdf0c1d5Smjnelson except: 57cdf0c1d5Smjnelson return False 58