New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calculate time on remote end #64
Conversation
In case of timezone (not time) difference between source and destination we can end up with invalid testing time. Touch command takes [[CC]YY]MMDDhhmm[.ss], which if calculated locally might end up being in the past on remote end (since there is no timezone information). This fixes it by passing timestamp and calculating time on remote end.
transport.run! | ||
end | ||
end | ||
|
||
private | ||
|
||
def touchcmd | ||
touch = Base64.encode64("touch --date \"$(date -d @" + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't work on macs:
[root@mactest989.06.ash3 ~]# date -d @1478049513 +'%Y-%m-%d %T'
usage: date [-jnu] [-d dst] [-r seconds] [-t west] [-v[+|-]val[ymwdHMS]] ...
[-f fmt date | [[[mm]dd]HH]MM[[cc]yy][.ss]] [+format]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nor does your touch command:
[root@mactest989.06.ash3 ~]# touch --date
touch: illegal option -- -
usage:
touch [-A [-][[hh]mm]SS] [-acfhm] [-r file] [-t [[CC]YY]MMDDhhmm[.SS]] file ...
@jaymzh works on Darwin now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks sane to me... minus the style thing
"#{TasteTester::Config.testing_end_time.to_i} +'%Y%m%d%H%M.%S')\"" + | ||
" #{TasteTester::Config.timestamp_file}; else touch --date \"$(date -d @" + | ||
"#{TasteTester::Config.testing_end_time.to_i} +'%Y-%m-%d %T')\"" + | ||
" #{TasteTester::Config.timestamp_file}; fi").delete("\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you want chomp
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, this needs to be contiguous string with no newlines, which Base64.encode64 sprinkles all over
In case of timezone (not time) difference between source and destination we can end up with invalid testing time. Touch command takes [[CC]YY]MMDDhhmm[.ss], which if calculated locally might end up being in the past on remote end (since there is no timezone information).
This fixes it by passing timestamp and calculating time on remote end.