some 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +4 -0
- data/VERSION +1 -1
- data/bin/some +14 -0
- data/lib/some.rb +31 -2
- metadata +6 -8
- data/TODO +0 -5
data/README.md
CHANGED
@@ -107,6 +107,10 @@ NIFTY Cloud 上で手軽にサーバーを立ち上げることができます
|
|
107
107
|
* サーバー作成の際に something という名前の SSH キーと FW を作成します
|
108
108
|
* SSH キーは ~/.some/keypair.pem に保存されます
|
109
109
|
|
110
|
+
## TODO
|
111
|
+
|
112
|
+
* image_id=17 (Ubuntu 10.04) で bootstrap できない (apt-get update; apt-get install -y curl する必要あり)
|
113
|
+
|
110
114
|
## ライセンス
|
111
115
|
|
112
116
|
[sumo](http://github.com/adamwiggins/sumo) と同じく MIT ライセンスで公開します。
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/bin/some
CHANGED
@@ -79,6 +79,13 @@ class CLI < Thor
|
|
79
79
|
puts "port #{port} scheduled for open"
|
80
80
|
end
|
81
81
|
|
82
|
+
desc "fwlist", "list firewall rules"
|
83
|
+
def fwlist
|
84
|
+
some.firewall_list.each do |fw|
|
85
|
+
printf "%5s %5s %3s %s\n", fw[:ip_protocol], fw[:from_port], fw[:in_out], (fw[:group] || fw[:cidr])
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
82
89
|
desc "reset", "delete all the resources created by some (instances, security group, key pair)"
|
83
90
|
def reset
|
84
91
|
some.list.each do |inst|
|
@@ -88,6 +95,13 @@ class CLI < Thor
|
|
88
95
|
task("Delete key pair") { some.delete_keypair }
|
89
96
|
end
|
90
97
|
|
98
|
+
desc "images", "list images"
|
99
|
+
def images
|
100
|
+
some.images.each do |img|
|
101
|
+
printf "%-5s %s %s\n", img[:image_id], img[:availability_zone], img[:name]
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
91
105
|
no_tasks do
|
92
106
|
def some
|
93
107
|
@some ||= Some.new
|
data/lib/some.rb
CHANGED
@@ -21,7 +21,8 @@ class Some
|
|
21
21
|
:security_group => 'something',
|
22
22
|
:availability_zone => config['availability_zone'],
|
23
23
|
:disable_api_termination => false,
|
24
|
-
:accounting_type => 2
|
24
|
+
:accounting_type => 2,
|
25
|
+
:agreement => true # for RHEL subscription
|
25
26
|
)
|
26
27
|
result.instancesSet.item[0].instanceId
|
27
28
|
end
|
@@ -30,6 +31,34 @@ class Some
|
|
30
31
|
@list ||= fetch_list
|
31
32
|
end
|
32
33
|
|
34
|
+
def firewall_list
|
35
|
+
security_group = find_security_group
|
36
|
+
return [] if security_group.nil? || security_group.ipPermissions.nil?
|
37
|
+
|
38
|
+
security_group.ipPermissions.item.map do |row|
|
39
|
+
{
|
40
|
+
:ip_protocol => row["ipProtocol"],
|
41
|
+
:from_port => row["fromPort"],
|
42
|
+
:in_out => row["inOut"],
|
43
|
+
:group => row["groupName"],
|
44
|
+
:cidr => (row["ipRanges"]["item"].first["cidrIp"] rescue nil)
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def images
|
50
|
+
result = api.describe_images
|
51
|
+
return [] unless result.imagesSet
|
52
|
+
|
53
|
+
result.imagesSet.item.map do |row|
|
54
|
+
{
|
55
|
+
:image_id => row["imageId"],
|
56
|
+
:name => row["name"],
|
57
|
+
:availability_zone => row["availabilityZone"]
|
58
|
+
}
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
33
62
|
def volumes
|
34
63
|
result = api.describe_volumes
|
35
64
|
return [] unless result.volumeSet
|
@@ -227,7 +256,7 @@ class Some
|
|
227
256
|
{
|
228
257
|
'user' => 'root',
|
229
258
|
'ami' => 26,
|
230
|
-
'availability_zone' => '
|
259
|
+
'availability_zone' => 'west-11',
|
231
260
|
'password' => 'password'
|
232
261
|
}
|
233
262
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: some
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-07 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nifty-cloud-sdk
|
16
|
-
requirement: &
|
16
|
+
requirement: &212713900 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - =
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.11.beta1
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *212713900
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &212713320 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *212713320
|
36
36
|
description: sumo clone for NIFTY Cloud
|
37
37
|
email: tidnlyam@gmail.com
|
38
38
|
executables:
|
@@ -40,11 +40,9 @@ executables:
|
|
40
40
|
extensions: []
|
41
41
|
extra_rdoc_files:
|
42
42
|
- README.md
|
43
|
-
- TODO
|
44
43
|
files:
|
45
44
|
- README.md
|
46
45
|
- Rakefile
|
47
|
-
- TODO
|
48
46
|
- VERSION
|
49
47
|
- bin/some
|
50
48
|
- lib/some.rb
|