62 if ($this->agent !== null) {
72 ->addArgument(
"config", InputArgument::REQUIRED,
"Configuration file for the Setup")
73 ->addOption(
"config", null, InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY,
"Define fields in the configuration file that should be overwritten, e.g. \"a.b.c=foo\"", [])
74 ->addOption(
"yes",
"y", InputOption::VALUE_NONE,
"Confirm every message of the setup.");
77 public function execute(InputInterface $input, OutputInterface $output)
88 if (count($this->preconditions) > 0) {
91 ...$this->preconditions
97 while ($goals->valid()) {
98 $current = $goals->current();
99 $io->startObjective($current->getLabel(), $current->isNotable());
101 $environment = $current->achieve($environment);
102 $io->finishedLastObjective($current->getLabel(), $current->isNotable());
103 $goals->setEnvironment($environment);
105 $goals->markAsFailed($current);
106 $io->error($e->getMessage());
107 $io->failedLastObjective($current->getLabel());
119 return $input->getOption(
"yes") ??
false;
124 if ($this->
shouldSayYes($input) || ($input->hasOption(
"no-interaction") && $input->getOption(
"no-interaction"))) {
128 " ILIAS Copyright (C) 1998-2019 ILIAS Open Source e.V. - GPLv3\n\n" .
129 "This program comes with ABSOLUTELY NO WARRANTY. This is free software,\n" .
130 "and you are welcome to redistribute it under certain conditions. Look\n" .
131 "into the LICENSE file for details." 145 $config_file = $input->getArgument(
"config");
146 $config_overwrites_raw = $input->getOption(
"config");
147 $config_overwrites = [];
148 foreach ($config_overwrites_raw as $o) {
149 list($k, $v) = explode(
"=", $o);
150 $config_overwrites[$k] = $v;
152 $config_content = $this->config_reader->readConfigFile($config_file, $config_overwrites);
153 $trafo = $this->agent->getArrayToConfigTransformation();
154 return $trafo->transform($config_content);
Read a json-formatted config from a file and overwrite some fields.
Wrapper around symfonies input and output facilities to provide just the functionality required for t...
An objective is a desired state of the system that is supposed to be created by the setup...
A agent is some component that performs part of the setup process.
printLicenseMessage(IOWrapper $io, InputInterface $input)
hasConfig()
Does this agent require a configuration?
$preconditions
var Objective[]
Signals that some goal won't be achievable by actions of the system ever.
printOutroMessage(IOWrapper $io)
A wrapper around an objective that adds some preconditions.
getObjective(Agent $agent, ?Config $config)
__construct(callable $lazy_agent, ConfigReader $config_reader, array $preconditions)
execute(InputInterface $input, OutputInterface $output)
__construct(Container $dic, ilPlugin $plugin)
Tries to enumerate all preconditions for the given objective, where the ones that can be achieved (i...
buildEnvironment(Agent $agent, ?Config $config, IOWrapper $io)
A configuration for the setup.
getRequestedConfirmation()
shouldSayYes(InputInterface $input)
Signals that a necessary confirmation from the admin is missing.
printIntroMessage(IOWrapper $io)
readAgentConfig(Agent $agent, InputInterface $input)