Rename api.common to humbug
Fixes #482. (imported from commit 1bd6a7fd993d8d5e225e0311c288dbce0c369a40)
This commit is contained in:
parent
4bfd784423
commit
f9f8a6e603
|
@ -6,6 +6,7 @@ import os
|
||||||
import random
|
import random
|
||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from os import path
|
||||||
|
|
||||||
parser = optparse.OptionParser()
|
parser = optparse.OptionParser()
|
||||||
parser.add_option('--verbose',
|
parser.add_option('--verbose',
|
||||||
|
@ -33,13 +34,14 @@ mit_user = 'tabbott/extra@ATHENA.MIT.EDU'
|
||||||
humbug_user = 'tabbott/extra@mit.edu'
|
humbug_user = 'tabbott/extra@mit.edu'
|
||||||
|
|
||||||
sys.path.append(".")
|
sys.path.append(".")
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(__file__)))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
humbug_client = api.common.HumbugAPI(email=humbug_user,
|
humbug_client = humbug.HumbugAPI(
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
email=humbug_user,
|
||||||
verbose=True,
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
client="test: Humbug API",
|
verbose=True,
|
||||||
site=options.site)
|
client="test: Humbug API",
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
# Configure logging
|
# Configure logging
|
||||||
log_file = "/home/humbug/check-mirroring-log"
|
log_file = "/home/humbug/check-mirroring-log"
|
||||||
|
|
|
@ -2,17 +2,20 @@
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import optparse
|
import optparse
|
||||||
|
from os import path
|
||||||
|
|
||||||
sys.path.append(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
prod_client = api.common.HumbugAPI(email="feedback@humbughq.com",
|
prod_client = humbug.HumbugAPI(
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
email="feedback@humbughq.com",
|
||||||
verbose=True,
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
site="https://humbughq.com")
|
verbose=True,
|
||||||
staging_client = api.common.HumbugAPI(email="feedback@humbughq.com",
|
site="https://humbughq.com")
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
staging_client = humbug.HumbugAPI(
|
||||||
verbose=True,
|
email="feedback@humbughq.com",
|
||||||
site="https://staging.humbughq.com")
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
|
||||||
|
verbose=True,
|
||||||
|
site="https://staging.humbughq.com")
|
||||||
|
|
||||||
def forward_message(message):
|
def forward_message(message):
|
||||||
if message["type"] != "personal":
|
if message["type"] != "personal":
|
||||||
|
|
|
@ -10,8 +10,8 @@ import itertools
|
||||||
import traceback
|
import traceback
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
|
|
||||||
parser = optparse.OptionParser(r"""
|
parser = optparse.OptionParser(r"""
|
||||||
|
|
||||||
|
@ -91,10 +91,11 @@ def get_calendar_url():
|
||||||
|
|
||||||
calendar_url = get_calendar_url()
|
calendar_url = get_calendar_url()
|
||||||
|
|
||||||
humbug = api.common.HumbugAPI(email=options.user,
|
humbug = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
site=options.site,
|
api_key=options.api_key,
|
||||||
verbose=True)
|
site=options.site,
|
||||||
|
verbose=True)
|
||||||
|
|
||||||
def get_events():
|
def get_events():
|
||||||
feed = CalendarClient().GetCalendarEventFeed(uri=calendar_url)
|
feed = CalendarClient().GetCalendarEventFeed(uri=calendar_url)
|
||||||
|
|
|
@ -18,11 +18,12 @@ from trac.core import Component, implements
|
||||||
from trac.ticket import ITicketChangeListener
|
from trac.ticket import ITicketChangeListener
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
sys.path.append("/home/humbug/humbug")
|
sys.path.append("/home/humbug/humbug/api")
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email="humbug+trac@humbughq.com",
|
client = humbug.HumbugAPI(
|
||||||
site="https://staging.humbughq.com",
|
email="humbug+trac@humbughq.com",
|
||||||
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
site="https://staging.humbughq.com",
|
||||||
|
api_key="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx")
|
||||||
|
|
||||||
def markdown_ticket_url(ticket, heading="ticket"):
|
def markdown_ticket_url(ticket, heading="ticket"):
|
||||||
return "[%s #%s](https://trac.humbughq.com/ticket/%s)" % (heading, ticket.id, ticket.id)
|
return "[%s #%s](https://trac.humbughq.com/ticket/%s)" % (heading, ticket.id, ticket.id)
|
||||||
|
|
|
@ -3,8 +3,8 @@ import sys
|
||||||
import optparse
|
import optparse
|
||||||
from os import path
|
from os import path
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
|
|
||||||
# Nagios passes the notification details as command line options.
|
# Nagios passes the notification details as command line options.
|
||||||
# In Nagios, "output" means "first line of output", and "long
|
# In Nagios, "output" means "first line of output", and "long
|
||||||
|
@ -43,7 +43,7 @@ if output:
|
||||||
# Block-quote any command output.
|
# Block-quote any command output.
|
||||||
msg['content'] += ('\n\n' + '\n'.join('> ' + ln for ln in output.splitlines()))
|
msg['content'] += ('\n\n' + '\n'.join('> ' + ln for ln in output.splitlines()))
|
||||||
|
|
||||||
client = api.common.HumbugAPI(
|
client = humbug.HumbugAPI(
|
||||||
email = 'humbug+nagios@humbughq.com',
|
email = 'humbug+nagios@humbughq.com',
|
||||||
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
api_key = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
||||||
site = 'https://staging.humbughq.com')
|
site = 'https://staging.humbughq.com')
|
||||||
|
|
|
@ -774,7 +774,9 @@ if __name__ == "__main__":
|
||||||
|
|
||||||
(options, args) = parse_args()
|
(options, args) = parse_args()
|
||||||
|
|
||||||
sys.path[:0] = [options.root_path, os.path.join(options.root_path, "python-zephyr"),
|
sys.path[:0] = [options.root_path,
|
||||||
|
os.path.join(options.root_path, 'api'),
|
||||||
|
os.path.join(options.root_path, "python-zephyr"),
|
||||||
os.path.join(options.root_path, "python-zephyr/build/lib.linux-x86_64-2.6/")]
|
os.path.join(options.root_path, "python-zephyr/build/lib.linux-x86_64-2.6/")]
|
||||||
|
|
||||||
# In case this is an automated restart of the mirroring script,
|
# In case this is an automated restart of the mirroring script,
|
||||||
|
@ -794,12 +796,13 @@ or specify the --api-key-file option.""" % (options.api_key_file,)))
|
||||||
# don't need to read it in
|
# don't need to read it in
|
||||||
os.environ["HUMBUG_API_KEY"] = api_key
|
os.environ["HUMBUG_API_KEY"] = api_key
|
||||||
|
|
||||||
import api.common
|
import humbug
|
||||||
humbug_client = api.common.HumbugAPI(email=options.user + "@mit.edu",
|
humbug_client = humbug.HumbugAPI(
|
||||||
api_key=api_key,
|
email=options.user + "@mit.edu",
|
||||||
verbose=True,
|
api_key=api_key,
|
||||||
client="zephyr_mirror",
|
verbose=True,
|
||||||
site=options.site)
|
client="zephyr_mirror",
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
|
|
||||||
|
|
|
@ -37,11 +37,12 @@ parser.add_option('--api-key')
|
||||||
parser.add_option('--user')
|
parser.add_option('--user')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
print client.get_public_streams()
|
print client.get_public_streams()
|
||||||
|
|
|
@ -37,11 +37,12 @@ parser.add_option('--api-key')
|
||||||
parser.add_option('--user')
|
parser.add_option('--user')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
print client.list_subscriptions()
|
print client.list_subscriptions()
|
||||||
|
|
|
@ -37,12 +37,13 @@ parser.add_option('--api-key')
|
||||||
parser.add_option('--user')
|
parser.add_option('--user')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
def print_message(message):
|
def print_message(message):
|
||||||
print message
|
print message
|
||||||
|
|
|
@ -37,11 +37,12 @@ parser.add_option('--api-key')
|
||||||
parser.add_option('--user')
|
parser.add_option('--user')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
print client.get_messages({})
|
print client.get_messages({})
|
||||||
|
|
|
@ -44,12 +44,13 @@ parser.add_option('--type', default='private')
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
parser.error("You must specify recipients")
|
parser.error("You must specify recipients")
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.sender,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.sender,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
message_data = {
|
message_data = {
|
||||||
"type": options.type,
|
"type": options.type,
|
||||||
|
|
|
@ -38,12 +38,13 @@ parser.add_option('--site', default='https://humbughq.com')
|
||||||
parser.add_option('--streams', default='')
|
parser.add_option('--streams', default='')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
if options.streams == "":
|
if options.streams == "":
|
||||||
print >>sys.stderr, "Usage:", parser.usage
|
print >>sys.stderr, "Usage:", parser.usage
|
||||||
|
|
|
@ -38,12 +38,13 @@ parser.add_option('--site', default='https://humbughq.com')
|
||||||
parser.add_option('--streams', default='')
|
parser.add_option('--streams', default='')
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
sys.path.append(path.join(path.dirname(__file__), '../..'))
|
sys.path.append(path.join(path.dirname(__file__), '..'))
|
||||||
import api.common
|
import humbug
|
||||||
client = api.common.HumbugAPI(email=options.user,
|
client = humbug.HumbugAPI(
|
||||||
api_key=options.api_key,
|
email=options.user,
|
||||||
verbose=True,
|
api_key=options.api_key,
|
||||||
site=options.site)
|
verbose=True,
|
||||||
|
site=options.site)
|
||||||
|
|
||||||
if options.streams == "":
|
if options.streams == "":
|
||||||
print >>sys.stderr, "Usage:", parser.usage
|
print >>sys.stderr, "Usage:", parser.usage
|
||||||
|
|
Loading…
Reference in a new issue