fix: disallow backups if data dir doesn't exist

This commit is contained in:
Ben Allfree 2022-11-21 02:19:42 -08:00
parent 4e65a7b948
commit c798f067c6
3 changed files with 49 additions and 39 deletions

View File

@ -119,9 +119,14 @@ export const createInstanceService = async (config: InstanceServiceConfig) => {
api.shutdown() api.shutdown()
}, },
}) })
const { pid } = childProcess const { pid } = childProcess
assertTruthy(pid, `Expected PID here but got ${pid}`) assertTruthy(pid, `Expected PID here but got ${pid}`)
if (!instance.isBackupAllowed) {
await client.updateInstance(instance.id, { isBackupAllowed: true })
}
const invocation = await client.createInvocation(instance, pid) const invocation = await client.createInvocation(instance, pid)
const tm = createTimerManager({}) const tm = createTimerManager({})
const api: InstanceApi = (() => { const api: InstanceApi = (() => {

View File

@ -58,6 +58,7 @@
<div class="py-4"> <div class="py-4">
<h2>Backup</h2> <h2>Backup</h2>
{#if instance.isBackupAllowed}
<div class="text-center py-5"> <div class="text-center py-5">
<button class="btn btn-light" on:click={() => startBackup()} disabled={isBackingUp}> <button class="btn btn-light" on:click={() => startBackup()} disabled={isBackingUp}>
<i class="bi bi-safe" /> Backup Now <i class="bi bi-safe" /> Backup Now
@ -96,6 +97,10 @@
</div> </div>
{/each} {/each}
</div> </div>
{/if}
{#if !instance.isBackupAllowed}
You must access this instance at least once before backups can be made.
{/if}
</div> </div>
<style lang="scss"> <style lang="scss">

View File

@ -136,13 +136,13 @@ open https://pockethost.io
**next** **next**
- [x] fix: incorrect instance information displaying on dashboard details - [x] fix: incorrect instance information displaying on dashboard details in some cases
- [x] fix: more helpful error message when backup fails for nonexistent instance - [x] fix: more helpful error message when backup fails for nonexistent instance
- [x] chore: move version number to base package.json - [x] chore: move version number to base package.json
- [x] refactor: logging and async helpers - [x] refactor: logging and async helpers
- [x] chore: restore auto-cancellation - [x] chore: restore auto-cancellation
- [x] chore: rebuild with go 1.19.3 and include in bin name - [x] chore: rebuild with go 1.19.3 and include in bin name
- [ ] fix: Disallow backups if data dir doesn't exist - [x] fix: Disallow backups if data dir doesn't exist
**0.5.2** **0.5.2**