Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upValidate Homu TOML file #420
Conversation
|
@aneeshusa I think I see what I've done wrong. I should be checking the generated TOML file at |
|
Correct! |
29d0563
to
7a77865
| config_path = os.path.join('/home', 'servo', 'homu', 'cfg.toml') | ||
| with open(config_path) as conf: | ||
| try: | ||
| toml.loads(conf.read()) |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 3, 2016
Member
We can use toml.load instead which will handle opening and closing the file for us.
| with open(config_path) as conf: | ||
| try: | ||
| toml.loads(conf.read()) | ||
| return Success('Homu config file is valid TOML') |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 3, 2016
Member
Pull this out of the try block and have it as the last statement in run().
| return Success('Homu config file is valid TOML') | ||
| except Exception as e: | ||
| return Failure('Homu config file is not valid TOML: ', | ||
| '{}'.format(e)) |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| toml.loads(conf.read()) | ||
| return Success('Homu config file is valid TOML') | ||
| except Exception as e: | ||
| return Failure('Homu config file is not valid TOML: ', |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 3, 2016
Member
No need for the space after the colon. (The output will start from the next line).
|
|
||
|
|
||
| def run(): | ||
| config_path = os.path.join('/home', 'servo', 'homu', 'cfg.toml') |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 3, 2016
Member
It looks strange to see os.path.join when we have an explicit / in the arguments. Because I don't forsee us ever running Homu on a non-Unix platform, and because this is also hardcoded in the homu/init.sls file, let's just hardcode the whole path and inline it where it gets used.
| @@ -1,3 +1,4 @@ | |||
| # Python modules needed for testing | |||
| # (Travis-CI will auto-install them from this file) | |||
| flake8 == 2.5.4 | |||
| toml == 0.9.1 | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 3, 2016
Member
Please also pin this in homu/init.sls, and put a comment in both places that mentions the need to keep them in sync. See the style guide for tips.
|
I think that's all your comments cleared up. Thank you for the feedback by the way, it was very easy to follow! The additions to |
| toml: | ||
| pip.installed: | ||
| - pkgs: | ||
| - toml == 0.9.1 # Ensure this is up to date with requirements.txt |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 5, 2016
Member
Instead of a separate Salt state (block), add this to the pip.installed state above that installed Homu. Also, let's say 'in sync' instead of 'up to date'.
This comment has been minimized.
This comment has been minimized.
| @@ -1,3 +1,4 @@ | |||
| # Python modules needed for testing | |||
| # (Travis-CI will auto-install them from this file) | |||
| flake8 == 2.5.4 | |||
| toml == 0.9.1 # Please ensure this is also in homu/init.sls | |||
This comment has been minimized.
This comment has been minimized.
| @@ -52,6 +52,6 @@ else | |||
| # Only run tests against the new configuration | |||
| # TODO: don't hard-code this | |||
| if [ "${SALT_NODE_ID}" = "servo-master1" ]; then | |||
| ./test.py sls.buildbot.master sls.nginx | |||
| ./test.py sls.buildbot.master sls.nginx sls.homu | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jul 6, 2016
Member
Let's keep these in alphabetical order, so insert sls.homu in between sls.buildbot.master and sls.nginx.
|
LGTM aside from that last comment, so go ahead and squash when you address that. |
|
All good now I think! |
|
Checked this locally in Vagrant and everything looks good. @bors-servo r+ |
|
|
Validate Homu TOML file Draft of resolution to #407. `config_path` in sls/homu/toml.py is definitely wrong and should be corrected <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/420) <!-- Reviewable:end -->
|
|
Crimack commentedJul 1, 2016
•
edited by larsbergstrom
Draft of resolution to #407.
config_pathin sls/homu/toml.py is definitely wrong and should be correctedThis change is