cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #02710
Re: [Merge] ~smoser/cloud-init:bug/fix-ci-redhat into cloud-init:master
Diff comments:
> diff --git a/tools/run-centos b/tools/run-centos
> index de21d75..f812e93 100755
> --- a/tools/run-centos
> +++ b/tools/run-centos
> @@ -63,26 +78,53 @@ inside() {
> }
>
> inject_cloud_init(){
> - local name="$1"
> - tarball_name='cloud-init.tar.gz'
> - top_d=$(git rev-parse --show-toplevel) ||
> - fail "failed to get top level"
> - cd "$top_d" ||
> - fail "failed to cd to git top dir"
> - tar_folder=${PWD##*/}
> - cd ..
> - tar -czf "$TEMP_D/$tarball_name" "$tar_folder" ||
> - fail "failed: creating tarball_name"
> - cd "$tar_folder" ||
> - fail "failed: changing directory"
> -
> - user='centos'
> - tarball="/home/$user/$tarball_name"
> - inside "$name" useradd "$user"
> - lxc file push "$TEMP_D/$tarball_name" "$name/home/$user"/
> - inside "$name" chown "$user:$user" "$tarball"
> - inside_as "$name" "$user" tar -C "/home/$user" -xzf "$tarball" ||
> - fail "failed: extracting tarball"
> + # take current cloud-init git dir and put it inside $name at
> + # ~$user/cloud-init.
> + local name="$1" user="$2" top_d="" dname="" pstat=""
> + top_d=$(git rev-parse --show-toplevel) || {
> + errorrc "Failed to get git top level in $PWD";
> + return
> + }
> + dname=$(basename "${top_d}") || return
> + debug 1 "collecting ${top_d} ($dname) into user $user in $name."
> + tar -C "${top_d}/.." -cpf - "$dname" |
> + inside_as "$name" "$user" sh -ec '
> + dname=$1
> + rm -Rf "$dname"
> + tar -xpf -
> + [ "$dname" = "cloud-init" ] || mv "$dname" cloud-init' \
> + extract "$dname"
> + [ "${PIPESTATUS[*]}" = "0 0" ] || {
> + error "Failed to push tarball of '$top_d' into $name" \
> + " for user $user (dname=$dname)"
> + return 1
> + }
> + return 0
> +}
> +
> +prep() {
> + # we need some very basic things not present in the container.
> + # - git
> + # - tar (CentOS 6 lxc container does not have it)
> + # - python-argparse (or python3)
> + local needed=""
> + needed=""
> + for pair in tar:tar git:git; do
I guess you are future-proofing here with the pairs declaration? Since tar and git's pkg and cmd are the same do we need to define <pkg>:<cmd> in the loop?
> + pkg=${pair#*:}
> + cmd=${pair%%:*}
> + command -v $cmd >/dev/null 2>&1 || needed="${needed} $pkg"
> + done
> + if ! command -v python3; then
> + python -c "import argparse" >/dev/null 2>&1 ||
> + needed="${needed} python-argparse"
> + fi
> + needed=${needed# }
> + if [ -z "$needed" ]; then
> + error "No prep packages needed"
> + return 0
> + fi
> + error "Installing prep packages: ${needed}"
> + yum install --assumeyes ${needed}
> }
>
> start_container() {
--
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/325679
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:bug/fix-ci-redhat into cloud-init:master.
References