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

pylxd fails to correctly identify existing profiles. #282

Closed
snesbittsea opened this issue Mar 2, 2018 · 3 comments
Closed

pylxd fails to correctly identify existing profiles. #282

snesbittsea opened this issue Mar 2, 2018 · 3 comments

Comments

@snesbittsea
Copy link

snesbittsea commented Mar 2, 2018

This is with Python 2.7 and pylxd 2.2.5 and lxc version 2.21

I'm running into a situation where pylxd successfully gets a list of all my profiles, but then fails to recognize some of them as existing.

The script below simply iterates through the listing of profiles and then asks if that profile exists:

from pylxd import Client
from pylxd.models import Profile

import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

client = Client(endpoint='blanked out',
                 cert=("/home/FUZZBUTT/snesbitt/snap/lxd/5758/.config/lxc/client.crt",
                       "/home/FUZZBUTT/snesbitt/snap/lxd/5758/.config/lxc/client.key"),
                verify=False)
client.authenticate('blanked out')

for profile in Profile.all(client):
    print("Profile Name: %s. Exists: %s" % (profile.name, Profile.exists(client, profile.name)))

The result of this script is:

/home/FUZZBUTT/snesbitt/projects/ansible/venv_2.7/bin/python2 /home/FUZZBUTT/snesbitt/.IntelliJIdea2018.1/config/scratches/scratch.py

/home/FUZZBUTT/snesbitt/projects/ansible/venv_2.7/bin/python2 /home/FUZZBUTT/snesbitt/.IntelliJIdea2018.1/config/scratches/scratch.py
Profile Name: default. Exists: True
Profile Name: devAnsibleServer. Exists: True
Profile Name: dev. Exists: True
Profile Name: maas. Exists: True
Profile Name: tmpl_consulserver. Exists: False
Profile Name: test-test. Exists: True
Profile Name: test_test. Exists: True
Profile Name: test_testtesttest. Exists: True
Profile Name: test-testtesttest. Exists: True
Profile Name: tmpl_consulserver1. Exists: True
Profile Name: tmpl-consulserver1. Exists: True

Note that pylxd marks tmpl_consulserver as not existing.

I'm also noting that the output is a bit flaky and the results can change after adding a new profile. The one constant is that tmpl_consulserver is always marked as not existing.

(edit:ajkavanagh just fixed up formatting)

@ajkavanagh
Copy link
Contributor

Well that's a bit strange. It might be a bug in the underlying LXD implementation; before I 'blame' them, is there anything different, say, between the profiles of tmpl_consulserver and the other variants (with - and _.*1) for example? i.e. please could you past the contents of those profiles.

The "reason" exists comes back as False is if a NotFound exception is raised via the API handling, which would imply a 404 from the LXD daemon. Which as you say, is a bit strange and flaky.

Thanks.

@snesbittsea
Copy link
Author

Sorry about the late reply and poor original formatting.

Naturally my test fixture for this was deleted as part of ongoing work, and I can't recreate

Let's close for now.

@ajkavanagh
Copy link
Contributor

Okay, thanks for letting me know. I'll close it for now, but please feel free to re-open it if you come across it again. The module's tests with sockets isn't very complete at the moment; it's something that I'm working on, as there seem to be a few bugs/issues arising with TCP/IP & web-sockets, whereas most of my testing is with the local unix sockets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants