Skip to content

Commit

Permalink
add setupmeta, clean up some cruft
Browse files Browse the repository at this point in the history
  • Loading branch information
patricksanders committed Sep 13, 2024
1 parent 8394647 commit bd8827c
Show file tree
Hide file tree
Showing 11 changed files with 34 additions and 159 deletions.
29 changes: 0 additions & 29 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Aardvark
Aardvark - Multi-Account AWS IAM Access Advisor API
========
[![NetflixOSS Lifecycle](https://img.shields.io/osslifecycle/Netflix/osstracker.svg)]()
[![Discord chat](https://img.shields.io/discord/754080763070382130?logo=discord)](https://discord.gg/9kwMWa6)
Expand Down
16 changes: 0 additions & 16 deletions aardvark/__about__.py

This file was deleted.

3 changes: 0 additions & 3 deletions aardvark/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ensure absolute import for python3
from __future__ import absolute_import

import os.path
import logging
from logging import DEBUG, Formatter, StreamHandler
Expand Down
41 changes: 12 additions & 29 deletions aardvark/manage.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# ensure absolute import for python3
from __future__ import absolute_import

import os
try:
import queue as Queue # Queue renamed to queue in py3
except ModuleNotFoundError:
import Queue
import queue
import re
import threading

import better_exceptions # noqa
from blinker import Signal
from bunch import Bunch
from flask import current_app
Expand All @@ -21,19 +14,9 @@
from aardvark.app import create_app, db
from aardvark.updater import AccountToUpdate

try: # Python 2
raw_input
except NameError: # Python 3
raw_input = input

try: # Python 2
unicode
except NameError: # Python 3
unicode = str

manager = Manager(create_app)

ACCOUNT_QUEUE = Queue.Queue()
ACCOUNT_QUEUE = queue.Queue()
DB_LOCK = threading.Lock()
QUEUE_LOCK = threading.Lock()
UPDATE_DONE = False
Expand Down Expand Up @@ -147,9 +130,9 @@ def create_db():
# All of these default to None rather than the corresponding DEFAULT_* values
# so we can tell whether they were passed or not. We don't prompt for any of
# the options that were passed as parameters.
@manager.option('-a', '--aardvark-role', dest='aardvark_role_param', type=unicode)
@manager.option('-b', '--swag-bucket', dest='bucket_param', type=unicode)
@manager.option('-d', '--db-uri', dest='db_uri_param', type=unicode)
@manager.option('-a', '--aardvark-role', dest='aardvark_role_param', type=str)
@manager.option('-b', '--swag-bucket', dest='bucket_param', type=str)
@manager.option('-d', '--db-uri', dest='db_uri_param', type=str)
@manager.option('--num-threads', dest='num_threads_param', type=int)
@manager.option('--no-prompt', dest='no_prompt', action='store_true', default=False)
def config(aardvark_role_param, bucket_param, db_uri_param, num_threads_param, no_prompt):
Expand Down Expand Up @@ -202,10 +185,10 @@ def config(aardvark_role_param, bucket_param, db_uri_param, num_threads_param, n
write_swag = True
else:
print('\nAardvark can use SWAG to look up accounts. See {repo_url}'.format(repo_url=SWAG_REPO_URL))
use_swag = raw_input('Do you use SWAG to track accounts? [yN]: ')
use_swag = input('Do you use SWAG to track accounts? [yN]: ')
if len(use_swag) > 0 and 'yes'.startswith(use_swag.lower()):
bucket_prompt = 'SWAG_BUCKET [{default}]: '.format(default=DEFAULT_SWAG_BUCKET)
bucket = raw_input(bucket_prompt) or DEFAULT_SWAG_BUCKET
bucket = input(bucket_prompt) or DEFAULT_SWAG_BUCKET
write_swag = True
else:
write_swag = False
Expand All @@ -214,9 +197,9 @@ def config(aardvark_role_param, bucket_param, db_uri_param, num_threads_param, n
db_uri_prompt = 'DATABASE URI [{default}]: '.format(default=default_db_uri)
num_threads_prompt = '# THREADS [{default}]: '.format(default=DEFAULT_NUM_THREADS)

aardvark_role = aardvark_role_param or raw_input(aardvark_role_prompt) or DEFAULT_AARDVARK_ROLE
db_uri = db_uri_param or raw_input(db_uri_prompt) or default_db_uri
num_threads = num_threads_param or raw_input(num_threads_prompt) or DEFAULT_NUM_THREADS
aardvark_role = aardvark_role_param or input(aardvark_role_prompt) or DEFAULT_AARDVARK_ROLE
db_uri = db_uri_param or input(db_uri_prompt) or default_db_uri
num_threads = num_threads_param or input(num_threads_prompt) or DEFAULT_NUM_THREADS

log = """LOG_CFG = {
'version': 1,
Expand Down Expand Up @@ -268,8 +251,8 @@ def config(aardvark_role_param, bucket_param, db_uri_param, num_threads_param, n
filedata.write(log)


@manager.option('-a', '--accounts', dest='accounts', type=unicode, default='all')
@manager.option('-r', '--arns', dest='arns', type=unicode, default='all')
@manager.option('-a', '--accounts', dest='accounts', type=str, default='all')
@manager.option('-r', '--arns', dest='arns', type=str, default='all')
def update(accounts, arns):
"""
Asks AWS for new Access Advisor information.
Expand Down
3 changes: 0 additions & 3 deletions aardvark/model.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#ensure absolute import for python3
from __future__ import absolute_import

import datetime

from flask import current_app
Expand Down
3 changes: 0 additions & 3 deletions aardvark/updater/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# ensure absolute import for python3
from __future__ import absolute_import

import copy
import time

Expand Down
6 changes: 1 addition & 5 deletions aardvark/utils/sqla_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,14 @@

# courtesy of Xion: http://xion.io/post/code/sqlalchemy-regex-filters.html

#ensure absolute import for python3
from __future__ import absolute_import

import re
import sqlite3

from sqlalchemy import String as _String, event, exc
from sqlalchemy.engine import Engine
from sqlalchemy.ext.compiler import compiles
from sqlalchemy.sql.expression import BinaryExpression, func, literal
from sqlalchemy.sql.operators import custom_op
import sqlite3


__all__ = ['String']

Expand Down
5 changes: 0 additions & 5 deletions aardvark/view.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
#ensure absolute import for python3
from __future__ import absolute_import

import better_exceptions # noqa
import datetime
import json

from flask import abort, jsonify
from flask import Blueprint
Expand Down
23 changes: 12 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
aniso8601==8.0.0
astroid==2.4.2
attrs==19.3.0
better-exceptions==0.1.7
blinker
boto3==1.20.43
botocore==1.23.43
bunch==1.0.1
cloudaux>=1.8.0 # pinned
Flask==1.0.2
Flask-RESTful==0.3.5
Flask-Script==2.0.5
Flask-SQLAlchemy>=2.5 # pinned
SQLAlchemy==1.3.10
swag-client==0.4.6

# indirect
aniso8601==8.0.0
astroid==2.4.2
attrs==19.3.0
certifi==2023.7.22
chardet==3.0.4
Click==7.0
click-log==0.3.2
cloudaux==1.8.0
decorator==4.4.0
deepdiff==3.3.0
defusedxml==0.6.0
docutils==0.15.2
dogpile.cache==0.8.0
flagpole==1.1.1
flasgger==0.9.5
Flask==1.0.2
Flask-RESTful==0.3.5
Flask-Script==2.0.5
Flask-SQLAlchemy>=2.5
gunicorn==19.7.1
idna==2.8
importlib-metadata
Expand Down Expand Up @@ -51,8 +54,6 @@ requests==2.31.0
retrying==1.3.3
simplejson==3.16.0
six==1.12.0
SQLAlchemy==1.3.10
swag-client==0.4.6
tabulate==0.8.5
tqdm==4.40.0
Werkzeug==0.16.0
Expand Down
62 changes: 8 additions & 54 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,61 +1,15 @@
"""
Aardvark
=====
Multi-Account AWS IAM Access Advisor API
:copyright: (c) 2017 by Netflix
:license: Apache, see LICENSE for more details.
"""
from __future__ import absolute_import

from pathlib import Path

from setuptools import setup, find_packages

from aardvark import __about__

this_directory = Path(__file__).parent
long_description = (this_directory / "README.md").read_text()

install_requires = [
'requests',
'better_exceptions',
'blinker',
'Bunch',
'Flask-SQLAlchemy>=2.5',
'cloudaux>=1.8.0',
'Flask',
'Jinja2',
'Flask-RESTful',
'Flask-Script',
'flasgger',
'gunicorn',
'itsdangerous',
'psycopg2-binary',
'pytz',
'swag-client',
'tqdm',
]

tests_require = [
'pexpect>=4.2.1'
]
from setuptools import setup


setup(
name=__about__.__title__,
version=__about__.__version__,
author=__about__.__author__,
author_email=__about__.__email__,
url=__about__.__uri__,
description=__about__.__summary__,
long_description=long_description,
long_description_content_type="text/markdown",
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=install_requires,
name="aardvark",
author="Patrick Kelley, Travis McPeak, Patrick Sanders",
author_email="[email protected]",
url="https://github.com/Netflix-Skunkworks/aardvark",
setup_requires="setupmeta",
versioning="dev",
extras_require={
'tests': tests_require,
'tests': ['pexpect>=4.2.1'],
},
entry_points={
'console_scripts': [
Expand Down

0 comments on commit bd8827c

Please sign in to comment.