From feb2ed45ad8dd4dba9a97f77e877f846ed716897 Mon Sep 17 00:00:00 2001 From: Kazuhiro MUSASHI Date: Sat, 27 Apr 2024 14:58:04 +0900 Subject: [PATCH] Use `ip` command when Ubuntu 22.04. --- cookbooks/vault/attributes.rb | 2 +- cookbooks/vector/attributes.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbooks/vault/attributes.rb b/cookbooks/vault/attributes.rb index 1b6468d..0bcaa8b 100644 --- a/cookbooks/vault/attributes.rb +++ b/cookbooks/vault/attributes.rb @@ -3,7 +3,7 @@ # ------------------------------------------- case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp -when "20.04" +when "20.04", "22.04" cmd = 'LANG=C ip a | grep "inet " | grep -v -E "(127|172)" | cut -d" " -f6 | perl -pe "s/\/.+//g"' when "18.04" diff --git a/cookbooks/vector/attributes.rb b/cookbooks/vector/attributes.rb index 38f0084..8c312fd 100644 --- a/cookbooks/vector/attributes.rb +++ b/cookbooks/vector/attributes.rb @@ -2,7 +2,7 @@ # Specifying the default settings: # ------------------------------------------- case run_command('grep VERSION_ID /etc/os-release | awk -F\" \'{print $2}\'').stdout.chomp -when "20.04" +when "20.04", "22.04" cmd = 'LANG=C ip a | grep "inet " | grep -v -E "(127|172)" | cut -d" " -f6 | perl -pe "s/\/.+//g"' when "18.04"