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

Contents of /bin/add-demi-machine

Parent Directory Parent Directory | Revision Log Revision Log


Revision 74 - (show annotations) (download)
Wed Feb 1 21:18:52 2006 UTC (7 years, 3 months ago) by jwm-guest
File size: 1485 byte(s)
add text description in usage display

Submitted by: Jason Harrison <jharrison@linuxbs.org>
1 #!/usr/bin/python
2
3 # Demi, the Debian Enterprise Management Interface
4 # Copyright (c) 2005-6, 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 import sys
22 from getopt import getopt
23 from os.path import basename
24
25 import demi
26 from demi.machine import Machine
27
28 def usage():
29 print """\
30 Usage: %s HOSTNAME [HOSTNAME]...
31 Add a machine to Demi.
32
33 -h, --help display this help and exit""" % (basename(sys.argv[0]))
34
35 # FIXME: this trap doesn't work right
36 try:
37 [opts, args] = getopt(sys.argv[1:], "h", ["help"])
38 except getopt.GetoptError:
39 usage()
40
41 if len(opts) == 0 and len(args) == 0:
42 usage()
43
44 for option in opts:
45 if option[0] == "--help" or option[0] == "-h":
46 usage()
47 else:
48 print basename(sys.argv[0]) + ": invalid option -- " + option[0]
49 usage()
50
51 for hostname in args:
52 demi.machine.add(hostname)
53 newMachine = Machine(hostname)
54 newMachine.update()

Properties

Name Value
svn:executable *
svn:keywords Id

  ViewVC Help
Powered by ViewVC 1.1.5