Mailinglist Archive: opensuse-bugs (3349 mails)

< Previous Next >
[Bug 978721] New: cloud-init: "system_info:" cloud-init user-data is ignored by Leap image on OBS
  • From: bugzilla_noreply@xxxxxxxxxx
  • Date: Thu, 05 May 2016 18:08:21 +0000
  • Message-id: <bug-978721-21960@http.bugzilla.suse.com/>
http://bugzilla.suse.com/show_bug.cgi?id=978721


Bug ID: 978721
Summary: cloud-init: "system_info:" cloud-init user-data is
ignored by Leap image on OBS
Classification: openSUSE
Product: openSUSE Distribution
Version: Leap 42.1
Hardware: Other
OS: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: Other
Assignee: rjschwei@xxxxxxxx
Reporter: ncutler@xxxxxxxx
QA Contact: qa-bugs@xxxxxxx
CC: jdsn@xxxxxxxx
Found By: ---
Blocker: ---

Background: I have access to an OpenStack tenant at a public cloud provider. I
have uploaded my SSH public key via the dashboard - the name of the keypair is
"smithfarm".

If I create an image (using "openstack image create") from this file:

http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1511.qcow2

and if I then instantiate a VM (using "openstack server create") from that
image giving the option "--key-name smithfarm", I can ssh into the resulting
instance as the default user "centos" using my SSH key (without entering a Unix
password). This works because *something* (cloud-init?) injects the SSH
public key into the file /home/centos/.ssh/authorized_keys in the
VM. No special action is required on my part - it's automatic.

I can do the same thing with the OVH Ubuntu 14.04 image, except the default
user there is "admin".

And I can do the same thing with the openSUSE Leap 42.1 image at

http://download.opensuse.org/repositories/Cloud:/Images:/Leap_42.1/images/openSUSE-Leap-42.1-OpenStack.x86_64.qcow2

except there the default user is "root".

I expect this functionality is well known to you. The important fact here is
that, with this technique, the public part of the SSH keypair (which has
previously been uploaded to OVH) is injected into the file .ssh/authorized_keys
(on the VM) belonging to the default user, which is hardcoded in each image.
On CentOS the default user is "centos", on Ubuntu it's "admin", and on openSUSE
it's "root".

Now, there is an undocumented but useful feature of cloud-init which
allows one to *change* this default user *without rebuilding the image*. This
can be done by supplying the following user-data with the "openstack server
create" command:

#cloud-config
system_info:
default_user:
name: somefoo

When I place these four lines in a file called "default-user-bug" and append
"--user-data default-user-bug" to my "openstack server create" command, I can
login to the created instance as the user "somefoo" instead of the hard-coded
default user. In other words, instead of the SSH key being injected into
/home/{centos,admin}/.ssh/authorized_keys, the "somefoo" user is created and
the SSH key is injected into /home/somefoo/.ssh/authorized_keys

At least, this is what happens with the CentOS and Ubuntu images. *Not so* with
the openSUSE image. It simply does not work. Even when I supply the above
user-data, the SSH key is still injected into /root/.ssh/authorized_keys, and
not into /home/somefoo/.ssh/authorized_keys as expected. The "system_info:"
stanza of the user-data is ignored.

--
You are receiving this mail because:
You are on the CC list for the bug.
< Previous Next >
This Thread
  • No further messages