Skip to content

Commit

Permalink
[refactor-runner-adxt-783] renamed: MoveRemoteFile -> MoveFile
Browse files Browse the repository at this point in the history
  • Loading branch information
CelianR committed Dec 23, 2024
1 parent 36bcf5a commit d1ef99f
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/command/osCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type OSCommand interface {
remotePath pulumi.StringInput,
useSudo bool,
opts ...pulumi.ResourceOption) (Command, error)
MoveRemoteFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error)
MoveFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error)

BuildCommandString(
command pulumi.StringInput,
Expand Down
2 changes: 1 addition & 1 deletion components/command/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ func (r *RemoteRunner) CopyUnixFile(name string, src, dst pulumi.StringInput, op
return nil, err
}

moveCommand, err := r.OsCommand().MoveRemoteFile(r, name, tempRemotePath, dst, true, utils.MergeOptions(opts, utils.PulumiDependsOn(tempCopyFile))...)
moveCommand, err := r.OsCommand().MoveFile(r, name, tempRemotePath, dst, true, utils.MergeOptions(opts, utils.PulumiDependsOn(tempCopyFile))...)
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion components/command/unixOSCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func formatCommandIfNeeded(command pulumi.StringInput, sudo bool, password bool,
return formattedCommand
}

func (fs unixOSCommand) MoveRemoteFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error) {
func (fs unixOSCommand) MoveFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error) {
backupPath := pulumi.Sprintf("%v.%s", destination, backupExtension)
copyCommand := pulumi.Sprintf(`cp "%v" "%v"`, source, destination)
createCommand := pulumi.Sprintf(`bash -c 'if [ -f "%v" ]; then mv -f "%v" "%v"; fi; %v'`, destination, destination, backupPath, copyCommand)
Expand Down
2 changes: 1 addition & 1 deletion components/command/windowsOSCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func (fs windowsOSCommand) NewCopyFile(runner Runner, name string, localPath, re
return runner.CopyWindowsFile(name, localPath, remotePath, opts...)
}

func (fs windowsOSCommand) MoveRemoteFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error) {
func (fs windowsOSCommand) MoveFile(runner Runner, name string, source, destination pulumi.StringInput, sudo bool, opts ...pulumi.ResourceOption) (Command, error) {
backupPath := pulumi.Sprintf("%v.%s", destination, backupExtension)
copyCommand := pulumi.Sprintf(`Copy-Item -Path '%v' -Destination '%v'`, source, destination)
createCommand := pulumi.Sprintf(`if (Test-Path '%v') { Move-Item -Force -Path '%v' -Destination '%v' }; %v`, destination, destination, backupPath, copyCommand)
Expand Down

0 comments on commit d1ef99f

Please sign in to comment.