예제 #1
0
 def start(self):
     #ensure it was installed
     if(not self._was_installed()):
         msg = "Can not start %s since it was not installed" % (self.component_name)
         raise StartException(msg)
     #select how we are going to start it
     startercls = self._getstartercls()
     starter = startercls()
     #start all apps
     #this fns list will have info about what was started
     fns = list()
     apps = self._get_apps_to_start()
     for app in apps:
         #adjust the program options now that we have real locations
         params = self._get_param_map(app)
         program_opts = self._get_app_options(app)
         if(params and program_opts):
             adjusted_opts = list()
             for opt in program_opts:
                 adjusted_opts.append(param_replace(opt, params))
             program_opts = adjusted_opts
         LOG.info("Starting %s with options [%s]" % (app, ", ".join(program_opts)))
         #start it with the given settings
         fn = starter.start(app, app, *program_opts, app_dir=self.appdir, trace_dir=self.tracedir)
         if(fn and len(fn)):
             fns.append(fn)
             LOG.info("Started %s, details are in %s" % (app, fn))
             #this trace is used to locate details about what to stop
             self.tracewriter.started_info(app, fn)
         else:
             LOG.info("Started %s" % (app))
     return fns
예제 #2
0
 def configure(self):
     dirsmade = mkdirslist(self.cfgdir)
     self.tracewriter.dir_made(*dirsmade)
     configs = self._get_config_files()
     if(configs and len(configs)):
         for fn in configs:
             parameters = self._get_param_map(fn)
             sourcefn = joinpths(STACK_CONFIG_DIR, self.component_name, fn)
             tgtfn = joinpths(self.cfgdir, fn)
             LOG.info("Configuring template file %s" % (sourcefn))
             contents = load_file(sourcefn)
             LOG.info("Replacing parameters in file %s" % (sourcefn))
             LOG.debug("Replacements = %s" % (parameters))
             contents = param_replace(contents, parameters)
             LOG.debug("Applying side-effects of param replacement for template %s" % (sourcefn))
             contents = self._config_adjust(contents, fn)
             LOG.info("Writing configuration file %s" % (tgtfn))
             write_file(tgtfn, contents)
             #this trace is used to remove the files configured
             self.tracewriter.cfg_write(tgtfn)
     return self.tracedir
예제 #3
0
 def start(self):
     #ensure it was installed
     if (not self._was_installed()):
         msg = "Can not start %s since it was not installed" % (
             self.component_name)
         raise StartException(msg)
     #select how we are going to start it
     startercls = self._getstartercls()
     starter = startercls()
     #start all apps
     #this fns list will have info about what was started
     fns = list()
     apps = self._get_apps_to_start()
     for app in apps:
         #adjust the program options now that we have real locations
         params = self._get_param_map(app)
         program_opts = self._get_app_options(app)
         if (params and program_opts):
             adjusted_opts = list()
             for opt in program_opts:
                 adjusted_opts.append(param_replace(opt, params))
             program_opts = adjusted_opts
         LOG.info("Starting %s with options [%s]" %
                  (app, ", ".join(program_opts)))
         #start it with the given settings
         fn = starter.start(app,
                            app,
                            *program_opts,
                            app_dir=self.appdir,
                            trace_dir=self.tracedir)
         if (fn and len(fn)):
             fns.append(fn)
             LOG.info("Started %s, details are in %s" % (app, fn))
             #this trace is used to locate details about what to stop
             self.tracewriter.started_info(app, fn)
         else:
             LOG.info("Started %s" % (app))
     return fns
예제 #4
0
 def configure(self):
     dirsmade = mkdirslist(self.cfgdir)
     self.tracewriter.dir_made(*dirsmade)
     configs = self._get_config_files()
     if (configs and len(configs)):
         for fn in configs:
             parameters = self._get_param_map(fn)
             sourcefn = joinpths(STACK_CONFIG_DIR, self.component_name, fn)
             tgtfn = joinpths(self.cfgdir, fn)
             LOG.info("Configuring template file %s" % (sourcefn))
             contents = load_file(sourcefn)
             LOG.info("Replacing parameters in file %s" % (sourcefn))
             LOG.debug("Replacements = %s" % (parameters))
             contents = param_replace(contents, parameters)
             LOG.debug(
                 "Applying side-effects of param replacement for template %s"
                 % (sourcefn))
             contents = self._config_adjust(contents, fn)
             LOG.info("Writing configuration file %s" % (tgtfn))
             write_file(tgtfn, contents)
             #this trace is used to remove the files configured
             self.tracewriter.cfg_write(tgtfn)
     return self.tracedir