Skip to content

Commit eb13003

Browse files
fix regression with temporary log file (#386)
1 parent ed12184 commit eb13003

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

dial/url.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ func IsSupportedURL(source string) bool {
4646
// IsURL is true if the provided source is a parsable URL and no file path
4747
func IsURL(source string) bool {
4848
u, e := url.Parse(source)
49-
return e == nil && len(u.Scheme) > 1
49+
return e == nil && len(u.Scheme) > 1 && u.Scheme != "temp"
5050
}

dial/url_test.go

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ func TestGetDialAddr(t *testing.T) {
4747
{"/file", "", "", false},
4848
{"path/file", "", "", false},
4949
{"/root/file", "", "", false},
50+
{"temp:/t/backup.log", "", "", false},
5051
}
5152

5253
for _, fixture := range fixtures {
@@ -66,5 +67,6 @@ func TestIsUrl(t *testing.T) {
6667
assert.True(t, dial.IsURL("ftp://"))
6768
assert.True(t, dial.IsURL("http://"))
6869
assert.False(t, dial.IsURL("c://"))
70+
assert.False(t, dial.IsURL("temp:/t/backup.log"))
6971
assert.False(t, dial.IsURL(""))
7072
}

examples/linux.yaml

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1+
# yaml-language-server: $schema=https://creativeprojects.github.io/resticprofile/jsonschema/config-1.json
2+
3+
version: "1"
4+
15
global:
26
default-command: version
37
initialize: false
48
priority: low
59
systemd-unit-template: sample.service
6-
prevent-sleep: true
10+
prevent-sleep: false
711

812
default:
913
password-file: key
@@ -61,6 +65,19 @@ test2:
6165
schedule-permission: system
6266
schedule-log: check-test2.log
6367

68+
test3:
69+
inherit: default
70+
initialize: true
71+
verbose: true
72+
backup:
73+
source: ./
74+
exclude: .git
75+
schedule: "*:05,20,35,50"
76+
schedule-permission: user
77+
schedule-log: '{{ tempFile "backup.log" }}'
78+
run-finally:
79+
- 'grep --invert-match -E "^unchanged\\s" {{ tempFile "backup.log" }} > /tmp/backup-{{ .Profile.Name }}-{{ .Now.Format "2006-01-02_15-04" }}.log'
80+
6481
longrun:
6582
inherit: default
6683
initialize: true

0 commit comments

Comments
 (0)