cyoi 0.9.1 → 0.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +13 -5
- data/ChangeLog.md +1 -0
- data/README.md +12 -9
- data/lib/cyoi/providers/clients/openstack_provider_client.rb +1 -1
- data/lib/cyoi/version.rb +1 -1
- data/spec/unit/providers/clients/openstack_provider_client_spec.rb +10 -10
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NTQ0ZGE5ZDMzMzU5MGZiZDcxMTBjZDNiMTk2ZmRhZWFkZmM5ZjUwOA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MTdhYWE3Njg5YzE4YTE5MWE0MzVkNTdlZGEyYzQ5MjFkYWI2M2I5Zg==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGY1ZmIxY2E2ZDIzZWE5YThhZWU5NmMzZGZlMTIwYTBmMGQ4ODUxNzlmZjEy
|
10
|
+
ZjQ1NjYyNGRmMmMxMDFhMWQxYjQxN2MxMTBmNmQ3MzY5ZmYxYzQxZjkwODhj
|
11
|
+
MTlmZjU2NDFhYWY5NDkzMDQzYWIyNWUxMGIwZjQwMmQyMDNiNDA=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDcxMzIyZGQ4NzZjZDliNDVmNzgxMGNmOWFlNjI0ZDVhYTY1YWM4YzM0MTBh
|
14
|
+
OGViMDkxYzE4YmI4MTIyYmNkOWE4NzZhMmVmNWZjMDdiOWZiNjU4OTVlOGNh
|
15
|
+
ODA3M2E5YTBkNDIzMDNkN2NjYzM5OWI5YjQ2NzdlMWZiOTFjNTA=
|
data/ChangeLog.md
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
|
1
|
+
Choose Your Own Infrastructure
|
2
|
+
==============================
|
2
3
|
|
3
4
|
A library to ask an end-user to choose an infrastructure (AWS, OpenStack, etc), region, and login credentials.
|
4
5
|
|
5
|
-
This library was extracted from [inception-server](https://github.com/
|
6
|
+
This library was extracted from [inception-server](https://github.com/cloudfoundry-community/inception-server) for reuse by [bosh-bootstrap](https://github.com/cloudfoundry-community/bosh-bootstrap). It might also be useful to your own CLI applications that need to ask a user to give you their infrastructure credentials/region so your application can control their infrastructure (say via [fog](http://fog.io)).
|
6
7
|
|
7
|
-
[](https://codeclimate.com/github/drnic/cyoi)
|
8
|
+
[](https://travis-ci.org/cloudfoundry-community/cyoi)[](https://codeclimate.com/github/cloudfoundry-community/cyoi)
|
9
9
|
|
10
10
|
When you use the library, your application will attempt to guess what infrastructure/credentials the user will use (via `~/.fog`) and then fall back to prompting for remaining information:
|
11
11
|
|
@@ -39,9 +39,10 @@ Secret key: SECRETGOESHERE
|
|
39
39
|
Confirming: Using aws/us-west-2
|
40
40
|
```
|
41
41
|
|
42
|
-
|
42
|
+
Usage
|
43
|
+
-----
|
43
44
|
|
44
|
-
```
|
45
|
+
```ruby
|
45
46
|
provider_cli = Cyoi::Cli::Provider.new([settings_dir])
|
46
47
|
provider_cli.execute!
|
47
48
|
settings = YAML.load_file(File.join(settings_dir, "settings.yml"))
|
@@ -51,7 +52,8 @@ settings["provider"]["region"] # us-east-1
|
|
51
52
|
settings["provider"]["credentials"] # aws or openstack URLs & credentials
|
52
53
|
```
|
53
54
|
|
54
|
-
|
55
|
+
Installation
|
56
|
+
------------
|
55
57
|
|
56
58
|
To use as a stand-alone CLI, install the rubygem:
|
57
59
|
|
@@ -65,11 +67,12 @@ To use it as a library within your own application, add this line to your applic
|
|
65
67
|
gem "cyoi"
|
66
68
|
```
|
67
69
|
|
68
|
-
|
70
|
+
Contributing
|
71
|
+
------------
|
69
72
|
|
70
73
|
1. Fork it
|
71
74
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
72
75
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
73
76
|
4. Push to the branch (`git push origin my-new-feature`)
|
74
77
|
5. Create new Pull Request
|
75
|
-
6. Send [@drnic](https://github.com/drnic) a big bag of Doritos
|
78
|
+
6. Send [@drnic](https://github.com/drnic) a big bag of Doritos
|
@@ -81,7 +81,7 @@ class Cyoi::Providers::Clients::OpenStackProviderClient < Cyoi::Providers::Clien
|
|
81
81
|
# Hook method for FogProviderClient#create_security_group
|
82
82
|
def authorize_port_range(sg, port_range, protocol, ip_range)
|
83
83
|
rules = ip_permissions(sg)
|
84
|
-
rules.create(from_port: port_range.min, to_port: port_range.max, ip_range: {"cidr" => ip_range}, ip_protocol: protocol)
|
84
|
+
rules.create(parent_group_id: sg.id, from_port: port_range.min, to_port: port_range.max, ip_range: {"cidr" => ip_range}, ip_protocol: protocol)
|
85
85
|
end
|
86
86
|
|
87
87
|
def find_server_device(server, device)
|
data/lib/cyoi/version.rb
CHANGED
@@ -114,7 +114,7 @@ describe "cyoi address openstack" do
|
|
114
114
|
|
115
115
|
describe "create_security_group" do
|
116
116
|
let(:security_groups) { instance_double("Fog::Compute::OpenStack::SecurityGroups") }
|
117
|
-
let(:security_group) { instance_double("Fog::Compute::OpenStack::SecurityGroup") }
|
117
|
+
let(:security_group) { instance_double("Fog::Compute::OpenStack::SecurityGroup", id: 1234) }
|
118
118
|
let(:security_group_rules) { instance_double("Fog::Compute::OpenStack::SecurityGroupRules") }
|
119
119
|
let(:security_group_rule) { instance_double("Fog::Compute::OpenStack::SecurityGroupRule",
|
120
120
|
from_port: 22, to_port: 22, ip_range: [{"cidrIp" => "0.0.0.0/0"}], ip_protocol: "tcp") }
|
@@ -130,7 +130,7 @@ describe "cyoi address openstack" do
|
|
130
130
|
expect(subject).to receive(:puts).with("Created security group foo")
|
131
131
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
132
132
|
expect(security_group_rules).to receive(:find)
|
133
|
-
expect(security_group_rules).to receive(:create).with(from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
133
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
134
134
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 22..22 from IP range 0.0.0.0/0")
|
135
135
|
|
136
136
|
subject.create_security_group("foo", "foo", 22)
|
@@ -142,7 +142,7 @@ describe "cyoi address openstack" do
|
|
142
142
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
143
143
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
144
144
|
expect(security_group_rules).to receive(:find)
|
145
|
-
expect(security_group_rules).to receive(:create).with(from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
145
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
146
146
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 22..22 from IP range 0.0.0.0/0")
|
147
147
|
|
148
148
|
subject.create_security_group("foo", "foo", 22)
|
@@ -155,7 +155,7 @@ describe "cyoi address openstack" do
|
|
155
155
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
156
156
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
157
157
|
expect(security_group_rules).to receive(:find)
|
158
|
-
expect(security_group_rules).to receive(:create).with(from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
158
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
159
159
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 22..22 from IP range 0.0.0.0/0")
|
160
160
|
|
161
161
|
subject.create_security_group("foo", "foo", ports: 22)
|
@@ -167,7 +167,7 @@ describe "cyoi address openstack" do
|
|
167
167
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
168
168
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
169
169
|
expect(security_group_rules).to receive(:find)
|
170
|
-
expect(security_group_rules).to receive(:create).with(from_port: 53, to_port: 53, ip_protocol: "udp", ip_range: {"cidr" => "0.0.0.0/0"})
|
170
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 53, to_port: 53, ip_protocol: "udp", ip_range: {"cidr" => "0.0.0.0/0"})
|
171
171
|
expect(subject).to receive(:puts).with(" -> opened foo ports UDP 53..53 from IP range 0.0.0.0/0")
|
172
172
|
|
173
173
|
subject.create_security_group("foo", "foo", ports: { protocol: "udp", ports: (53..53) })
|
@@ -191,7 +191,7 @@ describe "cyoi address openstack" do
|
|
191
191
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
192
192
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
193
193
|
expect(security_group_rules).to receive(:find)
|
194
|
-
expect(security_group_rules).to receive(:create).with(from_port: 60000, to_port: 60050, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
194
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 60000, to_port: 60050, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
195
195
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 60000..60050 from IP range 0.0.0.0/0")
|
196
196
|
|
197
197
|
subject.create_security_group("foo", "foo", ports: 60000..60050)
|
@@ -203,7 +203,7 @@ describe "cyoi address openstack" do
|
|
203
203
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
204
204
|
expect(security_group).to receive(:security_group_rules).twice.and_return(security_group_rules)
|
205
205
|
expect(security_group_rules).to receive(:find)
|
206
|
-
expect(security_group_rules).to receive(:create).with(from_port: 53, to_port: 53, ip_protocol: "udp", ip_range: {"cidr" => "0.0.0.0/0"})
|
206
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 53, to_port: 53, ip_protocol: "udp", ip_range: {"cidr" => "0.0.0.0/0"})
|
207
207
|
expect(subject).to receive(:puts).with(" -> opened foo ports UDP 53..53 from IP range 0.0.0.0/0")
|
208
208
|
|
209
209
|
subject.create_security_group("foo", "foo", { protocol: "udp", ports: (53..53) })
|
@@ -215,9 +215,9 @@ describe "cyoi address openstack" do
|
|
215
215
|
expect(subject).to receive(:puts).with("Reusing security group foo")
|
216
216
|
expect(security_group).to receive(:security_group_rules).at_least(1).times.and_return(security_group_rules)
|
217
217
|
expect(security_group_rules).to receive(:find).at_least(1).times
|
218
|
-
expect(security_group_rules).to receive(:create).with(from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
219
|
-
expect(security_group_rules).to receive(:create).with(from_port: 443, to_port: 443, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
220
|
-
expect(security_group_rules).to receive(:create).with(from_port: 4443, to_port: 4443, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
218
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 22, to_port: 22, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
219
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 443, to_port: 443, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
220
|
+
expect(security_group_rules).to receive(:create).with(parent_group_id: 1234, from_port: 4443, to_port: 4443, ip_protocol: "tcp", ip_range: {"cidr" => "0.0.0.0/0"})
|
221
221
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 22..22 from IP range 0.0.0.0/0")
|
222
222
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 443..443 from IP range 0.0.0.0/0")
|
223
223
|
expect(subject).to receive(:puts).with(" -> opened foo ports TCP 4443..4443 from IP range 0.0.0.0/0")
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cyoi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dr Nic Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fog
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - '>='
|
17
|
+
- - ! '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
@@ -56,28 +56,28 @@ dependencies:
|
|
56
56
|
name: bundler
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '>='
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '>='
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
@@ -98,28 +98,28 @@ dependencies:
|
|
98
98
|
name: rspec-fire
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- - '>='
|
101
|
+
- - ! '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- - '>='
|
108
|
+
- - ! '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: aruba
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - '>='
|
115
|
+
- - ! '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - '>='
|
122
|
+
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
125
|
description: A library to ask an end-user to choose an infrastructure (AWS, OpenStack,
|
@@ -204,12 +204,12 @@ require_paths:
|
|
204
204
|
- lib
|
205
205
|
required_ruby_version: !ruby/object:Gem::Requirement
|
206
206
|
requirements:
|
207
|
-
- - '>='
|
207
|
+
- - ! '>='
|
208
208
|
- !ruby/object:Gem::Version
|
209
209
|
version: '0'
|
210
210
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
211
211
|
requirements:
|
212
|
-
- - '>='
|
212
|
+
- - ! '>='
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|