[lxc-devel] [PATCH] ubuntu-cloud-prep: cleanup, fix bug with userdata

Serge Hallyn serge.hallyn at ubuntu.com
Mon Aug 12 12:55:37 UTC 2013


Quoting Scott Moser (smoser at ubuntu.com):
> --userdata was broken, completely missing an implementation.
> This adds that implementation back in, makes 'debug' logic
> correct, and then also improves the doc at the top.
> 
> Signed-off-by: Scott Moser <smoser at ubuntu.com>

Acked-by: Serge E. Hallyn <serge.hallyn at ubuntu.com>

thanks,
-serge

> 
> diff --git a/hooks/ubuntu-cloud-prep b/hooks/ubuntu-cloud-prep
> index 159fd02..7985a73 100755
> --- a/hooks/ubuntu-cloud-prep
> +++ b/hooks/ubuntu-cloud-prep
> @@ -1,21 +1,21 @@
>  #!/bin/bash
> -## If the container being cloned has one or more lxc.hook.clone specified,
> -## then the specified hooks will be called for the new  container.  The first
> -## 3 arguments passed to the clone hook will be:
> +## If the container being cloned has one or more lxc.hook.clone
> +## specified, then the specified hooks will be called for the new
> +## container.  The arguments passed to the clone hook are:
>  ##  1. the container name
>  ##  2. a section ('lxc')
>  ##  3. hook type ('clone')
>  ##  4. .. additional arguments to lxc-clone
>  ## Environment variables:
> -##  LXC_ROOTFS_MOUNT: path under which the container's root fs is mounted.
> -##  LXC_CONFIG_FILE:  The configuration file pathname
> -##  LXC_SRC_NAME: old container name
> -##  LXC_ROOTFS_PATH: path or device on which the root fs is located
> +##  LXC_ROOTFS_MOUNT: path to the root filesystem
> +##  LXC_CONFIG_FILE:  path to config file
> +##  LXC_SRC_NAME:     old container name
> +##  LXC_ROOTFS_PATH:  path or device on which the root fs is located
> 
>  VERBOSITY="0"
> 
>  error() { echo "$@" 1>&2; }
> -debug() { [ "$1" -ge "$VERBOSITY" ] || return; shift; error "$@"; }
> +debug() { [ "$VERBOSITY" -ge "$1" ] || return; shift; error "$@"; }
>  fail() { [ $# -eq 0 ] || error "$@"; exit 1; }
> 
>  prep_usage() {
> @@ -122,7 +122,10 @@ prep() {
>              MIRROR="http://archive.ubuntu.com/ubuntu"
>          fi
> 
> -        {
> +        if [ -n "$userdata" ]; then
> +            cp "$userdata" "$seed_d/user-data"
> +        else
> +            {
>              local lc=$(locale | awk -F= '/LANG=/ {print $NF; }')
>              echo "#cloud-config"
>              echo "output: {all: '| tee -a /var/log/cloud-init-output.log'}"
> @@ -131,8 +134,8 @@ prep() {
>              [ -z "$LANG" ] || echo "locale: $LANG";
>              echo "password: ubuntu"
>              echo "chpasswd: { expire: false; }"
> -
> -        } > "$seed_d/user-data"
> +            } > "$seed_d/user-data"
> +        fi
>          [ $? -eq 0 ] || {
>              error "failed to write user-data write to '$seed_d/user-data'";
>              return 1;
> 
> ------------------------------------------------------------------------------
> Get 100% visibility into Java/.NET code with AppDynamics Lite!
> It's a free troubleshooting tool designed for production.
> Get down to code-level detail for bottlenecks, with <2% overhead. 
> Download for free and get started troubleshooting in minutes. 
> http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
> _______________________________________________
> Lxc-devel mailing list
> Lxc-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/lxc-devel




More information about the lxc-devel mailing list