zfs_mgmt 0.10.0 → 0.10.1
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 +4 -4
- data/.standard.yml +8 -0
- data/AGENTS.md +6 -1
- data/Gemfile +3 -2
- data/Gemfile.lock +46 -1
- data/README.md +21 -1
- data/Rakefile +4 -3
- data/bin/readsnaps +2 -2
- data/bin/zfsmgr +31 -27
- data/lib/zfs_mgmt/config.rb +283 -151
- data/lib/zfs_mgmt/restic.rb +89 -93
- data/lib/zfs_mgmt/version.rb +1 -1
- data/lib/zfs_mgmt/zfs.rb +128 -128
- data/lib/zfs_mgmt/zfs_mgr/config.rb +22 -4
- data/lib/zfs_mgmt/zfs_mgr/list.rb +26 -26
- data/lib/zfs_mgmt/zfs_mgr/recv.rb +3 -3
- data/lib/zfs_mgmt/zfs_mgr/restic.rb +21 -21
- data/lib/zfs_mgmt/zfs_mgr/send.rb +5 -5
- data/lib/zfs_mgmt/zfs_mgr/snapshot.rb +14 -14
- data/lib/zfs_mgmt/zfs_mgr/state.rb +6 -6
- data/lib/zfs_mgmt/zfs_mgr/transfer_options.rb +25 -25
- data/lib/zfs_mgmt/zfs_mgr.rb +0 -1
- data/lib/zfs_mgmt.rb +864 -567
- data/zfs_mgmt.gemspec +12 -14
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0773d86f0e8c33cf8f595af183d1270c4f9955b7be4d078eb8179ecb67075771
|
|
4
|
+
data.tar.gz: 6c2aef4c7b7f6a148371efa0f3a9cbb99fc2f07a4a07486d7d366739e5372439
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bef8db811af46e9d3528b9f7f3e8b7d02846d635714790878c8a506375f64616321325e7b183582949914b12cf1c94a6e78f1ce61f43d69c46d688ceba1eff3c
|
|
7
|
+
data.tar.gz: ebf3dfdbc3c0af47199701d18817e206fc08e9585821f242e8b6a9153b70aecab8ffc732176d13637313e506270f89f9ca537afc99262e75a3194de4920f2934
|
data/.standard.yml
ADDED
data/AGENTS.md
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
### Code Style (StandardRB)
|
|
3
|
+
|
|
4
|
+
* All Ruby files in the repository (configured via `.standard.yml`) must pass StandardRB with zero offenses.
|
|
5
|
+
* After editing any Ruby file, run `bundle exec standardrb` (or `bundle exec standardrb --fix <files>` followed by `bundle exec standardrb`) and verify zero offenses remain before committing.
|
|
6
|
+
|
|
2
7
|
### Github Issue Workflow
|
|
3
8
|
|
|
4
9
|
When asked to resolve a Github issue:
|
|
@@ -15,7 +20,7 @@ git checkout -b <type>/issue-<id>-<slug>
|
|
|
15
20
|
|
|
16
21
|
|
|
17
22
|
*(Use `fix/` for bug fixes, `feat/` for features/enhancements).*
|
|
18
|
-
* Make edits locally, run required test suites
|
|
23
|
+
* Make edits locally, run `bundle exec standardrb` on modified Ruby files (and the full repo) plus required test suites (`bundle exec rspec`), and commit changes using standard git commits.
|
|
19
24
|
|
|
20
25
|
|
|
21
26
|
3. **Push to Remote (Local Shell via SSH/Git):**
|
data/Gemfile
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
source "https://rubygems.org"
|
|
2
2
|
|
|
3
|
-
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
|
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
|
4
4
|
|
|
5
5
|
# Specify your gem's dependencies in zfs_mgmt.gemspec
|
|
6
6
|
gem "thor"
|
|
@@ -13,6 +13,7 @@ gem "easy_talk"
|
|
|
13
13
|
gem "json_schemer"
|
|
14
14
|
gem "tomlrb"
|
|
15
15
|
gem "deep_merge"
|
|
16
|
+
gem "standard"
|
|
16
17
|
|
|
17
|
-
gem
|
|
18
|
+
gem "ruby-lsp", group: :development
|
|
18
19
|
gemspec
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
zfs_mgmt (0.10.
|
|
4
|
+
zfs_mgmt (0.10.1)
|
|
5
5
|
deep_merge
|
|
6
6
|
easy_talk
|
|
7
7
|
filesize (~> 0.2)
|
|
@@ -29,6 +29,7 @@ GEM
|
|
|
29
29
|
securerandom (>= 0.3)
|
|
30
30
|
tzinfo (~> 2.0, >= 2.0.5)
|
|
31
31
|
uri (>= 0.13.1)
|
|
32
|
+
ast (2.4.3)
|
|
32
33
|
base64 (0.3.0)
|
|
33
34
|
bigdecimal (4.1.3)
|
|
34
35
|
character_set (1.9.0)
|
|
@@ -58,12 +59,19 @@ GEM
|
|
|
58
59
|
regexp_parser (~> 2.0)
|
|
59
60
|
simpleidn (~> 0.2)
|
|
60
61
|
language_server-protocol (3.17.0.6)
|
|
62
|
+
lint_roller (1.1.0)
|
|
61
63
|
logger (1.7.0)
|
|
62
64
|
minitest (6.1.0)
|
|
63
65
|
drb (~> 2.0)
|
|
64
66
|
prism (>= 1.5, < 3)
|
|
67
|
+
parallel (2.3.0)
|
|
68
|
+
parser (3.3.14.0)
|
|
69
|
+
ast (~> 2.4.1)
|
|
70
|
+
racc
|
|
65
71
|
prism (1.9.0)
|
|
66
72
|
pstore (0.3.0)
|
|
73
|
+
racc (1.8.1)
|
|
74
|
+
rainbow (3.1.1)
|
|
67
75
|
rake (13.4.2)
|
|
68
76
|
rbs (4.2.0)
|
|
69
77
|
logger
|
|
@@ -84,10 +92,31 @@ GEM
|
|
|
84
92
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
85
93
|
rspec-support (~> 3.13.0)
|
|
86
94
|
rspec-support (3.13.8)
|
|
95
|
+
rubocop (1.91.0)
|
|
96
|
+
json (>= 2.3)
|
|
97
|
+
language_server-protocol (~> 3.17.0.2)
|
|
98
|
+
lint_roller (~> 1.1.0)
|
|
99
|
+
parallel (>= 1.10)
|
|
100
|
+
parser (>= 3.3.0.2)
|
|
101
|
+
rainbow (>= 2.2.2, < 4.0)
|
|
102
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
103
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
104
|
+
ruby-progressbar (~> 1.7)
|
|
105
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
106
|
+
rubocop-ast (1.54.0)
|
|
107
|
+
ast (~> 2.4)
|
|
108
|
+
parser (>= 3.3.7.2)
|
|
109
|
+
prism (>= 1.7)
|
|
110
|
+
racc
|
|
111
|
+
rubocop-performance (1.26.1)
|
|
112
|
+
lint_roller (~> 1.1)
|
|
113
|
+
rubocop (>= 1.75.0, < 2.0)
|
|
114
|
+
rubocop-ast (>= 1.47.1, < 2.0)
|
|
87
115
|
ruby-lsp (0.26.11)
|
|
88
116
|
language_server-protocol (~> 3.17.0)
|
|
89
117
|
prism (>= 1.2, < 2.0)
|
|
90
118
|
rbs (>= 3, < 5)
|
|
119
|
+
ruby-progressbar (1.13.0)
|
|
91
120
|
securerandom (0.4.1)
|
|
92
121
|
simplecov (0.22.0)
|
|
93
122
|
docile (~> 1.1)
|
|
@@ -97,6 +126,18 @@ GEM
|
|
|
97
126
|
simplecov_json_formatter (0.1.4)
|
|
98
127
|
simpleidn (0.3.0)
|
|
99
128
|
sorbet-runtime (0.6.13724)
|
|
129
|
+
standard (1.57.0)
|
|
130
|
+
language_server-protocol (~> 3.17.0.2)
|
|
131
|
+
lint_roller (~> 1.0)
|
|
132
|
+
rubocop (~> 1.91.0)
|
|
133
|
+
standard-custom (~> 1.0.0)
|
|
134
|
+
standard-performance (~> 1.8)
|
|
135
|
+
standard-custom (1.0.2)
|
|
136
|
+
lint_roller (~> 1.0)
|
|
137
|
+
rubocop (~> 1.50)
|
|
138
|
+
standard-performance (1.9.0)
|
|
139
|
+
lint_roller (~> 1.1)
|
|
140
|
+
rubocop-performance (~> 1.26.0)
|
|
100
141
|
text-table (1.2.4)
|
|
101
142
|
thor (1.5.0)
|
|
102
143
|
timeout (0.6.1)
|
|
@@ -104,6 +145,9 @@ GEM
|
|
|
104
145
|
tsort (0.2.0)
|
|
105
146
|
tzinfo (2.0.6)
|
|
106
147
|
concurrent-ruby (~> 1.0)
|
|
148
|
+
unicode-display_width (3.3.0)
|
|
149
|
+
unicode-emoji (~> 4.3)
|
|
150
|
+
unicode-emoji (4.3.0)
|
|
107
151
|
uri (1.1.2)
|
|
108
152
|
|
|
109
153
|
PLATFORMS
|
|
@@ -121,6 +165,7 @@ DEPENDENCIES
|
|
|
121
165
|
rspec (~> 3.0)
|
|
122
166
|
ruby-lsp
|
|
123
167
|
simplecov (~> 0.22)
|
|
168
|
+
standard
|
|
124
169
|
text-table
|
|
125
170
|
thor
|
|
126
171
|
timeout
|
data/README.md
CHANGED
|
@@ -145,10 +145,17 @@ database (defaults to `zfsmgr state show`):
|
|
|
145
145
|
## Development
|
|
146
146
|
|
|
147
147
|
After checking out the repo, run `bin/setup` to install
|
|
148
|
-
dependencies. Then, run `rake spec` to run the tests. You can also run
|
|
148
|
+
dependencies. Then, run `bundle exec rspec` (or `bundle exec rake spec`) to run the tests. You can also run
|
|
149
149
|
`bin/console` for an interactive prompt that will allow you to
|
|
150
150
|
experiment.
|
|
151
151
|
|
|
152
|
+
Ruby code style and linting are enforced with [StandardRB](https://github.com/standardrb/standard) across all Ruby files (configured in `.standard.yml`):
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
bundle exec standardrb # or: bundle exec rake standard
|
|
156
|
+
bundle exec standardrb --fix # or: bundle exec rake standard:fix
|
|
157
|
+
```
|
|
158
|
+
|
|
152
159
|
To install this gem onto your local machine, run `bundle exec rake
|
|
153
160
|
install`. To release a new version, update the version number in
|
|
154
161
|
`version.rb`, and then run `bundle exec rake release`, which will
|
|
@@ -250,6 +257,19 @@ file { '/etc/zfsmgr/50-puppet.toml':
|
|
|
250
257
|
}
|
|
251
258
|
```
|
|
252
259
|
|
|
260
|
+
### Inspecting Derived Configuration
|
|
261
|
+
|
|
262
|
+
Inspect the effective per-dataset configuration (combining ZFS dataset user properties, inheritance, top-level config, and per-dataset TOML config files) with `zfsmgr config show`:
|
|
263
|
+
|
|
264
|
+
$ zfsmgr config show
|
|
265
|
+
$ zfsmgr config show --filter '^tank/'
|
|
266
|
+
$ zfsmgr config show --format toml
|
|
267
|
+
$ zfsmgr config show --all
|
|
268
|
+
|
|
269
|
+
- Default `--format table` prints one table per dataset with a dataset-name header and `property`, `value`, `source` (`local`, `inherited from <ancestor>`, `received`, `top-level`, `default`), and `origin` (config file path, `zfs property`, `zfs`, `default`) columns.
|
|
270
|
+
- `--format toml` renders each dataset's derived `ZfsMgmt::Zfs` configuration as TOML without source/origin metadata.
|
|
271
|
+
- Pass `--all` (`-a`) to include unset and false default properties.
|
|
272
|
+
|
|
253
273
|
## zfs user properties
|
|
254
274
|
|
|
255
275
|
Destruction of zfs snapshots is based on the following zfs user
|
data/Rakefile
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require "bundler/gem_tasks"
|
|
2
2
|
require "rspec/core/rake_task"
|
|
3
|
+
require "standard/rake"
|
|
3
4
|
|
|
4
5
|
RSpec::Core::RakeTask.new(:spec)
|
|
5
6
|
|
|
@@ -19,11 +20,11 @@ namespace :schema do
|
|
|
19
20
|
end
|
|
20
21
|
|
|
21
22
|
desc "Generate JSON Schema for zfsmgr config files"
|
|
22
|
-
task :
|
|
23
|
+
task schema: "schema:generate"
|
|
23
24
|
|
|
24
25
|
namespace :install do
|
|
25
26
|
desc "Build and install zfs_mgmt into BINDIR (default: /usr/bin) with compatibility symlink in COMPAT_BINDIR (default: /usr/local/bin)"
|
|
26
|
-
task :
|
|
27
|
+
task system: :build do
|
|
27
28
|
require "fileutils"
|
|
28
29
|
$LOAD_PATH.unshift(File.expand_path("lib", __dir__))
|
|
29
30
|
require "zfs_mgmt/version"
|
|
@@ -48,4 +49,4 @@ namespace :install do
|
|
|
48
49
|
end
|
|
49
50
|
end
|
|
50
51
|
|
|
51
|
-
task :
|
|
52
|
+
task default: :spec
|
data/bin/readsnaps
CHANGED
data/bin/zfsmgr
CHANGED
|
@@ -6,36 +6,40 @@ require "zfs_mgmt/zfs_mgr"
|
|
|
6
6
|
require "zfs_mgmt/zfs_mgr/restic"
|
|
7
7
|
|
|
8
8
|
class ZfsMgr < Thor
|
|
9
|
-
class_option :zfs_binary, :
|
|
10
|
-
|
|
11
|
-
class_option :zpool_binary, :
|
|
12
|
-
|
|
13
|
-
class_option :mbuffer_binary, :
|
|
14
|
-
|
|
15
|
-
class_option :pv_binary, :
|
|
16
|
-
|
|
17
|
-
class_option :loglevel, :
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
class_option :
|
|
26
|
-
|
|
27
|
-
class_option :
|
|
28
|
-
|
|
9
|
+
class_option :zfs_binary, type: :string, default: "zfs",
|
|
10
|
+
desc: "zfs binary"
|
|
11
|
+
class_option :zpool_binary, type: :string, default: "zpool",
|
|
12
|
+
desc: "zpool binary"
|
|
13
|
+
class_option :mbuffer_binary, type: :string, default: "mbuffer",
|
|
14
|
+
desc: "mbuffer binary"
|
|
15
|
+
class_option :pv_binary, type: :string, default: "pv",
|
|
16
|
+
desc: "pv binary"
|
|
17
|
+
class_option :loglevel, type: :string,
|
|
18
|
+
default: (if ENV["ZFS_MGMT_LOGLEVEL"] && !ENV["ZFS_MGMT_LOGLEVEL"].empty?
|
|
19
|
+
ENV["ZFS_MGMT_LOGLEVEL"].downcase
|
|
20
|
+
else
|
|
21
|
+
($stdout.isatty ? "info" : "warn")
|
|
22
|
+
end),
|
|
23
|
+
enum: ["debug", "error", "fatal", "info", "warn", "unknown", "none", "off", "silent"],
|
|
24
|
+
desc: "set logging level to specified severity"
|
|
25
|
+
class_option :lock, type: :boolean, default: false,
|
|
26
|
+
desc: "lock before running"
|
|
27
|
+
class_option :lock_file, type: :string, default: "/run/zfsmgr.lock",
|
|
28
|
+
desc: "lock file"
|
|
29
|
+
class_option :lock_wait, type: :numeric, default: 0,
|
|
30
|
+
desc: "wait N seconds for lock"
|
|
31
|
+
class_option :config_dir, type: :string,
|
|
32
|
+
desc: "directory containing zfsmgr .toml config files"
|
|
29
33
|
desc "zfsget [ZFS]", "execute zfs get for the given properties and types and parse the output into a nested hash"
|
|
30
|
-
method_option :properties, :
|
|
31
|
-
method_option :types,
|
|
34
|
+
method_option :properties, type: :string, default: ["name"], desc: "List of properties passed to zfs get", repeatable: true
|
|
35
|
+
method_option :types, type: :array, default: ["filesystem", "volume"], enum: ["filesystem", "volume", "snapshot"], desc: "list of types"
|
|
32
36
|
def zfsget(zfs)
|
|
33
37
|
ZfsMgmt.set_log_level(options[:loglevel])
|
|
34
38
|
ZfsMgmt.global_options = options
|
|
35
39
|
ZfsMgmt.load_config
|
|
36
40
|
pp ZfsMgmt.zfsget(properties: options[:properties],
|
|
37
|
-
|
|
38
|
-
|
|
41
|
+
types: options[:types],
|
|
42
|
+
zfs: zfs)
|
|
39
43
|
end
|
|
40
44
|
desc "snapshot SUBCOMMAND ...ARGS", "manage snapshots"
|
|
41
45
|
subcommand "snapshot", ZfsMgmt::ZfsMgr::Snapshot
|
|
@@ -53,8 +57,8 @@ class ZfsMgr < Thor
|
|
|
53
57
|
subcommand "config", ZfsMgmt::ZfsMgr::Config
|
|
54
58
|
|
|
55
59
|
desc "schema", "print the config JSON schema (or its installed file path with --path)"
|
|
56
|
-
method_option :path, :
|
|
57
|
-
|
|
60
|
+
method_option :path, type: :boolean, default: false,
|
|
61
|
+
desc: "print the path to the bundled config.schema.json file"
|
|
58
62
|
def schema
|
|
59
63
|
if options[:path]
|
|
60
64
|
puts ZfsMgmt::Config.schema_path
|
|
@@ -68,7 +72,7 @@ class ZfsMgr < Thor
|
|
|
68
72
|
end
|
|
69
73
|
end
|
|
70
74
|
|
|
71
|
-
map
|
|
75
|
+
map "--version" => :version
|
|
72
76
|
desc "version", "print zfs_mgmt version"
|
|
73
77
|
def version
|
|
74
78
|
puts "zfsmgr #{ZfsMgmt::VERSION}"
|