Upgrade zerotier cookbook: Ruby 3.4 incompatibility, no released fix #701

Open
opened 2026-11-09 18:47:58 +00:00 by raucao · 0 comments
Owner

Problem

The vendored zerotier cookbook (1.0.7, from Supermarket) uses ::File.exists?, which was removed in Ruby 3.4. This breaks on the Cinc Client 19 (Ruby 3.4) migration:

  • templates/default/zerotier_ohai.rb — the Ohai plugin fails to collect, so the zerotier attribute disappears from the node. This is live: roles/base.rb includes kosmos_zerotier::ohai_plugin, so every migrated node loses the attribute.
  • libraries/zerotier_network.rb — the zerotier_network resource also uses File.exists?. Not currently exercised by any node (no node runs kosmos_zerotier::default or zerotier::join_networks), but it would fail on the next node that uses it.

We already work around this in site-cookbooks/kosmos_zerotier (local template override + File.exist?), but the workaround is not the upstream fix.

Upstream status

There is no released version that supports modern Ruby:

Source Latest
Supermarket 1.0.7 (2017-11-28) — same as vendored
GitHub tags 1.0.7
GitHub releases none

The upstream main branch (zerotier/chef-zerotier, HEAD 671d3b9, 2021-02-18) does have the fix, from PR #6 "Modernize the cookbook and resolve failures on Chef Infra Client >= 16":

  • Replaced ::File.exists? with ::File.exist? in both the Ohai template and the zerotier_network resource.
  • Converted the HWRP library to a DSL custom resource.
  • Expanded platform support.

But it was never released or tagged: metadata.rb still says 1.0.7, so berks install / berks update cannot get it.

Options

  1. Keep the local override (current). Zero risk with the published 1.0.7. Downside: if we ever start using zerotier_network, we'd need to override that resource too.
  2. Track upstream main in the Berksfile (cookbook 'zerotier', git: 'https://github.com/zerotier/chef-zerotier.git', ref: 'main'). Gets the full fix, but it is an unreleased branch. Note: the new resource has no default_action (defaults to :nothing), while the old 1.0.7 HWRP had default_action :join; kosmos_zerotier/recipes/default.rb would need action :join.
  3. Fork chef-zerotier and pin a release/tag, like openresty.

Recommendation

Option 2 or 3, so the upstream fix is tracked rather than relying on a local override. Option 1 is acceptable until the zerotier_network resource is used.

## Problem The vendored `zerotier` cookbook (1.0.7, from Supermarket) uses `::File.exists?`, which was removed in Ruby 3.4. This breaks on the Cinc Client 19 (Ruby 3.4) migration: - `templates/default/zerotier_ohai.rb` — the Ohai plugin fails to collect, so the `zerotier` attribute disappears from the node. This is live: `roles/base.rb` includes `kosmos_zerotier::ohai_plugin`, so every migrated node loses the attribute. - `libraries/zerotier_network.rb` — the `zerotier_network` resource also uses `File.exists?`. Not currently exercised by any node (no node runs `kosmos_zerotier::default` or `zerotier::join_networks`), but it would fail on the next node that uses it. We already work around this in `site-cookbooks/kosmos_zerotier` (local template override + `File.exist?`), but the workaround is not the upstream fix. ## Upstream status There is **no released version** that supports modern Ruby: | Source | Latest | |---|---| | Supermarket | 1.0.7 (2017-11-28) — same as vendored | | GitHub tags | 1.0.7 | | GitHub releases | none | The upstream `main` branch (`zerotier/chef-zerotier`, HEAD `671d3b9`, 2021-02-18) **does** have the fix, from PR #6 "Modernize the cookbook and resolve failures on Chef Infra Client >= 16": - Replaced `::File.exists?` with `::File.exist?` in both the Ohai template and the `zerotier_network` resource. - Converted the HWRP library to a DSL custom resource. - Expanded platform support. But it was never released or tagged: `metadata.rb` still says `1.0.7`, so `berks install` / `berks update` cannot get it. ## Options 1. **Keep the local override** (current). Zero risk with the published 1.0.7. Downside: if we ever start using `zerotier_network`, we'd need to override that resource too. 2. **Track upstream `main`** in the Berksfile (`cookbook 'zerotier', git: 'https://github.com/zerotier/chef-zerotier.git', ref: 'main'`). Gets the full fix, but it is an unreleased branch. Note: the new resource has no `default_action` (defaults to `:nothing`), while the old 1.0.7 HWRP had `default_action :join`; `kosmos_zerotier/recipes/default.rb` would need `action :join`. 3. **Fork** `chef-zerotier` and pin a release/tag, like `openresty`. ## Recommendation Option 2 or 3, so the upstream fix is tracked rather than relying on a local override. Option 1 is acceptable until the `zerotier_network` resource is used.
raucao added the dev environment label 2026-11-09 19:03:26 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: kosmos/chef#701