Merge pull request #1246 from gprestes/gprestes-patch-1

Restore filename to follow the hosts-%Y-%m-%d-%H-%M-%S format
This commit is contained in:
Steven Black 2020-04-24 22:31:18 -04:00 committed by GitHub
commit 68c9d2f6b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -1376,7 +1376,7 @@ class TestRemoveOldHostsFile(BaseMockDir):
contents = f.read()
self.assertEqual(contents, "")
@mock.patch("time.strftime", return_value="-new")
@mock.patch("time.strftime", return_value="new")
def test_remove_hosts_file_backup(self, _):
with open(self.hosts_file, "w") as f:
f.write("foo")

View File

@ -1345,7 +1345,7 @@ def remove_old_hosts_file(old_file_path, backup):
open(old_file_path, "a").close()
if backup:
backup_file_path = old_file_path + "{}".format(
backup_file_path = old_file_path + "-{}".format(
time.strftime("%Y-%m-%d-%H-%M-%S")
)