~ubuntu-branches/ubuntu/natty/cloud-utils/natty

« back to all changes in this revision

Viewing changes to uec-publish-image

  • Committer: Bazaar Package Importer
  • Author(s): Scott Moser
  • Date: 2011-02-19 01:17:35 UTC
  • Revision ID: james.westby@ubuntu.com-20110219011735-df5fpo00ga9hqzna
Tags: 0.20ubuntu1
* uec-publish-image: use --name in euca-register
* uec-publish-image: fix for debug so '-v' will give some info
  (previously needed -vv)
* ec2metadata: fix for ancestor-ami-ids retrieval (LP: #706651)
* uec-run-instances: add '--attach-volume'

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
      -v|--verbose                : increase verbosity
53
53
         --name   <name>          : register with '--name'.
54
54
                                    default: basename(publish_path)
55
 
                                    (only with ec2-api-tools)
56
55
 
57
56
   if type is 'image', then:
58
57
      -k | --kernel  k        : use previously registered kernel with id 'k'
77
76
debug() {
78
77
        local level=${1}
79
78
        shift;
80
 
        [ "${level}" -gt "${VERBOSITY}" ] && return
 
79
        [ "${level}" -ge "${VERBOSITY}" ] && return
81
80
        error "$(date):" "${@}"
82
81
}
83
82
run() {
320
319
[ -n "${ramdisk}" -a "${ramdisk}" != "none" ] &&
321
320
        krd_args=( "${krd_args[@]}" "--ramdisk" "${ramdisk}" )
322
321
 
 
322
if [ -z "${name}" ]; then
 
323
        name=${rename}
 
324
        debug 1 "using ${name} for --name"
 
325
fi
 
326
 
323
327
if [ "${EC2PRE%ec2-}" != "${EC2PRE}" ]; then
324
328
        req="EC2_CERT EC2_PRIVATE_KEY EC2_USER_ID EC2_ACCESS_KEY EC2_SECRET_KEY"
325
329
        for env_name in ${req}; do
332
336
        ex_upload_args=( --access-key "${EC2_ACCESS_KEY}" 
333
337
                         --secret-key "${EC2_SECRET_KEY}" )
334
338
 
335
 
        if [ -z "${name}" ]; then
336
 
                name=${rename}
337
 
                debug 1 "using ${name} for --name"
338
 
        fi
339
 
        ex_register_args=( --name "${name}" )
340
339
fi
341
340
 
342
341
debug 1 "checking for existing registered image at ${bucket}/${manifest}"
372
371
 
373
372
        junk="" img_id="";
374
373
        run "${wdir}" "register" "register ${bucket}/${manifest}" \
375
 
                ${EC2PRE}register "${ex_register_args[@]}" "${bucket}/${manifest}" &&
 
374
                ${EC2PRE}register --name "${name}" \
 
375
                        "${ex_register_args[@]}" "${bucket}/${manifest}" &&
376
376
                read junk img_id < "${wdir}/register.stdout" &&
377
377
                [ "${img_id#???-}" != "${img_id}" ] || {
378
378
                        if bad=$(get_manifest_id "${bucket}/${manifest}") &&