Skip to content
This repository has been archived by the owner on Apr 27, 2022. It is now read-only.

Make OBMd connection info required. #991

Merged
merged 14 commits into from
Apr 19, 2018
Merged

Conversation

zenhack
Copy link
Contributor

@zenhack zenhack commented Apr 8, 2018

This is built on top of #990, which should be merged first. Only the most recent commit is specific to this PR; see the commit message there for details.

We should wait until 0.3 has been tagged to merge this, since it involves changes that can't go into effect until after users have had the change to run our migration helper script.

We should also run the deployment tests for this one. I made an attempt at updating the deployment tests with the relevant changes (site-layout.json now needs to include the obmd info as well), but this needs testing.

Also, I noticed while I was editing the example site-layout.json that it's format seems to differ from what the code wants; it has a top-level "ipmi" field, but the code references an "obm" field. I have a hunch that this is bitrotten -- @naved001, can you compare against the site-layout.json that we've been using?

@zenhack zenhack added this to the 0.4 milestone Apr 8, 2018
@zenhack
Copy link
Contributor Author

zenhack commented Apr 8, 2018

Suspicions about site-layout.json were correct. I pushed a fix for the depolyment tests. It looks like there may also be some failures in the migration tests; will investigate more soon.

@zenhack zenhack force-pushed the obmd-api-changes branch 2 times, most recently from 2b3c022 to 4e97d79 Compare April 9, 2018 23:03
@zenhack
Copy link
Contributor Author

zenhack commented Apr 9, 2018

Still tracking down some places where stuff needed to change, but should be working soon. This is ready for review; there aren't going to be any big structural changes.

The amount of time a type system would have saved me on this one is insane.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 10, 2018

Ok, CI is passing.

@naved001
Copy link
Contributor

this can be rebased now

@zenhack
Copy link
Contributor Author

zenhack commented Apr 10, 2018

@naved001, done.

@coveralls
Copy link

coveralls commented Apr 10, 2018

Pull Request Test Coverage Report for Build 1839

  • 0 of 13 (0.0%) changed or added relevant lines in 5 files are covered.
  • 4 unchanged lines in 2 files lost coverage.
  • Overall coverage remained the same at 0.0%

Changes Missing Coverage Covered Lines Changed/Added Lines %
hil/client/node.py 0 2 0.0%
hil/model.py 0 2 0.0%
hil/api.py 0 3 0.0%
hil/cli/node.py 0 3 0.0%
hil/test_common.py 0 3 0.0%
Files with Coverage Reduction New Missed Lines %
hil/model.py 1 0.0%
hil/client/node.py 3 0.0%
Totals Coverage Status
Change from base Build 1832: 0.0%
Covered Lines: 0
Relevant Lines: 2580

💛 - Coveralls

@zenhack
Copy link
Contributor Author

zenhack commented Apr 10, 2018

Travis failure seem to be because of a new pycodestyle release, as of today; everything is explained by the release notes:

https://pypi.python.org/pypi/pycodestyle/2.4.0

I can fix these, but it might be better to do so separately, as unrelated style changes will make the diff harder to follow.

@naved001
Copy link
Contributor

naved001 commented Apr 11, 2018

I can fix these, but it might be better to do so separately, as unrelated style changes will make the diff harder to follow.

After this PR is approved, you could push one last commit to fix pylint errors before we merge it.

Besides the pylint errors, there are a bunch of line-too-long errors.

Edit: Dont know why I kept thinking it was pylint that got upgraded.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 11, 2018 via email

Copy link
Contributor

@naved001 naved001 left a comment

Choose a reason for hiding this comment

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

Mostly looks good to me, I just have some general questions.
I'll do another pass tomorrow and then approve it.

register all of your existing nodes with OBMd.
* Ensure that both the extensions ``hil.ext.obm.ipmi`` and
``hil.ext.obm.mock`` are listed in ``hil.cfg``.
* Run ``hil-admin db create``.
Copy link
Contributor

Choose a reason for hiding this comment

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

I might have lost context, but could you remind me why are we creating the tables for the mock obm if it didn't originally exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think it was actually discussed; some of this is future-tense for a migration script that's not part of this pr; I started hacking on this by deleting the old drivers and writing migration scripts, but decided this was a better ordering, since that basically required me to do everything at once, and I didn't want to burden you guys with reviewing everything at the same time. But I left the release notes in there.

Here's the migration script:

zenhack@e0767f1#diff-3801d3778ab81ddb9e26cf48f8663114R1

Per the comment at the top, the reason we need both drivers loaded is because the script "merges" their branches into the branch for hil core, so they have to exist.


* HIL now depends on OBMd to manage obms; the built in driver support has
been removed. Upgrading requires several steps:
1. set up OBMd.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe add a link to the OBMd repo?
Also, how are we going to run the Go server? Run the go webapp directly, or have apache in front of it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added a link. Go's net/http package is a production ready web server, so it doesn't need another server in front of it, but you could do so if e.g. you have other web stuff on the same machine and want to share a port.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I opened an issue CCI-MOC/obmd#15 to better document the OBMd deployment process.

