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