Subject: [alpine-aports] [PATCH] testing/cloud-init: fix user creation

From: Matt Dainty <[email-masked]>
Date: Fri, 1 Apr 2016 16:40:22 +0100

User creation wasn't unlocking the user so SSH access didn't work, the
default user should not be locked either. Also add e2fsprogs-extra as a
dependency so that the resize filesystem functionality works out of the
box.
---
 testing/cloud-init/20-alpine.patch | 18 +++++++++++-------
 testing/cloud-init/APKBUILD        | 16 ++++++++--------
 testing/cloud-init/cloud.cfg       |  1 +
 3 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/testing/cloud-init/20-alpine.patch b/testing/cloud-init/20-alpine.patch
index e2db6a3..b2cf52d 100644
--- a/testing/cloud-init/20-alpine.patch
+++ b/testing/cloud-init/20-alpine.patch
@@ -202,18 +202,22 @@
 +            util.logexc(LOG, "Failed to create user %s", name)
 +            raise e
 +
++        # Unlock the user
++        LOG.debug("Unlocking user %s", name)
++        try:
++            util.subp(['passwd', '-u', name], logstring=['passwd', '-u', name])
++        except Exception as e:
++            util.logexc(LOG, "Failed to unlock user %s", name)
++            raise e
++
 +        if 'groups' in kwargs:
 +            groups = kwargs['groups']
-+            if isinstance(groups, six.string_types):
++            if groups and isinstance(groups, str):
 +                # Why are these even a single string in the first place?
-+                groups = [groups.split(',')]
-+            for group in kwargs['groups']:
++                groups = groups.split(',')
++            for group in groups:
 +                try:
 +                    util.subp(['adduser', name, group], logstring=['adduser', name, group])
 +                except Exception as e:
 +                    util.logexc(LOG, "Failed to add user %s to group %s", name, group)
 +                    raise e
-+
-+    def lock_passwd(self, name):
-+        # Already locked
-+        pass
diff --git a/testing/cloud-init/APKBUILD b/testing/cloud-init/APKBUILD
index 0316abd..89a2b96 100644
--- a/testing/cloud-init/APKBUILD
+++ b/testing/cloud-init/APKBUILD
@@ -2,12 +2,12 @@
 # Maintainer:
 pkgname=cloud-init
 pkgver=0.7.6
-pkgrel=0
+pkgrel=1
 pkgdesc="Cloud instance init scripts"
 url="http://launchpad.net/cloud-init"
 arch="noarch"
 license="GPL"
-depends="python py-cheetah py-configobj py-jinja2 py-jsonpatch py-oauth2 py-prettytable py-requests py-serial py-yaml"
+depends="e2fsprogs-extra python py-cheetah py-configobj py-jinja2 py-jsonpatch py-oauth2 py-prettytable py-requests py-serial py-yaml"
 makedepends="py-setuptools"
 install="$pkgname.pre-install $pkgname.post-install"
 subpackages="$pkgname-doc"
