Skip to content

Instantly share code, notes, and snippets.

@kwcooper
Last active December 31, 2020 21:30
Show Gist options
  • Save kwcooper/85195180b51d2c66977250802d31b2d6 to your computer and use it in GitHub Desktop.
Save kwcooper/85195180b51d2c66977250802d31b2d6 to your computer and use it in GitHub Desktop.
Very simple external IP plugin for the landscape-sysinfo linux package
# Modified 190812 k
# Be sure to add to the list of packages in deployment.py
# /usr/lib/python3/dist-packages/landscape/sysinfo/deployment.py
from twisted.internet.defer import succeed
from requests import get
current_instance = None
class Extip(object):
def __init__(self):
self.sysinfo = None
self.has_run = False
global current_instance
current_instance = self
def register(self, sysinfo):
self.sysinfo = sysinfo
def run(self):
self.has_run = True
# grab the ip info from ipify
ip = get('https://api.ipify.org').text
self.sysinfo.add_header("External IP", ip)
#self.sysinfo.add_note("Test note")
#self.sysinfo.add_footnote("Test footnote")
return succeed(None)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment