~raharper/cloud-utils/trunk.fix-lp1604011

« back to all changes in this revision

Viewing changes to bin/ubuntu-ec2-run

  • Committer: Scott Moser
  • Date: 2016-05-11 13:31:22 UTC
  • Revision ID: smoser@ubuntu.com-20160511133122-jbc2t3raau4w83ow
bin/: pep8 and whitespace changes

python tools are now pep8 clean per 1.7.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#    You should have received a copy of the GNU General Public License
20
20
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21
21
 
 
22
import os
 
23
import string
 
24
import subprocess
 
25
import sys
 
26
 
22
27
KNOWN_RELEASES = ["lucid", "maverick", "natty", "oneiric", "precise",
23
 
                  "quantal", "raring", "trusty", "utopic", "vivid"]
 
28
                  "quantal", "raring", "trusty", "utopic", "vivid",
 
29
                  "wily", "xenial", "yakkety"]
24
30
 
25
31
USAGE = """
26
32
Usage: ubuntu-ec2-run [ options ] arguments
61
67
     ec2-run-instances --region us-west-1 --instance-type m1.small ami-39bfe27c
62
68
""" % {'rels': ' '.join(KNOWN_RELEASES)}
63
69
 
64
 
import os
65
 
import string
66
 
import subprocess
67
 
import sys
68
 
 
69
70
# This could/should use `distro-info --supported`
70
71
aliases = [
71
72
  "amd64", "x86_64", "i386",
81
82
# cleaned from http://aws.amazon.com/ec2/instance-types/
82
83
# (vcpu, compute-units, mem, disknum, disksize, diskback)
83
84
SIZE_DATA = {
84
 
    'm3.medium': (1,3,3.75,1,4,SSD),
85
 
    'm3.large': (2,6.5,7.5,1,32,SSD),
86
 
    'm3.xlarge': (4,13,15,2,40,SSD),
87
 
    'm3.2xlarge': (8,26,30,2,80,SSD),
88
 
    'm1.small': (1,1,1.7,1,160,SPIN),
89
 
    'm1.medium': (1,2,3.75,1,410,SPIN),
90
 
    'm1.large': (2,4,7.5,2,420,SPIN),
91
 
    'm1.xlarge': (4,8,15,4,420,SPIN),
92
 
    'c3.large': (2,7,3.75,2,16,SSD),
93
 
    'c3.xlarge': (4,14,7.5,2,40,SSD),
94
 
    'c3.2xlarge': (8,28,15,2,80,SSD),
95
 
    'c3.4xlarge': (16,55,30,2,160,SSD),
96
 
    'c3.8xlarge': (32,108,60,2,320,SSD),
97
 
    'c1.medium': (2,5,1.7,1,350,SPIN),
98
 
    'c1.xlarge': (8,20,7,4,420,SPIN),
99
 
    'cc2.8xlarge': (32,88,60.5,4,840,SPIN),
100
 
    'g2.2xlarge': (8,26,15,1,60,SSD),
101
 
    'cg1.4xlarge': (16,33.5,22.5,2,840,SPIN),
102
 
    'm2.xlarge': (2,6.5,17.1,1,420,SPIN),
103
 
    'm2.2xlarge': (4,13,34.2,1,850,SPIN),
104
 
    'm2.4xlarge': (8,26,68.4,2,840,SPIN),
105
 
    'cr1.8xlarge': (32,88,244,2,120,SSD),
106
 
    'i2.xlarge': (4,14,30.5,1,800,SSD),
107
 
    'i2.2xlarge': (8,27,61,2,800,SSD),
108
 
    'i2.4xlarge': (16,53,122,4,800,SSD),
109
 
    'i2.8xlarge': (32,104,244,8,800,SSD),
110
 
    'hs1.8xlarge': (16,35,117,2,2048,SPIN),
111
 
    'hi1.4xlarge': (16,35,60.5,2,1024,SSD),
112
 
    't1.micro': (1,.1,0.615,0,0,None),
 
85
    'm3.medium': (1, 3, 3.75, 1, 4, SSD),
 
86
    'm3.large': (2, 6.5, 7.5, 1, 32, SSD),
 
87
    'm3.xlarge': (4, 13, 15, 2, 40, SSD),
 
88
    'm3.2xlarge': (8, 26, 30, 2, 80, SSD),
 
89
    'm1.small': (1, 1, 1.7, 1, 160, SPIN),
 
90
    'm1.medium': (1, 2, 3.75, 1, 410, SPIN),
 
91
    'm1.large': (2, 4, 7.5, 2, 420, SPIN),
 
92
    'm1.xlarge': (4, 8, 15, 4, 420, SPIN),
 
93
    'c3.large': (2, 7, 3.75, 2, 16, SSD),
 
94
    'c3.xlarge': (4, 14, 7.5, 2, 40, SSD),
 
95
    'c3.2xlarge': (8, 28, 15, 2, 80, SSD),
 
96
    'c3.4xlarge': (16, 55, 30, 2, 160, SSD),
 
97
    'c3.8xlarge': (32, 108, 60, 2, 320, SSD),
 
98
    'c1.medium': (2, 5, 1.7, 1, 350, SPIN),
 
99
    'c1.xlarge': (8, 20, 7, 4, 420, SPIN),
 
100
    'cc2.8xlarge': (32, 88, 60.5, 4, 840, SPIN),
 
101
    'g2.2xlarge': (8, 26, 15, 1, 60, SSD),
 
102
    'cg1.4xlarge': (16, 33.5, 22.5, 2, 840, SPIN),
 
103
    'm2.xlarge': (2, 6.5, 17.1, 1, 420, SPIN),
 
104
    'm2.2xlarge': (4, 13, 34.2, 1, 850, SPIN),
 
105
    'm2.4xlarge': (8, 26, 68.4, 2, 840, SPIN),
 
106
    'cr1.8xlarge': (32, 88, 244, 2, 120, SSD),
 
107
    'i2.xlarge': (4, 14, 30.5, 1, 800, SSD),
 
108
    'i2.2xlarge': (8, 27, 61, 2, 800, SSD),
 
109
    'i2.4xlarge': (16, 53, 122, 4, 800, SSD),
 
110
    'i2.8xlarge': (32, 104, 244, 8, 800, SSD),
 
111
    'hs1.8xlarge': (16, 35, 117, 2, 2048, SPIN),
 
112
    'hi1.4xlarge': (16, 35, 60.5, 2, 1024, SSD),
 
113
    't1.micro': (1, .1, 0.615, 0, 0, None),
113
114
}
114
115
 
 
116
 
115
117
def get_argopt(args, optnames):
116
118
    ret = None
117
119
    i = 0
169
171
    ri_cmd = [pre.strip(), "run-instances"]
170
172
 
171
173
query_cmd = ["ubuntu-cloudimg-query",
172
 
    "--format=%{ami}\n%{itype}\n%{summary}\n%{store}\n"]
 
174
             "--format=%{ami}\n%{itype}\n%{summary}\n%{store}\n"]
173
175
 
174
176
 
175
177
# Get the list of releases.  If they have 'ubuntu-distro-info', then use that