Skip to content

Commit

Permalink
merge from eee
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Edwards committed Jul 8, 2011
2 parents 2f199c3 + c11dd18 commit 2f32bf3
Show file tree
Hide file tree
Showing 42 changed files with 609 additions and 1,261 deletions.
2 changes: 2 additions & 0 deletions .bzrignore
Expand Up @@ -43,3 +43,5 @@ clc/modules/www/conf/eucalyptus-web.properties
clc/modules/www/src/main/java/edu/ucsb/eucalyptus/admin/public/themes/active
clc/.deprecated/*/build

.settings/grze_localhost.launch
.settings/grze_office.launch
19 changes: 0 additions & 19 deletions clc/.settings/grze_localhost.launch

This file was deleted.

20 changes: 0 additions & 20 deletions clc/.settings/grze_office.launch

This file was deleted.

52 changes: 25 additions & 27 deletions clc/eucadmin/bin/euca_conf.in
Expand Up @@ -74,11 +74,13 @@ RegOptions = {
'component' : ['-C', '--component', 'component_name']}

# list of services which can be checked
CheckableServices = ['cc', 'cloud', 'nc', 'sc',
CheckableServices = ['common', 'cc', 'cloud', 'nc', 'sc',
'walrus', 'vmware', 'vmwarebroker']
CheckableServicesString = '|'.join(CheckableServices)

# list of services which can be enabled/disabled
EnableableServices = ['cloud', 'walrus', 'sc', 'vmwarebroker']
EnableableServicesString = '|'.join(EnableableServices)

class EucaConf(object):

Expand Down Expand Up @@ -263,26 +265,25 @@ class EucaConf(object):
self.parser.add_option('--import-conf', action='store',
type='string', dest='import_conf_file',
help='import vars from another eucalyptus.conf')
self.parser.add_option('--upgrade-conf', action='store',
type='string', dest='upgrade_conf_file',
help='upgrade eucalyptus.conf from old installation')
self.parser.add_option('--setup', action='store_true',
dest='do_setup', default=False,
help='perform initial setup')
self.parser.add_option('--enable {cloud|sc|walrus|vmwarebroker}',
self.parser.add_option('--enable {%s}' % EnableableServicesString,
action='append', type='choice',
choices=['cloud', 'sc', 'walrus',
'vmwarebroker'],
choices=EnableableServices,
dest='enable_whats', metavar='<service>',
help='enable service at next start}')
self.parser.add_option('--disable {cloud|sc|walrus|vmwarebroker',
self.parser.add_option('--disable {%s}' % EnableableServicesString,
action='append', type='choice',
choices=['cloud', 'sc', 'walrus',
'vmwarebroker'],
choices=EnableableServices,
dest='disable_whats', metavar='<service>',
help='disable service at next start}')
self.parser.add_option('--check {common|vmware}',
action='store', type='choice',
choices=['common', 'vmware', 'cc',
'cloud', 'nc', 'sc', 'walrus',
'vmware', 'vmwarebroker'],
choices=CheckableServices,
dest='check_what', metavar='<service>',
help='pre-flight checks')
self.parser.add_option('--debug', action='store_true',
Expand Down Expand Up @@ -459,7 +460,9 @@ class EucaConf(object):
req.main()

def do_check(self):
if self.options.check_what == 'common':
if self.options.check_what in CheckableServices:
# All previously supported options, plus common, will
# now just call check.common
cls = boto.utils.find_class('eucadmin.check', 'Check')
req = cls(self.config, self.options.check_what)
req.common()
Expand All @@ -470,16 +473,6 @@ class EucaConf(object):
sys.exit(req.status)
elif self.options.check_what == 'vmware':
print 'do vmware check here'
elif self.options.check_what in CheckableServices:
# for backwards compat, do a common check for old check options
cls = boto.utils.find_class('eucadmin.check', 'Check')
req = cls(self.config, self.options.check_what)
req.common()
if len(req.messages) > 0:
print 'The following messages should be reviewed:'
for msg in req.messages:
print '\t%s' % msg
sys.exit(req.status)

def do_enable(self):
if self.options.enable_whats:
Expand All @@ -497,6 +490,11 @@ class EucaConf(object):
req = cls(self.options.heartbeat)
req.cli_formatter()

def do_upgrade_conf(self):
if self.options.upgrade_conf_file:
print 'Upgrading from %s' % self.options.upgrade_conf_file
self.config.mergefile(self.options.upgrade_conf_file)

def _do_list(self, option_name, module_name, class_name):
if getattr(self.options, option_name):
cls = boto.utils.find_class(module_name, class_name)
Expand All @@ -523,8 +521,8 @@ class EucaConf(object):

def do_list_clouds(self):
self._do_list('list_clouds',
'eucadmin.describeclouds',
'DescribeClouds')
'eucadmin.describeeucalyptus',
'DescribeEucalyptus')

def do_list_clusters(self):
self._do_list('list_clusters',
Expand Down Expand Up @@ -588,8 +586,8 @@ class EucaConf(object):

def do_register_cloud(self):
if hasattr(self.options, 'register_cloud'):
self._do_register('eucadmin.registercloud',
'RegisterCloud', None)
self._do_register('eucadmin.registereucalyptus',
'RegisterEucalyptus', None)
if not self.options.no_sync:
path1 = os.path.join(self.config['EUCALYPTUS'],
'var/lib/eucalyptus/keys')
Expand Down Expand Up @@ -675,8 +673,8 @@ class EucaConf(object):

def do_deregister_cloud(self):
self._do_deregister('deregister_cloud',
'eucadmin.deregistercloud',
'DeregisterCloud')
'eucadmin.deregistereucalyptus',
'DeregisterEucalyptus')

def do_deregister_cluster(self):
self._do_deregister('deregister_cluster',
Expand Down
4 changes: 2 additions & 2 deletions clc/eucadmin/eucadmin/cmdstrings.py
Expand Up @@ -78,8 +78,8 @@ def get_mysql_version():
},
'dbpass' : {
'get_version_fn' : get_openssl_version,
'commands' : [(re.compile('OpenSSL 1\.0\..*'), """echo -n eucalyptus | openssl dgst -sha256 -sign %s/var/lib/eucalyptus/keys/cloud-pk.pem -hex"""),
(re.compile('.*'), """echo -n eucalyptus | openssl dgst -sha256 -sign %s/var/lib/eucalyptus/keys/cloud-pk.pem -hex | cut -d' ' -f2""")]
'commands' : [(re.compile('OpenSSL 1\.0\..*'), """echo -n eucalyptus | openssl dgst -sha256 -sign %s/var/lib/eucalyptus/keys/cloud-pk.pem -hex | cut -d' ' -f2"""),
(re.compile('.*'), """echo -n eucalyptus | openssl dgst -sha256 -sign %s/var/lib/eucalyptus/keys/cloud-pk.pem -hex""")]
},
'mysql_get_token' : {
'get_version_fn' : get_mysql_version,
Expand Down
31 changes: 24 additions & 7 deletions clc/eucadmin/eucadmin/configfile.py
Expand Up @@ -44,10 +44,6 @@ def __init__(self, filepath, test=False):
self._save_to_file = False
self.path = os.path.expanduser(filepath)
self.path = os.path.expandvars(self.path)
if not os.access(self.path, os.F_OK):
raise IOError('The file (%s) does not exist' % self.path)
if not os.access(self.path, os.W_OK):
raise IOError("You don't have write access to %s" % self.path)
self.need_backup = True
self._read_config_data()
self._save_to_file = True
Expand All @@ -59,8 +55,16 @@ def __setitem__(self, key, value):
cmd = eucadmin.command.Command(cmd_str)
dict.__setitem__(self, key, value)

def _read_config_data(self):
fp = open(self.path)
def _read_config_data(self, path=None):
if not path:
path = self.path

if not os.access(path, os.F_OK):
raise IOError('The file (%s) does not exist' % path)
if path == self.path and not os.access(path, os.W_OK):
raise IOError("You don't have write access to %s" % path)

fp = open(path)
for line in fp.readlines():
if not line.startswith('#'):
t = line.split('=', 1)
Expand All @@ -74,7 +78,7 @@ def _backup(self):
self.need_backup = False

def comment(self, pattern):
self.backup()
self._backup()
cmd_str = self.CommentCmd % (pattern, self.path)
cmd = eucadmin.command.Command(cmd_str)
if pattern in self:
Expand All @@ -86,3 +90,16 @@ def uncomment(self, pattern):
cmd = eucadmin.command.Command(cmd_str)
self['pattern'] = ''

def mergefile(self, oldconfig):
old_version = ''
old_version_file = os.path.join(os.path.dirname(oldconfig), 'eucalyptus-version')
if os.access(old_version_file, os.F_OK):
old_version = open(old_version_file).readlines()[0].strip()

if old_version.startswith('2') or old_version.startswith('eee-2'):
self.comment('DISABLE_ISCSI')
self._read_config_data(oldconfig)
if not self.has_key('DISABLE_ISCSI'):
self['DISABLE_ISCSI'] = 'Y'
else:
self._read_config_data(oldconfig)
File renamed without changes.
Expand Up @@ -37,10 +37,10 @@ class DescribeEucalyptus(eucadmin.describerequest.DescribeRequest):
def cli_formatter(self, data):
clouds = getattr(data, 'euca:registered')
for cloud in clouds:
print 'CLOUDS\t%s\t%s\t%s\t%s\t%s' % (cluster['euca:partition'],
cluster['euca:name'],
cluster['euca:hostName'],
cluster['euca:state'],
cluster['euca:detail'])
print 'CLOUDS\t%s\t%s\t%s\t%s\t%s' % (cloud['euca:partition'],
cloud['euca:name'],
cloud['euca:hostName'],
cloud['euca:state'],
cloud['euca:detail'])


18 changes: 0 additions & 18 deletions clc/eucadmin/eucadmin/enable.py
Expand Up @@ -28,24 +28,6 @@
#
# Author: Mitch Garnaat mgarnaat@eucalyptus.com

# # enable/disable services
# if [ -r $EUCALYPTUS/var/lib/eucalyptus/services ]; then
# for x in `cat $EUCALYPTUS/var/lib/eucalyptus/services` ; do
# TO_START="$TO_START $x"
# done
# fi
# if [ -n "$DISABLED" -o -n "$ENABLED" ]; then
# for x in $TO_START $ENABLED ; do
# to_start="Y"
# for y in $DISABLED ; do
# if [ "$x" = "$y" ]; then
# to_start="N"
# fi
# done
# [ $to_start = "Y" ] && echo $x
# done | sort | uniq > $EUCALYPTUS/var/lib/eucalyptus/services
# fi

import os

class Enable(object):
Expand Down
File renamed without changes.
Expand Up @@ -200,6 +200,12 @@ public boolean equals( Object obj ) {
if ( protocol == null ) {
if ( other.protocol != null ) return false;
} else if ( !protocol.equals( other.protocol ) ) return false;
if ( ipRanges == null ) {
if (other.ipRanges != null ) return false;
} else if ( !ipRanges.equals( other.ipRanges ) ) return false;
if ( networkPeers == null ) {
if (other.networkPeers != null ) return false;
} else if ( !networkPeers.equals( other.networkPeers ) ) return false;
return true;
}

Expand Down

0 comments on commit 2f32bf3

Please sign in to comment.