Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Make ansible use the "lxd" transport instead of ssh #94

Merged
1 commit merged into from
Jul 16, 2017
Merged

Conversation

ghost
Copy link

@ghost ghost commented Jul 10, 2017

The "lxd" transport in ansible allows us to provision our containers
without SSH, directly through "lxc exec" calls!

I had the idea for quite a while that I should explore the possibility
of plugging "lxc exec" into ansible, but I didn't know that the plug was
already there, ready to be used! Had I known that, I would have used it
from the start, it would have saved me SSH fiddling...

Also, you know that small "HOME=" line in tox.ini? I've spent hours
debugging this. My tests would fail only when running into tox, not
when running directly through pytest. That was very puzzling. Live and
learn...

@ghost ghost requested a review from ellmetha July 10, 2017 20:07
@ghost
Copy link
Author

ghost commented Jul 10, 2017

Travis fails for reasons that seem similar to the problems I had with tox. This will require some debugging. I'll forget the idea of slipping this PR into v0.3.

@ghost ghost force-pushed the ansible-lxc-exec branch from 984b547 to 8ae6497 Compare July 10, 2017 21:14
@codecov-io
Copy link

codecov-io commented Jul 10, 2017

Codecov Report

Merging #94 into master will increase coverage by 0.33%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #94      +/-   ##
==========================================
+ Coverage    93.1%   93.43%   +0.33%     
==========================================
  Files          45       45              
  Lines        1261     1264       +3     
==========================================
+ Hits         1174     1181       +7     
+ Misses         87       83       -4
Impacted Files Coverage Δ
lxdock/test/fakes.py 100% <100%> (ø) ⬆️
lxdock/provisioners/ansible.py 93.93% <88.46%> (+6.43%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b72e2f...c5f1a52. Read the comment docs.

@ghost
Copy link
Author

ghost commented Jul 14, 2017

Oh, I've noticed that ansible actions like synchonize don't work with a lxd transport. It's inconvenient. I'll have to make this feature optional rather than flat-out replace ssh.

@robvdl
Copy link
Member

robvdl commented Jul 14, 2017

Hi @hsoft, I noticed in a recent change the setup.py was changed to this:

packages=['lxdock']

instead of find_packages() as it was before...

Now as I recall having done this myself a number of years ago, using just ['lxdock'] won't include subpackages so this will likely break the installer, it also breaks if people build a debian package from this for example it won't include the subpackages lxdock,cli, lxdock.conf, lxdock.guest, etc. in the package which is probably not what you want.

@ghost
Copy link
Author

ghost commented Jul 15, 2017

@robvdl I can't seem to reproduce the issue: installing the master branch of lxdock in a fresh venv with pip install . installs all lxdock's subpackages.

@ghost ghost force-pushed the ansible-lxc-exec branch from 0e89909 to c4c595a Compare July 15, 2017 23:37
@ghost
Copy link
Author

ghost commented Jul 15, 2017

This last commit transforms makes the lxd transport optional rather than having it replace the ssh transport entirely.

@ellmetha you haven't commented yet. Are you available for reviews? Should I ask @lingxiaoyang instead?

@ghost
Copy link
Author

ghost commented Jul 16, 2017

Oh, well, I'm having troubles on travis with re-using the persistent container for SSH-related things. I think I'll have to revert to using fresh containers...

@ellmetha
Copy link
Contributor

Hmm the Travis build is still failing though. 🤔

@ghost
Copy link
Author

ghost commented Jul 16, 2017

@ellmetha yes, I know. It's puzzling me because it doesn't fail locally on tox. Working on it...

The "lxd" transport in ansible allows us to provision our containers
without SSH, directly through "lxc exec" calls!

I had the idea for quite a while that I should explore the possibility
of plugging "lxc exec" into ansible, but I didn't know that the plug was
already there, ready to be used! Had I known that, I would have used it
from the start, it would have saved me SSH fiddling...

I've also performed some "drive by" improvements of the affected tests
by parametrizing them. I've also converted the modified test in
`test_container` so it uses the global re-usable container rather than a
new one. It's less elegant, but faster. Our integration tests are soooo
slow...
@ghost
Copy link
Author

ghost commented Jul 16, 2017

Oh, I think I have it! It seems like it was simply a matter of copying the .ssh folder in TRAVIS_BUILD_DIR. I'll try with the "persistent_container" test back on.

@ghost ghost force-pushed the ansible-lxc-exec branch from d582ae1 to c5f1a52 Compare July 16, 2017 00:53
@ghost ghost merged commit 7742b71 into master Jul 16, 2017
@ellmetha ellmetha deleted the ansible-lxc-exec branch July 27, 2017 16:15
This pull request was closed.
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.

None yet

3 participants