Ejemplo n.º 1
0
    def install_reqs(self):
        ans = input("Do you want me to try and fix that for you with the\
 commands above? [yY/nN]: ")
        if ans.lower() == "y":
            process.execute_cmd(self.installation, self.args['hosts'])
        else:
            LOG.info("Fine then, have a nice day :)")
            sys.exit(2)
Ejemplo n.º 2
0
 def run(self):
     """Execution docker-compose."""
     try:
         cmds = self.vars['execute']
     except KeyError:
         cmds = self.RUN
     if "hosts" in self.args:
         results = process.execute_cmd(commands=cmds,
                                       hosts=self.args['hosts'],
                                       cwd=self.execution_dir)
     else:
         results = process.execute_cmd(commands=cmds,
                                       cwd=self.execution_dir)
     [success_or_exit(res.exited) for res in results]
     return results
Ejemplo n.º 3
0
def main(args):
    """Runner main entry."""
    if not args.scenario and not args.commands and not args.vars:
        LOG.error(missing_scenario_arg())
        sys.exit(2)
    if args.scenario and not args.platform:
        args.platform = utils.guess_platform(args.scenario)
    if not args.commands and not args.scenario and not args.platform:
        success_or_exit(
            1, "Couldn't figure out which platform to use. \
Please specify --platform")
    if not args.commands:
        Platform = getattr(
            importlib.import_module("infraform.platforms.{}".format(
                args.platform)), args.platform.capitalize())
        platform = Platform(args=args)
        platform.prepare()
        platform.run()
    else:
        process.execute_cmd(args.commands, args.hosts)
Ejemplo n.º 4
0
 def check_platform_avaiable(self):
     """Validates the platform specified is ready for use."""
     results = process.execute_cmd(self.READINESS_CHECK,
                                   self.args['hosts'],
                                   warn_on_fail=True,
                                   hide_output=True)
     if not results or any(res.exited for res in results):
         LOG.error(
             req_exc.missing_reqs(self.installation,
                                  hosts=self.args['hosts'],
                                  failed_cmds=[
                                      res.command for res in results
                                      if res.exited != 0
                                  ]))
         self.install_reqs()
Ejemplo n.º 5
0
 def run(self):
     process.execute_cmd(["chmod +x {}".format(self.scenario_f),
                          "./{0}".format(self.scenario_f)])
Ejemplo n.º 6
0
 def run(self):
     process.execute_cmd(['terraform apply'])
Ejemplo n.º 7
0
 def prepare(self):
     process.execute_cmd(['terraform init'])