Example #1
0
 def install(self):
     pres = PkgInstallComponent.install(self)
     #extra actions to ensure we are granted access
     dbtype = self.cfg.get("db", "type")
     dbactions = DB_ACTIONS.get(dbtype)
     if(dbactions and dbactions.get('grant_all')):
         #update the DB to give user 'USER'@'%' full control of the all databases:
         grant_cmd = dbactions.get('grant_all')
         params = self._get_param_map()
         cmds = list()
         cmds.append({
             'cmd': grant_cmd,
             'run_as_root': False,
         })
         #shell seems to be needed here
         #since python escapes this to much...
         execute_template(*cmds, params=params, shell=True)
     #special mysql actions
     if(dbactions and dbtype == MYSQL):
         cmd = dbactions.get('host_adjust')
         if(cmd):
             execute(*cmd, run_as_root=True, shell=True)
     #restart it to make sure all good
     self.runtime.restart()
     return pres
Example #2
0
 def install(self):
     pres = PkgInstallComponent.install(self)
     #extra actions to ensure we are granted access
     dbtype = self.cfg.get("db", "type")
     dbactions = DB_ACTIONS.get(dbtype)
     if (dbactions and dbactions.get('grant_all')):
         #update the DB to give user 'USER'@'%' full control of the all databases:
         grant_cmd = dbactions.get('grant_all')
         params = self._get_param_map()
         cmds = list()
         cmds.append({
             'cmd': grant_cmd,
             'run_as_root': False,
         })
         #shell seems to be needed here
         #since python escapes this to much...
         execute_template(*cmds, params=params, shell=True)
     #special mysql actions
     if (dbactions and dbtype == MYSQL):
         cmd = dbactions.get('host_adjust')
         if (cmd):
             execute(*cmd, run_as_root=True, shell=True)
     #restart it to make sure all good
     self.runtime.restart()
     return pres
Example #3
0
 def start(self, name, program, *args, **kargs):
     app_dir = kargs.get('app_dir')
     params = dict()
     params['NAME'] = name + NAME_POSTFIX
     runcmd = SCREEN_MAKE + [program] + list(args)
     cmds = [{'cmd':runcmd}]
     execute_template(*cmds, params=params, cwd=app_dir, **kargs)
     return None
Example #4
0
 def post_install(self, pkgs, installparams=None):
     pkgnames = sorted(pkgs.keys())
     for name in pkgnames:
         packageinfo = pkgs.get(name)
         postinstallcmds = packageinfo.get(POST_INSTALL)
         if(postinstallcmds and len(postinstallcmds)):
             LOG.info("Running post-install commands for package %s." % (name))
             execute_template(*postinstallcmds, params=installparams)
Example #5
0
 def start(self, name, program, *args, **kargs):
     app_dir = kargs.get('app_dir')
     params = dict()
     params['NAME'] = name + NAME_POSTFIX
     runcmd = SCREEN_MAKE + [program] + list(args)
     cmds = [{'cmd': runcmd}]
     execute_template(*cmds, params=params, cwd=app_dir, **kargs)
     return None
Example #6
0
def create_db(cfg, dbname):
    dbtype = cfg.get("db", "type")
    dbactions = DB_ACTIONS.get(dbtype)
    if(dbactions and dbactions.get('create_db')):
        createcmd = dbactions.get('create_db')
        params = dict()
        params['PASSWORD'] = cfg.getpw("passwords", "sql")
        params['USER'] = cfg.get("db", "sql_user")
        params['DB'] = dbname
        cmds = list()
        cmds.append({
            'cmd': createcmd,
            'run_as_root': False,
        })
        execute_template(*cmds, params=params)
    else:
        msg = BASE_ERROR % ('create', dbtype)
        raise NotImplementedError(msg)
Example #7
0
def create_db(cfg, dbname):
    dbtype = cfg.get("db", "type")
    dbactions = DB_ACTIONS.get(dbtype)
    if (dbactions and dbactions.get('create_db')):
        createcmd = dbactions.get('create_db')
        params = dict()
        params['PASSWORD'] = cfg.getpw("passwords", "sql")
        params['USER'] = cfg.get("db", "sql_user")
        params['DB'] = dbname
        cmds = list()
        cmds.append({
            'cmd': createcmd,
            'run_as_root': False,
        })
        execute_template(*cmds, params=params)
    else:
        msg = BASE_ERROR % ('create', dbtype)
        raise NotImplementedError(msg)
Example #8
0
 def _setup_data(self):
     params = self._get_param_map()
     cmds = _keystone_setup_cmds(self.othercomponents)
     execute_template(*cmds, params=params, ignore_missing=True)
Example #9
0
 def _setup_data(self):
     params = self._get_param_map()
     cmds = _keystone_setup_cmds(self.othercomponents)
     execute_template(*cmds, params=params, ignore_missing=True)