hobos: change command to only deploy one instance, given as arg (#6486)

This commit is contained in:
Frédéric Péters 2015-02-12 10:38:02 +01:00
parent 0a58b8fc18
commit edbd295877
1 changed files with 29 additions and 30 deletions

View File

@ -41,45 +41,44 @@ class CmdCheckHobos(Command):
pub = publisher.WcsPublisher.create_publisher()
global_app_dir = pub.app_dir
base_url = args[0]
if not args or args[0] == '-':
if args[1] == '-':
# get environment definition from stdin
self.all_services = json.load(sys.stdin)
else:
self.all_services = json.load(file(args[0]))
self.all_services = json.load(file(args[1]))
services = [x for x in self.all_services.get('services', []) if \
x.get('service-id') == 'wcs']
service = [x for x in self.all_services.get('services', []) if \
x.get('service-id') == 'wcs' and x.get('base_url') == base_url][0]
# initialize all instances of w.c.s.
for service in services:
pub.app_dir = os.path.join(global_app_dir,
self.get_instance_path(service))
if not os.path.exists(pub.app_dir):
print 'initializing instance in', pub.app_dir
os.mkdir(pub.app_dir)
pub.initialize_app_dir()
pub.app_dir = os.path.join(global_app_dir,
self.get_instance_path(service))
if not os.path.exists(pub.app_dir):
print 'initializing instance in', pub.app_dir
os.mkdir(pub.app_dir)
pub.initialize_app_dir()
skeleton_filepath = os.path.join(global_app_dir, 'skeletons',
service.get('template_name'))
if os.path.exists(skeleton_filepath):
pub.import_zip(file(skeleton_filepath))
new_site = True
else:
print 'updating instance in', pub.app_dir
pub.set_config()
new_site = False
skeleton_filepath = os.path.join(global_app_dir, 'skeletons',
service.get('template_name'))
if os.path.exists(skeleton_filepath):
pub.import_zip(file(skeleton_filepath))
new_site = True
else:
print 'updating instance in', pub.app_dir
pub.set_config()
new_site = False
try:
self.configure_site_options(service, pub)
except NoChange:
print ' skipping'
continue
try:
self.configure_site_options(service, pub)
except NoChange:
print ' skipping'
return
self.update_configuration(service, pub)
self.configure_authentication_methods(service, pub)
if new_site:
self.configure_sql(service, pub)
self.update_configuration(service, pub)
self.configure_authentication_methods(service, pub)
if new_site:
self.configure_sql(service, pub)
def update_configuration(self, service, pub):
if not pub.cfg.get('misc'):