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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9090b1b4eb266549ea7415a64501538e0a4a52a53e3c0f3e2936cc471b9476e3
4
- data.tar.gz: '0195a4e581370dfa4cdb5123c826fbeb0123f7360575f39d79b5d6878e79252d'
3
+ metadata.gz: 0773d86f0e8c33cf8f595af183d1270c4f9955b7be4d078eb8179ecb67075771
4
+ data.tar.gz: 6c2aef4c7b7f6a148371efa0f3a9cbb99fc2f07a4a07486d7d366739e5372439
5
5
  SHA512:
6
- metadata.gz: 7178c7706c156d9d1b296dc5b82b9dbfcd46d71d5aebfb8ad89f23da846e124955de577428f43c557d1e9a7394343e4aa7ae0f8d7114838a1de5cc7a3aca46f1
7
- data.tar.gz: f5a88810c4520818b5e936dca8f960718714985df45bc1106572f9d9f67e73c039b89a7481069df1a3c38cbf8b5ea7b06617613d22ebae04a2254bc0617c85df
6
+ metadata.gz: bef8db811af46e9d3528b9f7f3e8b7d02846d635714790878c8a506375f64616321325e7b183582949914b12cf1c94a6e78f1ce61f43d69c46d688ceba1eff3c
7
+ data.tar.gz: ebf3dfdbc3c0af47199701d18817e206fc08e9585821f242e8b6a9153b70aecab8ffc732176d13637313e506270f89f9ca537afc99262e75a3194de4920f2934
data/.standard.yml ADDED
@@ -0,0 +1,8 @@
1
+ default_ignores: false
2
+ ignore:
3
+ - ".git/**/*"
4
+ - "node_modules/**/*"
5
+ - "vendor/**/*"
6
+ - "coverage/**/*"
7
+ - "pkg/**/*"
8
+ - "tmp/**/*"
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 and linters, and commit changes using standard git commits.
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 'ruby-lsp', group: :development
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.0)
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 :schema => "schema:generate"
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 :system => :build do
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 :default => :spec
52
+ task default: :spec
data/bin/readsnaps CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'zfs_mgmt'
4
- print ZfsMgmt.readsnaps()
3
+ require "zfs_mgmt"
4
+ print ZfsMgmt.readsnaps
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, :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 => ( (ENV['ZFS_MGMT_LOGLEVEL'] && !ENV['ZFS_MGMT_LOGLEVEL'].empty?) ? ENV['ZFS_MGMT_LOGLEVEL'].downcase : ( $stdout.isatty ? 'info' : 'warn' ) ),
19
- :enum => ['debug','error','fatal','info','warn','unknown','none','off','silent'],
20
- :desc => 'set logging level to specified severity'
21
- class_option :lock, :type => :boolean, :default => false,
22
- :desc => 'lock before running'
23
- class_option :lock_file, :type => :string, :default => '/run/zfsmgr.lock',
24
- :desc => 'lock file'
25
- class_option :lock_wait, :type => :numeric, :default => 0,
26
- :desc => 'wait N seconds for lock'
27
- class_option :config_dir, :type => :string,
28
- :desc => 'directory containing zfsmgr .toml config files'
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, :type => :string, :default => ['name'], :desc => "List of properties passed to zfs get", repeatable: true
31
- method_option :types, :type => :array, :default => ['filesystem','volume'], enum: ['filesystem','volume','snapshot'], :desc => "list of 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
- types: options[:types],
38
- zfs: zfs)
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, :type => :boolean, :default => false,
57
- :desc => "print the path to the bundled config.schema.json file"
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 '--version' => :version
75
+ map "--version" => :version
72
76
  desc "version", "print zfs_mgmt version"
73
77
  def version
74
78
  puts "zfsmgr #{ZfsMgmt::VERSION}"