Repository: creativeprojects/resticprofile (language: python)

Issue:
--log temp:/t/backup.log not passed to systemd-job in 0.27
I actually copied a resticprofile yaml file from one machine to another machine running ubuntu, where I wanted to use it in the exact same way. To my surprise, on the new machine I saw an error when trying to do the logrelated "run-finally" commands. I was curious how it is possible since all config options where the same. The config looks like shown below. 
I then saw that on the old machine it uses 0.26 version and on the new it is 0.27.
Investigating further I saw following issue:

In 0.27: When adding the tempfile as a schedule log, it was creating the temporary file, but it stayed empty. I checked the created systemd-file in `/etc/systemd/system/resticprofile-backup@profile-default.service` and found that there was no line that adds the logs.
Downgrading to 0.26 and the option is added to the scheduled jobs, and the problem doesnt appear. Therefor it seems to be a problem with 0.27

Config below:

```version: "1"

global:
  # run 'snapshots' when no command is specified when invoking resticprofile
  default-command: snapshots
  # initialize a repository if none exist at location
  initialize: true
  # priority is using priority class on windows, and "nice" on unixes
  priority: low
  # resticprofile won't start a profile if there's less than 100MB of RAM available
  min-memory: 250
  send-timeout: 10s
  restic-stale-lock-age: 3h

# Default profile when not specified on the command line (-n or --name)
# There's no default inheritance from the 'default' profile,
# you can use the 'inherit' flag if needed
default:
  repository: "sftp:hetzner_storagebox:restic"
  password-file: "storagebox.key"
  status-file: "storagebox-status.json"
  lock: "/tmp/resticprofile-profile-base.lock"
  force-inactive-lock: true
  env:
    RESTIC_CACHE_DIR: "/tmp/restic/cache-storagebox"
    TMP_DIR: "/tmp/restic/tmp"
  backup:
    check-after: true
    schedule-after-network-online: true
    # Don't leave the file system via mount points
    one-file-system: true
    exclude-caches: true
    schedule: "04:00"
    schedule-lock-mode: default
    schedule-lock-wait: 10m
    schedule-priority: background
    schedule-permission: system
    # Create log file in temporary directory and delete it when resticprofile is done
    schedule-log: '{{ tempFile "backup.log" }}'
    # Write details about each processed file to the log        
    verbose: 2
    # will run these scripts before and after each command (including 'backup')
    run-before:
      - "mkdir -p /var/log/resticprofile"
      - "mkdir -p /tmp/restic-backup && dpkg --get-selections > /tmp/restic-backup/packages.txt"
    # if a restic command fails, the run-after won't be running
    run-after:
      - ""
    # add this parameter to run the script in case of a failure
    run-after-fail:
      - ""
    run-finally:
      - 'grep --invert-match -E "^unchanged\\s" {{ tempFile "backup.log" }} > /var/log/resticprofile/backup-{{ .Profile.Name }}-{{ .Now.Format "2006-01-02_15-04" }}.log'
      - "rm /tmp/restic-backup/packages.txt"
    send-after-fail:
      - method: POST
        url: https://gotify.mydomain.com/message
        body-template: gotify-body-error.json
        headers:
          - name: Content-Type
            value: "application/json"
          - name: X-Gotify-Key
            value: "XXX"
    send-after:
      - method: HEAD
        url: https://uptime-kuma.mydomain.com/api/push/status=up&msg=OK&ping=
    source:
      - "/var/lib/docker"
      - "/home"
      - "/root"
      - "/etc"
      - "/tmp/restic-backup"
      - "/var/spool/cron/crontabs"
      - "/var/log"
    #exclude:
    #  - "/var/log/journal"
  # Runs retention (forgetting old snapshots) and prune if a snapshot got deleted
  retention:
    before-backup: false
    after-backup: true
    keep-daily: 28
    keep-weekly: 4
    keep-monthly: 6
    keep-yearly: 0
    keep-tag:
        - forever
    prune: true
    # tag can be a boolean ('true' meaning to copy tag set from 'backup') 
    # or a custom set of tags.
    # Default is 'false', meaning that tags are NOT used.
    #tag: true
    # host can be a boolean ('true' meaning current hostname)
    # or a string to specify a different hostname
    #host: true
    schedule-permission: system
    schedule-priority: background
    schedule-lock-mode: default
    schedule-lock-wait: 1h

    send-after-fail:
      - method: POST
        url: https://gotify.mydomain.com/message
        body-template: gotify-body-error.json
        headers:
          - name: Content-Type
            value: "application/json"
          - name: X-Gotify-Key
            value: "XXX"

  # Verify command
  check:
    read-data-subset: 5%
    schedule-permission: system
    schedule-priority: background
    schedule-lock-mode: default
    schedule-lock-wait: 1h

    send-after-fail:
      - method: POST
        url: https://gotify.mydomain.com/message
        body-template: gotify-body-error.json
        headers:
          - name: Content-Type
            value: "application/json"
          - name: X-Gotify-Key
            value: "XXX"```


Discussion / hints:
Thanks for the detailed report, I'll look into it 👍🏻 

Fix patch:
diff --git a/dial/url.go b/dial/url.go
index f06509bb..af9eebc4 100644
--- a/dial/url.go
+++ b/dial/url.go
@@ -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"
 }
diff --git a/examples/linux.yaml b/examples/linux.yaml
index ce37a616..ca949f72 100644
--- a/examples/linux.yaml
+++ b/examples/linux.yaml
@@ -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
@@ -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


Test patch:
diff --git a/dial/url_test.go b/dial/url_test.go
index 04c49769..9a4551f2 100644
--- a/dial/url_test.go
+++ b/dial/url_test.go
@@ -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 {
@@ -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(""))
 }