Advertisement
Guest User

Untitled

a guest
May 8th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. '''
  3. primary_ipv4
  4. '''
  5. from __future__ import absolute_import
  6.  
  7. import subprocess
  8.  
  9. def primary_ipv4():
  10. '''
  11. Return primary_ipv4
  12. '''
  13. grain = {}
  14.  
  15. grain['primary_ipv4'] = subprocess.check_output("ip route get 1 | awk '{ print $7 }' | head -1", shell=True).rstrip()
  16.  
  17. return grain
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement