~ubuntu-branches/ubuntu/maverick/eucalyptus/maverick

« back to all changes in this revision

Viewing changes to clc/tools/src/euca_admin/groups.py

  • Committer: Bazaar Package Importer
  • Author(s): Dave Walker (Daviey)
  • Date: 2010-07-21 17:27:10 UTC
  • mfrom: (1.1.38 upstream)
  • Revision ID: james.westby@ubuntu.com-20100721172710-7xv07dmdqgivc3t9
Tags: 2.0~bzr1211-0ubuntu1
* New major upstream version merge, 2.0 (r1211).
* debian/patches/:
  - 01-wsdl-stubs.patch, debian/wsdl.md5sums: wsdl stubs updated.
  - 02-Makefile.patch: Updated to reflect new code layout.
  - 07-local_support_euca_conf-in.patch: Updated to reflect new code layout.
  - 08-ubuntu-default-networking.patch: Refreshed.
  - 09-small-128-192MB.patch: Updated to point to new location.
  - 10-disable-iscsi.patch: Refreshed.
  - 11-state-cleanup-memleakfix.patch: Removed, fixed upstream.
  - 15-fix-default-ramdisk.patch: Updated to point to new location.
  - 16-kvm_libvirt_xml_default_use_kvm.patch: Updated to reflect changes.
  - 17-fix_walrus_OOM_errors.patch: Removed, fixed upstream.
  - 18-priv_security.patch: Updated to reflect upstream changes.
  - 20-brute-force-webui.patch: Updated to reflect upstream changes. 
  - 21-eucalyptus-1.7-with-gwt-1.6.4.patch: New patch, allows 
    eucalyptus-1.7 to be built against gwt 1.6.4. Based on patch courtesy 
    of Dmitrii Zagorodnov, upstream. (LP: #597330)
* debian/eucalyptus-java-common.links: 
  - Changed symlink for groovy, point to groovy.all.jar, making compatiable 
    with groovy versions >1.7. (LP: #595421)
  - Added ant.jar & jetty-rewrite-handler.jar as they are now required.
* debian/control
  - & debian/build-jars: Added libjavassist-java and libjetty-extra-java as 
    build dependencies.
  - Added libjetty-extra-java as a dependency of eucalyptus-java-common
* The binary resulting jar's have been renamed from eucalyptus-*-1.6.2.jar
  to eucalyptus-*-main.jar:    
  - debian/eucalyptus-cc.upstart
  - debian/eucalyptus-cloud.install
  - debian/eucalyptus-common.eucalyptus.upstart
  - debian/eucalyptus-java-common.install
  - debian/eucalyptus-network.upstart
  - debian/eucalyptus-sc.install
  - debian/eucalyptus-walrus.install
* debian/eucalyptus-java-common.install: New upstream jars that have been
  installed:
  - eucalyptus-db-hsqldb-ext-main.jar
  - eucalyptus-component-main.jar
* debian/control:
  - Updated Standards Version to 3.8.4 (no change)
  - Updated the upstream Homepage to: http://open.eucalyptus.com/
  - Changed Vcs-Bzr to reflect new location of Ubuntu hosted development branch.
  - Made the Build Dependency of groovy and the binary eucalyptus-java-common
    package depend on version >=1.7.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import boto,sys,euca_admin
 
2
from boto.exception import EC2ResponseError
 
3
from euca_admin.generic import BooleanResponse
 
4
from euca_admin.generic import StringList
 
5
from boto.resultset import ResultSet
 
6
from euca_admin import EucaAdmin
 
7
from optparse import OptionParser
 
8
 
 
9
SERVICE_PATH = '/services/Accounts'
 
10
class Group():
 
11
  
 
12
  
 
13
  def __init__(self, groupName=None):
 
14
    self.group_groupName = groupName
 
15
    self.group_users = StringList()
 
16
    self.group_auths = StringList()
 
17
    self.euca = EucaAdmin(path=SERVICE_PATH)
 
18
          
 
19
  def __repr__(self):
 
20
    r = 'GROUP      \t%s\t' % (self.group_groupName)
 
21
    r = '%s\nUSERS\t%s\t%s' % (r,self.group_groupName,self.group_users)
 
22
    r = '%s\nAUTH\t%s\t%s' % (r,self.group_groupName,self.group_auths)
 
23
    return r
 
24
      
 
25
  def startElement(self, name, attrs, connection):
 
26
    if name == 'euca:users':
 
27
      return self.group_users
 
28
    if name == 'euca:authorizations':
 
29
      return self.group_auths
 
30
    else:
 
31
      return None
 
32
 
 
33
  def endElement(self, name, value, connection):
 
34
    if name == 'euca:groupName':
 
35
      self.group_groupName = value
 
36
    else:
 
37
      setattr(self, name, value)
 
38
          
 
39
  def get_describe_parser(self):
 
40
    parser = OptionParser("usage: %prog [GROUPS...]",version="Eucalyptus %prog VERSION")
 
41
    return parser.parse_args()
 
42
  
 
43
  def cli_describe(self):
 
44
    (options, args) = self.get_describe_parser()
 
45
    self.group_describe(args)
 
46
    
 
47
  def group_describe(self,groups=None):
 
48
    params = {}
 
49
    if groups:
 
50
      self.euca.connection.build_list_params(params,groups,'GroupNames')
 
51
    try:
 
52
      list = self.euca.connection.get_list('DescribeGroups', params, [('euca:item', Group)])
 
53
      for i in list:
 
54
        print i
 
55
    except EC2ResponseError, ex:
 
56
      self.euca.handle_error(ex)
 
57
 
 
58
  def get_single_parser(self):
 
59
    parser = OptionParser("usage: %prog GROUPNAME",version="Eucalyptus %prog VERSION")
 
60
    (options,args) = parser.parse_args()    
 
61
    if len(args) != 1:
 
62
      print "ERROR  Required argument GROUPNAME is missing or malformed."
 
63
      parser.print_help()
 
64
      sys.exit(1)
 
65
    else:
 
66
      return (options,args)  
 
67
 
 
68
  def cli_add(self):
 
69
    (options, args) = self.get_single_parser()
 
70
    self.group_add(args[0])
 
71
 
 
72
  def group_add(self, groupName):
 
73
    try:
 
74
      reply = self.euca.connection.get_object('AddGroup', {'GroupName':groupName}, BooleanResponse)
 
75
      print reply
 
76
    except EC2ResponseError, ex:
 
77
      self.euca.handle_error(ex)
 
78
 
 
79
  def cli_delete(self):
 
80
    (options, args) = self.get_single_parser()
 
81
    self.group_delete(args[0])
 
82
            
 
83
  def group_delete(self, groupName):
 
84
    try:
 
85
      reply = self.euca.connection.get_object('DeleteGroup', {'GroupName':groupName},BooleanResponse)
 
86
      print reply
 
87
    except EC2ResponseError, ex:
 
88
      self.euca.handle_error(ex)
 
89
 
 
90