Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
1,378 additions
and
1,253 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ redis = "*" | |
diskcache = "*" | ||
esipy = "*" | ||
pyyaml = ">=4.2b1" | ||
urllib3 = "==1.23" | ||
|
||
[requires] | ||
python_version = "2.7" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
-i https://pypi.org/simple | ||
coverage==4.5.2 | ||
nose2==0.8.0 | ||
coverage==4.5.3 | ||
funcsigs==1.0.2 ; python_version < '3.3' | ||
mock==2.0.0 ; python_version < '3.6' | ||
nose2==0.9.1 | ||
pbr==5.1.3 | ||
six==1.12.0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
-i https://pypi.org/simple | ||
certifi==2018.11.29 | ||
certifi==2019.3.9 | ||
chardet==3.0.4 | ||
diskcache==3.1.1 | ||
ecdsa==0.13 | ||
ecdsa==0.13.2 | ||
esipy==1.0.0 | ||
future==0.17.1 | ||
futures==3.2.0 | ||
idna==2.8 | ||
pyaml==18.11.0 | ||
pyaml==19.4.1 | ||
pyasn1==0.4.5 | ||
pyswagger==0.8.39 | ||
python-jose==3.0.1 | ||
pytz==2018.9 | ||
pyyaml==4.2b4 | ||
redis==3.0.1 | ||
pytz==2019.1 | ||
pyyaml==5.1 | ||
redis==3.2.1 | ||
requests==2.21.0 | ||
rsa==4.0 | ||
six==1.12.0 | ||
urllib3==1.24.1 | ||
urllib3==1.23 | ||
validate-email==1.3 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,71 @@ | ||
#!/usr/bin/env python | ||
|
||
import logging | ||
import argparse | ||
|
||
from structurebot.config import CONFIG | ||
from structurebot.util import notify_slack, name_to_id | ||
from structurebot.citadels import check_citadels | ||
from structurebot.citadels import Structure | ||
from structurebot.assets import Asset | ||
from structurebot.pos import check_pos | ||
|
||
|
||
if __name__ == '__main__': | ||
level = logging.WARNING | ||
if CONFIG['DEBUG']: | ||
level = logging.INFO | ||
logging.basicConfig(level=level) | ||
level = logging.WARNING | ||
if CONFIG['DEBUG']: | ||
level = logging.INFO | ||
logging.basicConfig(level=level) | ||
|
||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--suppress-upcoming-detonations', dest='upcoming_detonations', action='store_false') | ||
parser.add_argument('--suppress-unscheduled-detonations', dest='unscheduled_detonations', action='store_false') | ||
parser.add_argument('--suppress-ansiblex-ozone', dest='ansiblex_ozone', action='store_false') | ||
parser.add_argument('--suppress-fuel-warning', dest='fuel_warning', action='store_false') | ||
parser.add_argument('--suppress-service-state', dest='service_state', action='store_false') | ||
parser.add_argument('--suppress-structure-state', dest='structure_state', action='store_false') | ||
|
||
args = parser.parse_args() | ||
|
||
messages = [] | ||
try: | ||
corp_name = CONFIG['CORPORATION_NAME'] | ||
CONFIG['CORP_ID'] = name_to_id(corp_name, 'corporation') | ||
assets = Asset.from_name(corp_name) | ||
structures = Structure.from_corporation(corp_name, assets) | ||
messages = [] | ||
try: | ||
messages += check_citadels(corp_name, assets) | ||
messages += check_pos(corp_name, assets) | ||
except Exception, e: | ||
if CONFIG['DEBUG']: | ||
raise | ||
if e.message: | ||
messages = [e.message] | ||
else: | ||
raise | ||
if messages: | ||
messages.insert(0, ' Upcoming {} Structure Maintenence Tasks'.format(corp_name)) | ||
notify_slack(sorted(messages)) | ||
for structure in structures: | ||
message = [] | ||
if not structure.accessible: | ||
msg = 'Found an inaccesible citadel ({}) in {}'.format(structure.structure_id, structure.system_id) | ||
messages.append(msg) | ||
continue | ||
if args.unscheduled_detonations and structure.needs_detonation: | ||
message.append('Needs to have an extraction scheduled') | ||
if args.upcoming_detonations and structure.detonates_soon: | ||
message.append('Ready to detonate {}'.format(structure.detonation)) | ||
if args.ansiblex_ozone and structure.needs_ozone: | ||
message.append('Low on Liquid Ozone: {}'.format(structure.jump_fuel)) | ||
if args.fuel_warning and structure.needs_fuel: | ||
message.append('Runs out of fuel on {}'.format(structure.fuel_expires)) | ||
if args.service_state: | ||
if structure.online_services: | ||
message.append('Online Services: {}'.format(', '.join(structure.online_services))) | ||
if structure.offline_services: | ||
message.append('Offline Services: {}'.format(', '.join(structure.offline_services))) | ||
if args.service_state and structure.offline_services: | ||
message.append('Offline services: {}'.format(', '.join(structure.offline_services))) | ||
if args.structure_state and (structure.vulnerable or structure.reinforced): | ||
state = structure.state.replace('_', ' ').title() | ||
message.append('{} until {}'.format(state, structure.state_timer_end)) | ||
if message: | ||
messages.append(u'\n'.join([u'{}'.format(structure.name)] + message)) | ||
messages += check_pos(corp_name, assets) | ||
except Exception, e: | ||
if CONFIG['DEBUG']: | ||
raise | ||
else: | ||
messages = [str(e)] | ||
if messages: | ||
messages.insert(0, ' Upcoming {} Structure Maintenence Tasks'.format(corp_name)) | ||
notify_slack(sorted(messages)) | ||
|
||
|
Oops, something went wrong.