Skip to content

Conversation

@lazyatom
Copy link
Contributor

In logging, the command UUID displayed in the "command start" phase was sometimes different to that displayed with the output of the command. This is because the backend can call .with_redaction on a command when logging the start, and this causes the command to be duplicated. However, if the uuid method hadn't been called before that point, the copy command would generate its own UUID, distinct from the original command.

This change avoids that by eagerly calculating the UUID when the command is created, so that any copied objects share the same UUID.

Fixes #454

In logging, the command UUID displayed in the "command start" phase
was sometimes different to that displayed with the output of the
command. This is because the backend can call `.with_redaction` on a
command when logging the start, and this causes the command to be
duplicated. However, if the `uuid` method hadn't been called before
that point, the copy command would generate its own UUID, distinct
from the original command.

This change avoids that by eagerly calculating the UUID when the
command is created, so that any copied objects share the same UUID.
@mattbrictson
Copy link
Member

Excellent PR, thanks! Congratulations on your first code contribution to the project 🎉

@mattbrictson mattbrictson merged commit a703af2 into capistrano:master Feb 21, 2019
@leehambley
Copy link
Member

Kudos @lazyatom really nice fix, practical and has flown under the radar for circa 5 years! 🥇

@lazyatom
Copy link
Contributor Author

My pleasure, and thanks for your help and work on this project! 🎉

@lazyatom lazyatom deleted the ensure-command-logs-share-same-uuid branch February 21, 2019 17:24
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Nov 18, 2019
Update ruby-sshkit package to 1.20.0.


## [1.20.0][] (2019-08-03)

  * [#468](capistrano/sshkit#468): Make `upload!` take a `:verbosity` option like `exec` does - [@grosser](https://github.com/grosser)

## [1.19.1][] (2019-07-02)

  * [#465](capistrano/sshkit#456): Fix a regression in 1.19.0 that prevented `~` from being used in Capistrano paths, e.g. `:deploy_to`, etc. - [@grosser](https://github.com/grosser)

## [1.19.0][] (2019-06-30)

  * [#455](capistrano/sshkit#455): Ensure UUID of commands are stable in logging - [@lazyatom](https://github.com/lazyatom)
  * [#453](capistrano/sshkit#453): `as` and `within` now properly escape their user/group/path arguments, and the command nested within an `as` block is now properly escaped before passing to `sh -c`. In the unlikely case that you were manually escaping commands passed to SSHKit as a workaround, you will no longer need to do this. See [#458](capistrano/sshkit#458) for examples of what has been fixed. - [@grosser](https://github.com/grosser)
  * [#460](capistrano/sshkit#460): Handle IPv6 addresses without port - [@will-in-wi](https://github.com/will-in-wi)

## [1.18.2][] (2019-02-03)

  * [#448](capistrano/sshkit#448): Fix misbehaving connection eviction loop when disabling connection pooling - [Sebastian Cohnen](https://github.com/tisba)

## [1.18.1][] (2019-01-26)

  * [#447](capistrano/sshkit#447): Fix broken thread safety by widening critical section - [Takumasa Ochi](https://github.com/aeroastro)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants