-
Notifications
You must be signed in to change notification settings - Fork 54
Conversation
Conflicts: haas/cli.py
@SahilTikale, you'll need to work in the changes from #618. Also, could you go over this for style issues? Lots of PEP8/PEP257 violations here. please make sure you've read those documents and understood them, and follow the guidelines. The codebase is full of deviations in general, but let's not make it worse. Additionally, if you're using vim, I reccomend python-mode, which will warn you about a lot of these issues, plus things like unused imports, and will add other nice python-aware stuff to your editor as well: https://github.com/klen/python-mode @gsilvis, @henn, can we prioritize the pep8 testing soonish? |
yapf looks interesting; my experience with gofmt has been excellent, it would be great to have something like that for us. It's says the thing is still fairly immature though, so I'm worried about upgrading versions and then have my editor accidentally change a bunch of formatting without me having actually made any meaningful changes to the file. Even worse would be if two developers were using different versions of the tool, and kept thrashing, making surrious changes to the source... I gave it a try and it made a few odd choices, e.g. - return model.NetworkAttachment.query.filter(
- model.NetworkAttachment.nic == nic,
- query,
- ).count() != 0
+ return model.NetworkAttachment.query.filter(model.NetworkAttachment.nic
+ == nic,
+ query, ).count() != 0 ...but nothing I think not worth tolerating to just not spend review time on formatting issues at all. I'd want to verify we can rely on consistent output from release to release, but given that I love the idea of instituting this. |
1. Configure haas.cfg 2. Instantiate the database 3. Populate the database using dummy objects via restful requests 4. Tear down the setup in a clean fashion.
…alls Conflicts: haas/cli.py
haas/client/node.py
Outdated
q = requests.get(url, headers={"Authorization": "Basic %s" %self.auth}) | ||
return q.json() | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
blank lines
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I go through the test/client file and it looks ok.
However, when I was trying to deploy it and use it in devhaas, I hit this error:
(.venv)[shwsun@hack-n-hil: haas (HILclientlib-querycalls)]$ ./devhaas
+ haas switch_register dell-247 powerconnect55xx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
DEBUG:requests.packages.urllib3.connectionpool:http://127.0.0.1:5050 "PUT /switch/dell-247 HTTP/1.1" 200 0
+ haas switch_register cisco-1 nexus xxxxxxxxxxxxxxxxxxxxxxxxxxx
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
DEBUG:requests.packages.urllib3.connectionpool:http://127.0.0.1:5050 "PUT /switch/cisco-1 HTTP/1.1" 200 0
+ haas node_register sun-20 ipmi xxxxxxxxxxxxxxxxxxxxxxxxxxx
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
DEBUG:requests.packages.urllib3.connectionpool:http://127.0.0.1:5050 "PUT /node/sun-20 HTTP/1.1" 200 0
+ haas port_register dell-247 gi1/0/21
DEBUG:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
Error: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url: /switch/dell-247/port/gi1/0/21 (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x3cee990>: Failed to establish a new connection: [Errno 111] Connection refused',))
I also tried the currect haas and it is fine
tests/unit/client.py
Outdated
def make_config(): | ||
""" This function creates haas.cfg with desired options | ||
and writes to a temporary directory. | ||
It returns a tuple where (tmpdir, cwd) = ('location of haas.cfg', 'pwdd') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo pwdd
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like your configuration has some problems.
Is the server running on port 5000 or port 5050
DEBUG:requests.packages.urllib3.connectionpool:http://127.0.0.1:5050
or
Error: HTTPConnectionPool(host='127.0.0.1', port=5000): Max retries exceeded with url...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create an init_client file with correct values for following parameters.
export HAAS_ENDPOINT=http://<ip address + port no. where haas server is running>
export HAAS_USERNAME=<authorized username>
export HAAS_PASSWORD=<password for that username>
source this init_client file in your environment as we normally do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for catching the typo, next commit fixes it.
@shwsun you should edit your comment to hide login details in the error log. this page is public. |
@naved001 good catch, thank you! |
… to the top of test file. corrects a typo in comment.
@zenhack, I believe I have addressed all your comments, let me know if anything else is needed. |
@zenhack The thing that naved pointed out were some ip addr/passwd that I included previously in my comment, those sensitive info were already gotten rid of. |
tests/unit/client.py
Outdated
time.sleep(1) | ||
else: | ||
break | ||
return que | ||
return timeout |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would just raise an exception here (of a newly-declared type, which denotes a timeout), and get rid of the if/else checks elsewhere.
@SahilTikale, travis is failing. Given that it's just postgres I'm wondering whether 10 seconds is enough to be reliable, but I'm not totally sure what's going on. Other than that I'm happy; get the tests passing reliably again and I'll approve. |
@zenhack passes all the tests. |
@shwsun only your approval is pending. Let me know if you need me to address any issues. |
@SahilTikale I see, could you be around sometime tmr? I still have some questions on deployment |
@SahilTikale The tests are failing again. Probably due to the race condition thing you mentioned, it might even pass if we re-run this.
But I think we should reliably fix that test here, otherwise we would have a tough time with CI failing on future PRs. |
@SahilTikale, I agree with @naved001; the tests need to pass reliably. |
@shwsun I have addressed the issue we were discussing today. |
@shwsun I would like to get this PR merged if there is nothing else that you would want me to change. Let me know if you need anything else. |
I dont think I have any other more concerns. +1 |
@zenhack would you merge it (Yeahh, finally !!) or should I do it. |
Current PR, includes the basic code structure required to built a client library for HIL.
It also includes client library support for all query calls.
Still pending:
Unit tests for the new code.
Making correspondng cli calls to go via Client library.