def __init__(self, answers, APP, nodeps=False, update=False, target_path=None, dryrun=False, **kwargs): self.dryrun = dryrun self.kwargs = kwargs app = APP #FIXME self.nulecule_base = Nulecule_Base(nodeps, update, target_path, dryrun) if os.path.exists(app): logger.info("App path is %s, will be populated to %s", app, target_path) app = self._loadApp(app) else: logger.info("App name is %s, will be populated to %s", app, target_path) if not target_path: if self.nulecule_base.app_path: self.nulecule_base.target_path = self.nulecule_base.app_path else: self.nulecule_base.target_path = os.getcwd() self.utils = Utils(self.nulecule_base.target_path) self.nulecule_base.app = app self.answers_file = answers self.docker_cli = Utils.getDockerCli(self.dryrun)
def __init__(self, answers, APP, dryrun=False, debug=False, stop=False, answers_format=ANSWERS_FILE_SAMPLE_FORMAT, **kwargs): self.debug = debug self.dryrun = dryrun self.stop = stop self.kwargs = kwargs if "answers_output" in kwargs: self.answers_output = kwargs["answers_output"] if os.environ and "IMAGE" in os.environ: self.app_path = APP APP = os.environ["IMAGE"] del os.environ["IMAGE"] elif "image" in kwargs: logger.warning("Setting image to %s" % kwargs["image"]) self.app_path = APP APP = kwargs["image"] del kwargs["image"] self.kwargs = kwargs if APP and os.path.exists(APP): self.app_path = APP else: if not self.app_path: self.app_path = os.getcwd() install = Install(answers, APP, dryrun=dryrun, target_path=self.app_path, answers_format=answers_format) install.install() printStatus("Install Successful.") self.nulecule_base = Nulecule_Base(target_path=self.app_path, dryrun=dryrun, file_format=answers_format) if "ask" in kwargs: self.nulecule_base.ask = kwargs["ask"] workdir = None if "workdir" in kwargs: workdir = kwargs["workdir"] self.utils = Utils(self.app_path, workdir) if "workdir" not in kwargs: kwargs["workdir"] = self.utils.workdir self.answers_file = answers self.plugin = Plugin() self.plugin.load_plugins()