1 | <?php |
||
14 | class DnsDock extends InstallerTask implements DependentChainProcessInterface |
||
15 | { |
||
16 | /** |
||
17 | * @var ProcessRunner |
||
18 | */ |
||
19 | private $processRunner; |
||
20 | /** |
||
21 | * @var UserInteraction |
||
22 | */ |
||
23 | private $userInteraction; |
||
24 | /** |
||
25 | * @var SshClient |
||
26 | */ |
||
27 | private $sshClient; |
||
28 | /** |
||
29 | * @var Machine |
||
30 | */ |
||
31 | private $machine; |
||
32 | |||
33 | /** |
||
34 | * @param SshClient $sshClient |
||
35 | * @param UserInteraction $userInteraction |
||
36 | * @param ProcessRunner $processRunner |
||
37 | * @param Machine $machine |
||
38 | */ |
||
39 | public function __construct(SshClient $sshClient, UserInteraction $userInteraction, ProcessRunner $processRunner, Machine $machine) |
||
40 | { |
||
41 | $this->sshClient = $sshClient; |
||
42 | $this->userInteraction = $userInteraction; |
||
43 | $this->processRunner = $processRunner; |
||
44 | $this->machine = $machine; |
||
45 | } |
||
46 | |||
47 | /** |
||
48 | * {@inheritdoc} |
||
49 | */ |
||
50 | public function run() |
||
51 | { |
||
52 | $this->userInteraction->writeTitle('Configure DNS resolution for Docker containers'); |
||
53 | |||
54 | $needMachineRestart = $this->configureVirtualMachine(); |
||
55 | $this->configureHostMachineResolution(); |
||
56 | |||
57 | if ($needMachineRestart) { |
||
58 | $this->restartMachine(); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * @return bool |
||
64 | */ |
||
65 | private function dnsDockerIsInStartupConfiguration() |
||
69 | |||
70 | /** |
||
71 | * @return bool |
||
72 | */ |
||
73 | private function hasDockerExtraArgs() |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function dependsOn() |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function getName() |
||
93 | |||
94 | /** |
||
95 | * @return bool |
||
96 | */ |
||
97 | private function configureVirtualMachine() |
||
124 | |||
125 | private function configureHostMachineResolution() |
||
130 | |||
131 | private function restartMachine() |
||
139 | } |
||
140 |