Image location error is incomprehensible #2094

Closed
niemeyer opened this Issue Jun 9, 2016 · 9 comments

Comments

Projects
None yet
3 participants
Contributor

niemeyer commented Jun 9, 2016

Tried this today:

$ lxc launch images:ubuntu/16.04
error: Only full and short (12 chars) hashes are supported by this server

This should really say "image not found" or similar.

Owner

stgraber commented Jun 9, 2016

It would if the image server you were talking to wasn't a static apache2 web server :)

Owner

stgraber commented Jun 9, 2016

images: isn't running LXD at all, it's a static web server with some clever rewrite rules.

The source of the error you're getting is because it doesn't know if you typed a partial hash (where we only support full length or 12 chars length in our fake server) or if you requested something which doesn't exist at all.

Contributor

niemeyer commented Jun 9, 2016

I'm sure there are excellent technical reasons why it doesn't work. My only point is that this is a terrible message which should be fixed taking in account that it's a user sitting at the terminal, rather than a developer. There's nothing in that location, and I should try another one.

Contributor

niemeyer commented Jun 9, 2016

Suggested message: error: image not found

Owner

stgraber commented Jun 9, 2016

That error message would be rather confusing to people doing:

lxc launch images:850b

Which is an existing image and would be absolutely valid on any real LXD server.

Contributor

niemeyer commented Jun 9, 2016

I don't understand the point. If it is an existing image, then the image exists and you should not display this error.

Owner

stgraber commented Jun 9, 2016

The server is a static web server, it doesn't know how to match partial hashes.

Anyway, I changed the error to:

error: not found (not a fingerprint, partial fingerprint (first 12 chars) or valid alias)

That will have to do.

@stgraber stgraber closed this Jun 9, 2016

Contributor

niemeyer commented Jun 9, 2016

Thanks, that's way more clear. Might be worth mentioning what was not found.

Note that the fact a static web server is backing it is somewhat irrelevant. The lxc tool can do whatever it wants to present reasonable information to the user.

For anybody (like me) who arrived here through Google and is trying to create lxd containers with Ansible, it's because their current documentation is wrong.

I wanted to use images:debian/stretch. Their main example for images: is:

# An example for creating a Ubuntu container and install python
- hosts: localhost
  connection: local
  tasks:
    - name: Create a started container
      lxd_container:
        name: mycontainer
        state: started
        source:
          type: image
          mode: pull
          server: https://images.linuxcontainers.org
          protocol: lxd
          alias: ubuntu/xenial/amd64
        profiles: ["default"]
        wait_for_ipv4_addresses: true
        timeout: 600

So I tried changing alias to "debian/stretch" and "images:debian/stretch" but got the cryptic error above.

As stgraber mentioned this is because images: is not running lxd, so the protocol setting needs to be "simplestreams", and the correct alias would be "debian/stretch".

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