fix: get logs with non-root user
This commit is contained in:
parent
139e258664
commit
fe22dfc531
@ -91,15 +91,35 @@ class GetLogs extends Component
|
|||||||
if ($this->container) {
|
if ($this->container) {
|
||||||
if ($this->showTimeStamps) {
|
if ($this->showTimeStamps) {
|
||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} -t {$this->container}");
|
$command = "docker service logs -n {$this->numberOfLines} -t {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
} else {
|
} else {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} -t {$this->container}");
|
$command = "docker logs -n {$this->numberOfLines} -t {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($this->server->isSwarm()) {
|
if ($this->server->isSwarm()) {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker service logs -n {$this->numberOfLines} {$this->container}");
|
$command = "docker service logs -n {$this->numberOfLines} {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
} else {
|
} else {
|
||||||
$sshCommand = generateSshCommand($this->server, "docker logs -n {$this->numberOfLines} {$this->container}");
|
$command = "docker logs -n {$this->numberOfLines} {$this->container}";
|
||||||
|
if ($this->server->isNonRoot()) {
|
||||||
|
$command = parseCommandsByLineForSudo(collect($command), $this->server);
|
||||||
|
$command = $command[0];
|
||||||
|
}
|
||||||
|
$sshCommand = generateSshCommand($this->server, $command);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($refresh) {
|
if ($refresh) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user