3 # test that we can upload and download files
8 keystone_public = '127.0.0.1'
9 image_dir='/tmp/images'
11 ENV['OS_USERNAME']='admin'
12 ENV['OS_TENANT_NAME']='admin'
13 ENV['OS_PASSWORD']='ChangeMe'
14 ENV['OS_AUTH_URL']='http://127.0.0.1:5000/v2.0/'
15 ENV['OS_REGION_NAME']='RegionOne'
17 FileUtils.mkdir_p(image_dir)
18 Dir.chdir(image_dir) do |dir|
23 remote_image_url='http://smoser.brickies.net/ubuntu/ttylinux-uec/ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz; tar -zxvf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz'
25 wget_command = "wget #{remote_image_url}"
27 Open3.popen3(wget_command) do |stdin, stdout, stderr|
28 puts "wget stdout: #{stdout.read}"
29 puts "wget stderr: #{stderr.read}"
32 add_kernel='disk_format=aki container_format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz'
33 kernel_name='tty-linux-kernel'
36 add_kernel_command="glance add name='#{kernel_name}' disk_format='#{kernel_format}' container_format=#{kernel_format} < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz"
38 Open3.popen3(add_kernel_command) do |stdin, stdout, stderr|
39 stdout = stdout.read.split("\n")
41 if line =~ /Added new image with ID: (\w+)/
49 raise(Exception, 'Did not add kernel successfully') unless kernel_id
52 add_initrd_command="glance add name='tty-linux-ramdisk' disk_format=ari container_format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader"
54 Open3.popen3(add_initrd_command) do |stdin, stdout, stderr|
55 stdout = stdout.read.split("\n")
57 if line =~ /Added new image with ID: (\w+)/
65 raise(Exception, 'Did not add initrd successfully') unless initrd_id
67 add_image_command="glance add name='tty-linux' disk_format=ami container_format=ami kernel_id=#{kernel_id} ramdisk_id=#{initrd_id} < ttylinux-uec-amd64-12.1_2.6.35-22_1.img"
69 Open3.popen3(add_image_command) do |stdin, stdout, stderr|
70 stdout = stdout.read.split("\n")
72 if line =~ /Added new image with ID: (\w+)/
80 get_index='glance index'
82 Open3.popen3(get_index) do |stdin, stdout, stderr|