@@ -57,28 +57,28 @@ package() {
 
 md5sums="cd392e943dd0165e90a6d56afd0e4ad3  cloud-init-0.7.6.tar.gz
 90a78c24b1a2ed537d5e7c28c48780d5  10-setup.patch
-00c660d93a85bbe9c891e01141467619  20-alpine.patch
+c27579cf93955bbaa3bc55a367f67fe5  20-alpine.patch
 80892c13e65a5040f32b4d86e848b6bb  cloud-init-local.initd
 0041569a737713ea01a154d98007c2e5  cloud-init.initd
 3ff3ae1e27950abf3064da60c23669ba  cloud-config.initd
 0824fad27c2bf1b966e8820f51d2fde0  cloud-final.initd
-7956e83fe1c2fb306990efe02a0bc201  cloud.cfg
+ea4ccef56c030b694ad799fb03e3e462  cloud.cfg
 3e700738d75419687128a93cbdc35857  hosts.alpine.tmpl"
 sha256sums="9e8fd22eb7f6e40ae6a5f66173ddc3cc18f65ee406c460a728092b37db2f3ed7  cloud-init-0.7.6.tar.gz
 a26154be7b331859660c620ad56f59910b1a832fff3a1d0597a1d8204e1b7846  10-setup.patch
-1c516faedb0a6fa3ef075ac4a0ca9858062ef8ec8f4c8d5edd3257e5b872b86b  20-alpine.patch
+286b15090e5640f7d5e453e826601968b4b5974a115f053a79f43a4e63f11b63  20-alpine.patch
 0fc8f79a4675e57b9475ac8fbe92898b17284f6ad903ec1ea9a795783e70ed33  cloud-init-local.initd
 ce227ff37516fc08702996903762704dd255a16d391ed2853fe5d5b88d28231d  cloud-init.initd
 3581bf4d4a0b7011edef76c40237517c3fb350c477ffaead1abcdcf4bb8bbe24  cloud-config.initd
 1e5fe801a9981a721e4cb6ebc1f7fd9df2dec1683dae9ab6fd15f8e8338fb7d3  cloud-final.initd
-4a522aeca8aad6b986057110afa0519eb47e27f23342ef06b1485b6f0676dc2e  cloud.cfg
+4f688c5d3780f7b9883694323b0222b92b14d4edbe25d08aa2ca9da3b42e65c9  cloud.cfg
 43bcfcd5ff1117a9b54be22f5e50f04aa78fe6574271be7c01d472921d3f04c3  hosts.alpine.tmpl"
 sha512sums="aa2397328afda8e77ed6d642e7642f41a4b4b5bcd3d0e87056aa8c88b56624ec65c57cfc66b0d13ccc235f1840baf1d577316974902a0439cf2f2eb0f8eef36d  cloud-init-0.7.6.tar.gz
 502de73eb899d751f025d7d268d3a4eb086177a86da5d6e223b7243ecdb30b93bd3ecb974cfa1f900d2adc8ce2bbc8cd1be23a10115e709b1f2cc22b704d575d  10-setup.patch
-d42e9abb9dbfa3d61ce4b3aaad3633ae75a2bc097775a5c350b4ca0060da2ea99fe66fd602ed60a3e4c0d56eb9d6509bc1fc543babae749a96dad7175b4832d2  20-alpine.patch
+76824ac2dc72b09eabb4f600e5c6bd831711c313f611d8f7ab64b5d45f7e8255913376f90c9854410b1eea3f1894a868f3103113568790217fbb8a60acea17ea  20-alpine.patch
 f3131d9fb8b59fb44be1bb9293cfc1809c370efd4c4d215f5a3b337305bf4982d98d4905bcf077b32edfb4d0b605a4db5704779ac667c3546a9cbdd54a95e28e  cloud-init-local.initd
 dccdbbe2e8ff7cdf28da2f6ddbbcda3f3c29c99d8b89476d03cb2e46e158614f7a5deea2284d807938e9d12600f642747cd020bd88412d6f3906195d78aa9f5e  cloud-init.initd
 644b583eb96ec93bfe71fea27408f29ef432b7535d70dc3eb4b2a99b5131c30310971e4502d100047f0909ce00f58ef42fd9be907a99388dc9f7b98ba3f27ebf  cloud-config.initd
 22970d575b5576689b638badfc1248b4710edb33421470b42d0d838a99806b01cefd9346033dc22a062c9eb6c52625966d73722386da9ad632f65fdcd2f10d93  cloud-final.initd
-4ac8b60e9e6af7de8694d7c6658d1f1aec0f91334090796a2190714f5025207fccd2a84a6b4d780fa8928af8f2daf16f5bef5ffd9ba57f7b7e3c0e3b694453a0  cloud.cfg
+1b83382a0f1aa8044eed5b7390b81897c9f6a3601577396cc803f15b1840419eda3cef37b15d2dee226d9a27434b0a899466ed6860cccdfb244b60edd9bed281  cloud.cfg
 813a67d446ee65f5ef5a45fe60bef4d0e404c5d1f9cb732bc0ec0b706a0274f4bc1e7f87e676da1ca9366c2f933163f620ee296ed783372869438dd8a928117b  hosts.alpine.tmpl"
diff --git a/testing/cloud-init/cloud.cfg b/testing/cloud-init/cloud.cfg
index c300588..a526cdb 100644
--- a/testing/cloud-init/cloud.cfg
+++ b/testing/cloud-init/cloud.cfg
@@ -68,6 +68,7 @@ system_info:
      gecos: Alpine
      sudo: ["ALL=(ALL) NOPASSWD:ALL"]
      shell: /bin/bash
+     lock_passwd: false
    # Other config here will be given to the distro class and/or path classes
    paths:
       cloud_dir: /var/lib/cloud/
-- 
2.7.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---