Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add docker rest api agent #180

Merged
merged 1 commit into from
Sep 20, 2020
Merged

Conversation

dexhunter
Copy link
Contributor

docker agent for api-agent #121

Signed-off-by: Dixing (Dex) Xu dixingxu@gmail.com

@dexhunter dexhunter requested a review from a team August 29, 2020 01:46
@lgtm-com
Copy link

lgtm-com bot commented Aug 29, 2020

This pull request introduces 8 alerts when merging 05a3ed4 into ae053b6 - view on LGTM.com

new alerts:

  • 6 for Unused local variable
  • 2 for Unused import

@dexhunter dexhunter force-pushed the wip-docker-rest-api branch from 05a3ed4 to 4d0ba69 Compare August 29, 2020 02:04
@lgtm-com
Copy link

lgtm-com bot commented Aug 29, 2020

This pull request introduces 2 alerts when merging 4d0ba69 into ae053b6 - view on LGTM.com

new alerts:

  • 2 for Unused local variable

Copy link
Member

@yeasy yeasy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides, where are the testing cases?



class NodeStart(Resource):
def put(self):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put --> POST

res['status'] = 'deleted'
return res

api.add_resource(QueryNetwork, '/api/v1/query_network')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nodes as the class.
Each operation is as a method.

@app.route('/api/v1/nodes/<id>', methods=['GET', 'POST'])
def operate_node(id):

if request.method == 'POST':
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this special if check?

try:
container.stop()
except:
res['code'] = 'Fail'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you are using the same code snippet more than once, better wrap into some small method.

@lgtm-com
Copy link

lgtm-com bot commented Sep 19, 2020

This pull request introduces 7 alerts when merging dc47444 into 24ace07 - view on LGTM.com

new alerts:

  • 5 for Unused local variable
  • 2 for Unused import

@dexhunter dexhunter force-pushed the wip-docker-rest-api branch 2 times, most recently from 20981f0 to fea705e Compare September 19, 2020 02:16
# same as `docker run -dit yeasy/hyperledge-fabric:2.2.0 -e VARIABLES``
container = client.containers.run(request.form.get('img'), request.form.get('cmd'), detach=True, tty=True, stdin_open=True, name=request.form.get('name'), environment=env)
except:
res['code'] = 'Fail'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better use const to define the status code.

@dexhunter dexhunter force-pushed the wip-docker-rest-api branch 2 times, most recently from b9bfed3 to c184c04 Compare September 19, 2020 03:04
@dexhunter
Copy link
Contributor Author

@yeasy I have addressed the comments and updated the code base, please help review. Thanks!

docker agent for api-agent hyperledger#121
* support for node creation, start, stop, restart, deletion
* add crypto materials and integration test

Signed-off-by: Dixing (Dex) Xu <dixingxu@gmail.com>
@yeasy yeasy merged commit 77189c8 into hyperledger:master Sep 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants