Skip to content

Commit

Permalink
fix regression with temporary log file (#386)
Browse files Browse the repository at this point in the history
  • Loading branch information
creativeprojects authored Jul 8, 2024
1 parent ed12184 commit eb13003
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dial/url.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ func IsSupportedURL(source string) bool {
// IsURL is true if the provided source is a parsable URL and no file path
func IsURL(source string) bool {
u, e := url.Parse(source)
return e == nil && len(u.Scheme) > 1
return e == nil && len(u.Scheme) > 1 && u.Scheme != "temp"
}
2 changes: 2 additions & 0 deletions dial/url_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestGetDialAddr(t *testing.T) {
{"/file", "", "", false},
{"path/file", "", "", false},
{"/root/file", "", "", false},
{"temp:/t/backup.log", "", "", false},
}

for _, fixture := range fixtures {
Expand All @@ -66,5 +67,6 @@ func TestIsUrl(t *testing.T) {
assert.True(t, dial.IsURL("ftp://"))
assert.True(t, dial.IsURL("http://"))
assert.False(t, dial.IsURL("c://"))
assert.False(t, dial.IsURL("temp:/t/backup.log"))
assert.False(t, dial.IsURL(""))
}
19 changes: 18 additions & 1 deletion examples/linux.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config-1.json

version: "1"

global:
default-command: version
initialize: false
priority: low
systemd-unit-template: sample.service
prevent-sleep: true
prevent-sleep: false

default:
password-file: key
Expand Down Expand Up @@ -61,6 +65,19 @@ test2:
schedule-permission: system
schedule-log: check-test2.log

test3:
inherit: default
initialize: true
verbose: true
backup:
source: ./
exclude: .git
schedule: "*:05,20,35,50"
schedule-permission: user
schedule-log: '{{ tempFile "backup.log" }}'
run-finally:
- 'grep --invert-match -E "^unchanged\\s" {{ tempFile "backup.log" }} > /tmp/backup-{{ .Profile.Name }}-{{ .Now.Format "2006-01-02_15-04" }}.log'

longrun:
inherit: default
initialize: true
Expand Down

0 comments on commit eb13003

Please sign in to comment.