duplicacy-util icon indicating copy to clipboard operation
duplicacy-util copied to clipboard

Error: missing mandatory check field: 2.storage

Open bifkit opened this issue 6 years ago • 3 comments

Attempting to run duplicacy-util on Windows Server 2012. I consistently get the following:

PS C:\users\daniel> duplicacy-util -f serverfolders 19:21:47 Using global config: C:\Users\daniel\.duplicacy-util\duplicacy-util.yaml Error: missing mandatory check field: 2.storage

I have also run the command explicitly providing the -sd flag, with the same result. The -v and -d flags provide no further information.

The local config file is in the same directory as the global one, and is named serverfolders.yaml. It contains:

repository: D:/ServerFolders

storage:
    - name: usbdrive
      vss: true
      vss-timeout: 360

copy:
    - from: usbdrive
      to: dreamobjects
      threads: 20

prune:
    - storage: usbdrive
      keep: "0:365 30:180 7:30 1:7"
    - storage: dreamobjects
      keep: "0:365 30:180 7:30 1:7"

check:
    - storage: usbdrive
      all: true
    - storage: dreamobjects
    - all: true

I have tried many variations: repository name (serverfolders), repository location (D:\ServerFolders), storage name (usbdrive), storage location (h:\duplicacy_backup), etc.

The repository has been initialized to use a directory on an external hard drive as storage, and to copy to cloud storage. I have successfully run the backup and copy operations directly with duplicacy several times, but I can't get duplicacy-util started.

Have I misunderstood something about the configuration options?

bifkit avatar Apr 23 '19 23:04 bifkit

That took me a perusal of the source code, and then I understood what is happening:

For the check information, you have:

check:
    - storage: usbdrive
      all: true
    - storage: dreamobjects
    - all: true

The - characters are critical here, as it delineates a new repository to check. (It's kind of weird that you're checking storages that you're not backing up, but I'm sure you have a reason for that.)

In any case, the above segment says you have three storages to check (numbered from 0 due to how Go numbers these).

Check 0: Name=usbdrive, all=true
Check 1: Name=dreamobjects, no all flag (it will be defaulted)
Check 2: No name, all=true

You can't check something without a storage name, so duplicacy-util complained.

Make the check segment look like this instead:

check:
    - storage: usbdrive
      all: true
    - storage: dreamobjects
      all: true

That should fix you up.

jeffaco avatar Apr 24 '19 16:04 jeffaco

Thanks for spotting that. I would have looked at it for days before I caught it.

bifkit avatar Apr 24 '19 20:04 bifkit

The error message is historical. We used to have numbered sections in prior versions. When you had numbered sections, 2.storage made more sense (check session 2, field storage).

I'm going to to reopen this issue (as a reminder) and run through the code making sure error messages make sense given the current YAML format.

This would have been better to say something like Error: 'storage' definition missing in check entry 2 (or something like that). That might have made more sense to you, and would have given you more of a hint as to what the problem was.

jeffaco avatar Apr 24 '19 21:04 jeffaco