SHARE
TWEET

Untitled

a guest Mar 24th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/jq -Sf
  2.  
  3. def chef_fields:
  4.   # special field adjustments go here
  5.   .
  6. ;
  7.  
  8. .rows|
  9. map(select(.name)) | sort_by(.name) |
  10.  
  11. map(chef_fields |
  12.     [
  13.       .automatic,
  14.       .automatic.dmi,
  15.       . # the current data
  16.     ] | add |
  17.   {
  18.     labels:
  19.     {
  20.       kernel_release: .kernel.release,
  21.       os,
  22.       os_version,
  23.       platform,
  24.       platform_version,
  25.       platform_family,
  26.     },
  27.     targets: ["\(.name):9100"]
  28.     # remove all empty or null labels
  29.   } | delpaths([path(.labels[]| select(. == "" or . == null))])
  30.  
  31. )
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top