Skip to content

Use --timestamp in placeholders if given#5472

Merged
ThomasWaldmann merged 2 commits intoborgbackup:masterfrom
twilligon:timestamp-aware-placeholders
Nov 3, 2020
Merged

Use --timestamp in placeholders if given#5472
ThomasWaldmann merged 2 commits intoborgbackup:masterfrom
twilligon:timestamp-aware-placeholders

Conversation

@twilligon
Copy link
Contributor

Fixes #5189. {now} and {utcnow} will take the value of --timestamp if given. I also added a test for this functionality.

@ThomasWaldmann
Copy link
Member

Looks good. Some questions:

  • is location the only thing using the placeholders? maybe check which callers of replace_placeholders are relevant.
  • what tzoffset does your test system have?

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Nov 3, 2020

Also: can you please rebase on current master and push -f, so that the CI via github workflows kicks in?

@twilligon twilligon force-pushed the timestamp-aware-placeholders branch from af4204b to 3644bd1 Compare November 3, 2020 21:00
@twilligon
Copy link
Contributor Author

twilligon commented Nov 3, 2020

Location and some tests are the only things using replace_placeholders, aside from this part in remote.py:

borg/src/borg/remote.py

Lines 687 to 689 in 47e96bc

remote_path = args.remote_path or os.environ.get('BORG_REMOTE_PATH', 'borg')
remote_path = replace_placeholders(remote_path)
return env_vars + [remote_path, 'serve'] + opts

I'm not sure if getting the value from --timestamp makes sense here; I don't think so.

My system has tzoffset -08:00 but that shouldn't matter as all the times involved are UTC. I tried changing my system's timezone and rerunning the tests, everything worked the same.

@ThomasWaldmann ThomasWaldmann merged commit dea3f01 into borgbackup:master Nov 3, 2020
@ThomasWaldmann
Copy link
Member

Thanks! Would you like to do a backport to 1.1-maint, so it gets into next 1.1.x release?

@ThomasWaldmann
Copy link
Member

https://github.com/borgbackup/borg/pull/5472/checks?check_run_id=1349770343

hmm, can we find out why ubuntu / py37 is hanging?

@twilligon twilligon deleted the timestamp-aware-placeholders branch November 4, 2020 18:16
@twilligon
Copy link
Contributor Author

Sure, I'll backport.

@twilligon
Copy link
Contributor Author

I can't reproduce the py37 hang on my local machine, although I'm not running Ubuntu. But the 1.1 backport passed CI just fine.

@twilligon twilligon mentioned this pull request Nov 5, 2020
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.

--timestamp-aware {now}/{utcnow} placeholders

2 participants