brysontyrrell / PatchServer

A self-hosted implementation of an external patch source for Jamf Pro 10.2+
http://patchserver.readthedocs.io/en/latest/
MIT License
67 stars 13 forks source link

Request: Import Backup of Patch Archive #18

Closed quovadimus closed 6 years ago

quovadimus commented 6 years ago

There is a need for a method of adding patch definitions from your backup to a new server.

brysontyrrell commented 6 years ago

This feature has been implemented in the develop branch.

Looking for testing before merging to master. I've published develop branch docs where the new endpoint is detailed:

https://patchserver.readthedocs.io/en/develop/apis/ps_api.html#post--api-v1-restore

An example curl command to POST your backup archive to a new server is:

curl -X POST -F "file=@patch_archive.zip;type=application/zip" http://localhost:5000/api/v1/restore
krispayne commented 6 years ago

I can test tomorrow. Have an empty dataset at the moment.

On Jul 18, 2018, at 6:46 PM, Bryson Tyrrell notifications@github.com wrote:

This feature has been implemented in the develop branch.

Looking for testing before merging to master. I've published develop branch docs where the new endpoint is detailed:

https://patchserver.readthedocs.io/en/develop/apis/ps_api.html#post--api-v1-restore

An example curl command to POST your backup archive to a new server is:

curl -X POST -F "file=@patch_archive.zip;type=application/zip" http://localhost:5000/api/v1/restore — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

quovadimus commented 6 years ago

Tested successfully from Dev branch. Thanks.

brysontyrrell commented 6 years ago

Merged.

krispayne commented 6 years ago

I keep getting server error 500 when attempting to POST as in the example above.

This is a fresh install from a new git clone today.

krispayne commented 6 years ago

I'm still not sure what I'm missing or how to troubleshoot this. I followed the documentation and the example curl command but am unable to restore my backup.

brysontyrrell commented 6 years ago

@krispayne Are you using your own zip file or the archive generated by Patch Server using the backup feature?

krispayne commented 6 years ago

@brysontyrrell I had a directory of JSON files named patch_archive that I zipped using Finder and also zip on the command line.

It's been so long since I made the archive from Patch Server, I'm wondering now if safari did the fun trick where it downloads a zip and unarchives it for you and deletes the zip.

brysontyrrell commented 6 years ago

@krispayne The archive the server creates is a zipped patch_archive directory that contains the JSON files. I didn't write the restore to be generic and accept any kind of zip file structure. It's specific to an archive like this.

krispayne commented 6 years ago

ah bummer.

OK, I guess I'll just define my patches again.

krispayne commented 6 years ago

@brysontyrrell per our Slack:

My zip file was an archive containing a directory of JSON files, not an archive of JSON files.

creating the zip per your recommendation zip patch_archive.zip patch_archive/*.json worked flawlessly!