/[demi]/bin/add-demi-machine
ViewVC logotype

Contents of /bin/add-demi-machine

Parent Directory Parent Directory | Revision Log Revision Log


Revision 44 - (show annotations) (download)
Wed Jan 18 19:38:57 2006 UTC (7 years, 5 months ago) by jwm-guest
File size: 1479 byte(s)
add Id tags, svn:keywords, license blocks where needed
1 #!/usr/bin/python
2
3 # Demi, the Debian Enterprise Management Interface
4 # Copyright (c) 2005, Citizens Communications Company
5 #
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of Version 2 of the GNU General Public License as
8 # published by the Free Software Foundation
9 #
10 # This program is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 # Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with this program; if not, write to the Free Software Foundation, Inc.,
17 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 #
19 # $Id$
20
21 from getopt import getopt
22 from os.path import basename
23 import sys
24 from demi.machine import Machine
25
26 def usage():
27 print """\
28 Usage: %s HOSTNAME [HOSTNAME]...
29 FIXME: English description goes here
30
31 -h, --help display this help and exit""" % (basename(sys.argv[0]))
32
33 # FIXME: this trap doesn't work right
34 try:
35 [opts, args] = getopt(sys.argv[1:], "h", ["help"])
36 except getopt.GetoptError:
37 usage()
38
39 if len(opts) == 0 and len(args) == 0:
40 usage()
41
42 for option in opts:
43 if option[0] == "--help" or option[0] == "-h":
44 usage()
45 else:
46 print basename(sys.argv[0]) + ": invalid option -- " + option[0]
47 usage()
48
49 for hostname in args:
50 machine.add(hostname)
51 newMachine = Machine(hostname)
52 newMachine.update()

Properties

Name Value
svn:executable *
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.5