kamal-backup 0.3.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 801ab5f224e1e018805b65650da3c0946d6c785eb8b2a3e3e3256bcf97649abb
4
- data.tar.gz: 60e98bfe053103b3405d483902a167ee2d86f7a723448e06eacb2937b56fd4d3
3
+ metadata.gz: 4b93c203599481320559eb006ccf07a07c010c5bc4d5dfcae3e11b7a9a832fa3
4
+ data.tar.gz: 705fc119fcacdd54ee431e9cfb5b88220a0faae02540cba77e38c45b94044905
5
5
  SHA512:
6
- metadata.gz: b1dbd9a03222917490629d56a4bfca69e1abbac79ed241bf480ba0da50453e67e1224dcf5f6d315ce23039b31febe2d449300dae167ddf19e627decd07c6116e
7
- data.tar.gz: c4392a6048ceea5ec81b20cedad84f15d864ecb37a83337571cc857de8c730c0a84629df335e9b6c4f273868ad86a6ddcc631c00315ff8ff965ac0230bcf1f5a
6
+ metadata.gz: fd7b30595fe843980d39979b8b7e241fbd54c7fd814c55bccb4bfcdf6b175b5767e84910929050f4e3aa40f150aec5b01e15015b196e522e3c48566f9527020f
7
+ data.tar.gz: e81f5d21997f6f072b9556a73b7e751accbe99098adaebaec3435ca15600e8d13f204b9d343cc3ae7f6905a86efd3abea3c5dd0d64ea602bd2f2617d8bca8fef
data/README.md CHANGED
@@ -111,6 +111,7 @@ Run the first backup, check the repository, and print evidence. From an app chec
111
111
  bundle exec kamal-backup backup
112
112
  bundle exec kamal-backup list
113
113
  bundle exec kamal-backup check
114
+ bundle exec kamal-backup unlock
114
115
  bundle exec kamal-backup evidence
115
116
  ```
116
117
 
@@ -109,6 +109,11 @@ module KamalBackup
109
109
  restic.check.stdout
110
110
  end
111
111
 
112
+ def unlock
113
+ config.validate_restic
114
+ restic.unlock.stdout
115
+ end
116
+
112
117
  def prune
113
118
  config.validate_backup(check_files: false)
114
119
  restic.prune
@@ -191,6 +191,15 @@ module KamalBackup
191
191
  end
192
192
  end
193
193
 
194
+ desc 'unlock', 'Clear stale restic repository locks'
195
+ def unlock
196
+ if remote_command_mode?
197
+ exec_remote(%w[kamal-backup unlock])
198
+ else
199
+ print(direct_app.unlock)
200
+ end
201
+ end
202
+
194
203
  desc 'prune', 'Apply the configured restic retention policy and prune unneeded data'
195
204
  def prune
196
205
  if remote_command_mode?
@@ -174,12 +174,13 @@ module KamalBackup
174
174
  end
175
175
 
176
176
  def command_failure(spec, status, stdout, stderr, redactor)
177
+ redacted_stderr = redactor.redact_string(stderr)
177
178
  CommandError.new(
178
- "command failed (#{status}): #{spec.display(redactor)}\n#{redactor.redact_string(stderr)}",
179
+ "command failed (#{status}): #{spec.display(redactor)}\n#{redacted_stderr}#{restic_lock_hint(spec, stderr)}",
179
180
  command: spec,
180
181
  status: status,
181
182
  stdout: redactor.redact_string(stdout),
182
- stderr: redactor.redact_string(stderr)
183
+ stderr: redacted_stderr
183
184
  )
184
185
  end
185
186
 
@@ -191,6 +192,14 @@ module KamalBackup
191
192
  stderr: error.message
192
193
  )
193
194
  end
195
+
196
+ def restic_lock_hint(spec, stderr)
197
+ return '' unless spec.argv.first == 'restic'
198
+ return '' if spec.argv[1] == 'unlock'
199
+ return '' unless stderr.to_s.match?(/repository is already locked|unlock.+stale locks/i)
200
+
201
+ "\nHint: run `kamal-backup unlock` to clear stale restic locks, then retry the command."
202
+ end
194
203
  end
195
204
  end
196
205
  end
@@ -99,6 +99,11 @@ module KamalBackup
99
99
  end
100
100
  end
101
101
 
102
+ def unlock
103
+ log('clearing stale restic locks')
104
+ run(%w[unlock])
105
+ end
106
+
102
107
  def check
103
108
  args = %w[check]
104
109
  args.concat(['--read-data-subset', config.check_read_data_subset]) if config.check_read_data_subset
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KamalBackup
4
- VERSION = '0.3.1'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kamal-backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - crmne
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-06-13 00:00:00.000000000 Z
11
+ date: 2026-06-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor