Skip to content

Commit d454f2b

Browse files
committed
Merge branch 'hotfix/3.5.21'
2 parents 7a35390 + ce5a51d commit d454f2b

File tree

6 files changed

+23
-6
lines changed

6 files changed

+23
-6
lines changed

Changelog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## 3.5.21 / 2020-10-11
4+
5+
### Fixed:
6+
* Fix regression with `get:file`, `put:file` and `copy-from`
7+
38
## 3.5.20 / 2020-10-11
49

510
### New:

src/Command/GetFileCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
5151

5252
$context = $this->createContext($input, $output);
5353
$context->set('sourceFile', $file);
54-
$context->set('destFile', getcwd());
54+
$context->set('destFile', getcwd() . '/' . basename($file));
5555

5656
$context->io()->comment('Get file `' . $file . '` from `' . $this->getHostConfig()['configName']. '`');
5757

5858
$this->getMethods()->runTask('getFile', $this->getHostConfig(), $context);
5959

60-
return $context->getResult('exitCode', 0);
60+
$return_code = $context->getResult('exitCode', 0);
61+
if (!$return_code) {
62+
$context->io()->success(sprintf(
63+
'`%s` copied to `%s`',
64+
$file,
65+
$context->getResult('targetFile', 'unknown')
66+
));
67+
}
68+
return $return_code;
6169
}
6270
}

src/Command/PutFileCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
6767
$context->getResult('targetFile', 'unknown')
6868
));
6969
}
70+
return $return_code;
7071
}
7172
}

src/Method/FilesMethod.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ public function putFile(HostConfig $config, TaskContextInterface $context)
4747
}
4848
/** @var ShellProviderInterface $shell */
4949
$shell = $this->getShell($config, $context);
50-
$shell->putFile($source, $config['rootFolder'], $context, true);
50+
$target_file_path = $config['rootFolder'] . '/' . basename($source);
51+
$shell->putFile($source, $target_file_path, $context, true);
52+
$context->setResult('targetFile', $target_file_path);
5153
}
5254

5355
public function getFile(HostConfig $config, TaskContextInterface $context)
@@ -61,6 +63,7 @@ public function getFile(HostConfig $config, TaskContextInterface $context)
6163
/** @var ShellProviderInterface $shell */
6264
$shell = $this->getShell($config, $context);
6365
$shell->getFile($source, $dest, $context, true);
66+
$context->setResult('targetFile', $dest);
6467
}
6568

6669
public function backup(HostConfig $host_config, TaskContextInterface $context)

src/ShellProvider/KubectlShellProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function getPutFileCommand(string $source, string $dest): array
147147
$command = $this->getKubeCmd();
148148
$command[] = 'cp';
149149
$command[] = trim($source);
150-
$command[] = $this->hostConfig['kube']['podForCli'] . ':' . trim($dest) . '/' . basename($source);
150+
$command[] = $this->hostConfig['kube']['podForCli'] . ':' . trim($dest);
151151

152152
return $command;
153153
}
@@ -162,7 +162,7 @@ public function getGetFileCommand(string $source, string $dest): array
162162
$command = $this->getKubeCmd();
163163
$command[] = 'cp';
164164
$command[] = $this->hostConfig['kube']['podForCli'] . ':' . trim($source);
165-
$command[] = trim($dest) . '/' . basename($source);
165+
$command[] = trim($dest);
166166

167167
return $command;
168168
}

src/Utilities/Utilities.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Utilities
1010
{
1111

12-
const FALLBACK_VERSION = '3.5.20';
12+
const FALLBACK_VERSION = '3.5.21';
1313
const COMBINED_ARGUMENTS = 'combined';
1414
const UNNAMED_ARGUMENTS = 'unnamedArguments';
1515

0 commit comments

Comments
 (0)