C.node.register("dummy-node-04",
"http://obmd.example.com/node/dummy-node-02",
"secret",
# Non-existant subtype.
Copy link
Contributor

Choose a reason for hiding this comment

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

typo: non-existent*

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@xuhang57 xuhang57 left a comment

Choose a reason for hiding this comment

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

lgtm. Though I think we should let naved and Ian @Izhmash to give the +2 since they are more familiar with obmd.

Also, it seems that obmd will become a hard dependency in 0.4 release. Should we create a separate branch for 0.3 release?

Copy link
Contributor

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

Some first questions I thought of:

def node_register(node, obmtype, hostname, username, password):
def node_register(node,
obmd_uri,
obmd_admin_token,
Copy link
Contributor

Choose a reason for hiding this comment

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

Bit of a high-level question, how are you envisioning users will keep track of their obmd admin tokens? My first thought is that the admin token should be added to the CLI command automatically somehow since it's long and would require a lot of copy and pasting if you need to type a lot of commands in a hurry.

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for the obmd URI actually, I wonder if that could be inserted from a config file. Or perhaps we leave that to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The combination is probably comparable to the current one, no? between obmtype, hostname, username, and password, node_register already requires a fair amount of typing. Remember obmd_uri & admin_token are eventually going to replace those, so I think it will end up being about the same.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah right, I forgot that the other options are going away.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 12, 2018

@xuhang57, yeah, obmd will be a hard dependency as of 0.4. This is why we made a point of getting another release out (0.3) before then, with the necessary stuff to upgrade. 0.3 has already been tagged and released, so I'm not sure exactly what you're suggesting?

@xuhang57
Copy link
Contributor

@zenhack I was thinking of creating a new branch based on 0.3, but it seems unnecessary since we have tagged/released 0.3 version?

The only advantage that I could think of about having a 0.3 branch is that someone who does not nee obmd can use HIL by switching the branch. Not sure whether it makes sense or not.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 17, 2018 via email

Copy link
Contributor

@ianballou ianballou left a comment

Choose a reason for hiding this comment

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

I've been looking at this for a while and it looks fine to me!

@ianballou
Copy link
Contributor

ianballou commented Apr 17, 2018

Not a big deal enough for me to take the check away, but there might be some documentation that'll need to change, like at the bottom of testing.md for example.

@zenhack
Copy link
Contributor Author

zenhack commented Apr 17, 2018

I pushed another commit to fix most of the pycodestyle errors. Per the commit message I left a few of them out, which are in regexes for the drivers -- if not done carefully we could introduce breakage, so I think it's worth deferring to a separate pr.

In general we should be using raw strings for regexes, so we don't have to think about two levels of escape sequences.

@zenhack zenhack mentioned this pull request Apr 17, 2018
@naved001
Copy link
Contributor

naved001 commented Apr 18, 2018

I don't see the regexes in the failures? I think we are just concatenating strings which happen to contain a backslash. And I don't think we can change that. We should probably disable that check in those lines.

@jeremyfreudberg
Copy link
Member

Switching to so-called raw strings should fix it. The error message for W605 should be clearer, but it means to say that because "\(" is not an actual escape sequence, the backslash itself needs to be escaped (otherwise you are relying on an implementation detail that "invalid" escape sequences aren't interpolated, rather than cause an error)

Both in the database and in node_register. They are still not actually
used.

Most of the work in this patch is updating the tests, mostly boring
adding of obmd parameters everywhere. There are a few things worth
calling out:

* TestCorrectRegisterObm in tests/unit/apy/main.py now checks a
  different condition: it verifies the correctness of the obmd fields,
  rather than the obm driver fields.
* Release notes have been added for 0.4. Not everything described there
  is present in the code yet, but it reflects our final destination.
* an environment variable is used in the test suite to work around the
  need to manually migrate obm info; it is referenced in the migration
  script and set in .travis.yml
* The parameters must also now be specified in site-layout.json
* Bad indentation (pycodestyle)
* Missing import.
Folks need to have run this before upgrading to this version of the
code, since otherwise they'd get errors about NULL values.  Accordingly
the test was failing. We'll end up ripping out the script as well at
some point, but let's keep the PR as small as we can.
I'll probably end up fishing all of this out of the history when I
start doing some more things, but for right now there aren't any actual
tests, and trying to call these is making CI fail.
This fixes a few missing changes to the Node creation code.

Additionally, this factors out the test-specific logic into its own
migration script. We're having a problem where the changes we're making
to the obmd fields are not being seen by the script that marks those
fields as NOT NULL. This was done in an attempt to fix that, but it
didn't work. It still seems cleaner to me though, so I'm leaving it.
This seems to get the next migration script to see the changes.

We're now getting an error later in an INSERT, when trying to build from
a fresh database.
@naved001 naved001 merged commit 5c45989 into CCI-MOC:master Apr 19, 2018
@zenhack zenhack deleted the obmd-api-changes branch July 27, 2018 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants