Skip to content

Commit

Permalink
Add missing hostname attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorific committed Apr 20, 2024
1 parent 79468ee commit 2469900
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions cookbooks/boxcutter_tailscale/libraries/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,16 @@ module Helpers
include Chef::Mixin::ShellOut

def load_config
result = shell_out!('/usr/bin/tailscale debug prefs')
JSON.parse(result.stdout)
begin
result = shell_out!('/usr/bin/tailscale debug prefs')
JSON.parse(result.stdout)
rescue Mixlib::ShellOut::ShellCommandFailed => e
Chef::Log.error("boxcutter_tailscale: load_config() failed to execute command: #{e.message}")
return nil
rescue JSON::ParserError => e
Chef::Log.error("boxcutter_tailscale: load_config() JSON parsing failed: #{e.message}")
return nil
end
end
end
end
Expand Down
1 change: 1 addition & 0 deletions cookbooks/boxcutter_tailscale/recipes/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
end

boxcutter_tailscale 'default' do
hostname lazy { node['boxcutter_tailscale']['hostname'] }
api_base_url lazy { node['boxcutter_tailscale']['api_base_url'] }
tailnet lazy { node['boxcutter_tailscale']['tailnet'] }
ephemeral lazy { node['boxcutter_tailscale']['ephemeral'] }
Expand Down

0 comments on commit 2469900

Please sign in to comment.