From d63ce7e67125ab6a29bf131cb3c213fe3042f3b6 Mon Sep 17 00:00:00 2001 From: Bob Harold Date: Fri, 12 Jul 2019 13:39:13 -0400 Subject: [PATCH 1/5] Make wadl2methodlist.py executable --- samples/wadl2methodlist.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 samples/wadl2methodlist.py diff --git a/samples/wadl2methodlist.py b/samples/wadl2methodlist.py old mode 100644 new mode 100755 -- GitLab From fbd983bc43929eac83fa7867c4c2072cd7f3493b Mon Sep 17 00:00:00 2001 From: Bob Harold Date: Fri, 12 Jul 2019 13:39:46 -0400 Subject: [PATCH 2/5] remove optional method=get --- samples/getsysteminfo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/samples/getsysteminfo.py b/samples/getsysteminfo.py index 5d3bd42..1199901 100755 --- a/samples/getsysteminfo.py +++ b/samples/getsysteminfo.py @@ -49,5 +49,6 @@ logger.setLevel(args.logging) opts = {"timeout": None, "max_retries": 0} with bluecat_bam.BAM(args.server, args.username, args.password, **opts) as conn: - info = conn.do("getSystemInfo", method="get") + # info = conn.do("getSystemInfo", method="get") + info = conn.do("getSystemInfo") print(json.dumps(info)) -- GitLab From ed27eb7759ccaa05a9ea88c22d4561c142a310f4 Mon Sep 17 00:00:00 2001 From: Bob Harold Date: Fri, 12 Jul 2019 13:40:03 -0400 Subject: [PATCH 3/5] Update for new public repo --- FUTURE | 6 +++--- README.md | 29 ++++++++++++++++++++++------- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/FUTURE b/FUTURE index 65f57e8..919c7c3 100644 --- a/FUTURE +++ b/FUTURE @@ -4,7 +4,7 @@ Let me know what is important to you! Read wadl file from bluecat server, and use it to: - take arguments without the names -- figure out the http method automatically +- figure out the http method automatically (partly done) - Handle start and count automatically Together, instead of: ./bam.py getEntities method=get parentId=13098279 type=HostRecord start=0 count=99999 @@ -28,5 +28,5 @@ Select what fields to output, instead of whole objects, if desired Add common tasks that map to several API calls, like getting a DNS record by FQDN -Sort dictionary items, either alphabetically, -or in an order that makes sense for BlueCat entities. +Sort dictionary items so that output is in a consistent order, +either alphabetically, or in an order that makes sense for BlueCat entities. diff --git a/README.md b/README.md index 4e727a4..0831958 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Use as a Python module like: import json import bluecat_bam with BAM(server, username, password) as conn: - r = conn.do('getEntityByName', method='get', parentId=0, name='admin', type='User') + r = conn.do('getEntityByName', parentId=0, name='admin', type='User') print(json.dumps(r)) ``` Sample output: @@ -29,13 +29,15 @@ Sample output: Or use on the command line as a CLI, putting the setup in the environment: ``` -cat > mybluecat.env <> mybluecat.env < Date: Fri, 12 Jul 2019 14:16:29 -0400 Subject: [PATCH 4/5] Add extra_requires for installing test requires via pip --- setup.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 8a8fddf..18e64d6 100644 --- a/setup.py +++ b/setup.py @@ -8,6 +8,19 @@ version_file_path = os.path.join(os.path.dirname(__file__), "src", name, "VERSIO with open(version_file_path) as version_file: _version = version_file.read().strip() +tests_require = ( + [ + "pytest", + "pytest_mock", + "requests_mock", + "flake8", + "bandit", + "pylint", + "black", + "xmltodict", + ], +) + setup( name=name, version=_version, @@ -16,7 +29,8 @@ setup( include_package_data=True, zip_safe=False, setup_requires=["pytest-runner"], - tests_require=["pytest", "pytest_mock", "requests_mock"], + tests_require=tests_require, + extras_require={"test": tests_require}, install_requires=["requests==2.21.0"], entry_points={"console_scripts": ["bam=bluecat_bam.cli:main"]}, ) -- GitLab From 65169bf720f00f7909e0cca9521673d4d61c87d3 Mon Sep 17 00:00:00 2001 From: Bob Harold Date: Fri, 12 Jul 2019 14:24:51 -0400 Subject: [PATCH 5/5] update readme because we updated setup.py to install test requirements with pip install ".[test]" --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 0831958..7fb48c7 100644 --- a/README.md +++ b/README.md @@ -84,19 +84,13 @@ pip install . ``` If installed as a user, you might need to add "~/.local/bin" to your PATH -## Dev Installation ## +## Dev Installation in virtualenv ## ``` git clone git@gitlab.umich.edu:its-public/bluecat_bam.git cd bluecat_rest_api_python2 virtualenv venv -p python2 source ./venv/bin/activate -pip install --upgrade -e . -pip install requests -# for testing: -pip3 install black -pip install pylint flake8 pytest bandit -# for wald2methodlist.py -pip install xmltodict +pip install ".[test]" ``` If installed as a user, you might need to add "~/.local/bin" to your PATH -- GitLab