Last active
December 31, 2020 21:30
-
-
Save kwcooper/85195180b51d2c66977250802d31b2d6 to your computer and use it in GitHub Desktop.
Very simple external IP plugin for the landscape-sysinfo linux package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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