3 ms·
I am trying this tool. First impression: The plugin framework works like charm. Creating a small plugin to get GitHub org repo info. Working with only two files
by msnut 7y ago
I am trying this tool. First impression: The plugin framework works like charm. Creating a small plugin to get GitHub org repo info. Working with only two files. Plugin is one file and configuration yaml is other file.
I am not Python developer. I develop in Powershell. So don't judge my code. :)
I put this in ghcloud.py.
import urllib.request
import json
class GhCloud:
def __init__(self, org):
self.org = org
def read(self):
url = 'https://api.github.com/orgs/%s/repos' % self.org
data = json.loads(urllib.request.urlopen(url).read().decode('utf-8'))
for d in data: yield d
def done(self):
pass
I put this in cloudmarker.yaml.
plugins:
ghplug:
plugin: ghcloud.GhCloud
params:
org: python
audits:
ghmon:
clouds:
- ghplug
stores:
- esstore
- filestore
run:
- ghmon
I run tool.
PYTHONPATH=. cloudmarker --now
Cloudmarker runs my ghcloud.py and puts data into localhost:9200 and /tmp automatically. I can do it without cloning Cloudmarker code. I only hack my code and Cloudmarker runs it.