vagrant-skytap 0.1.8 → 0.1.9

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.
@@ -0,0 +1,78 @@
1
+ require_relative 'base'
2
+ require "vagrant-skytap/api/publish_set"
3
+
4
+ describe VagrantPlugins::Skytap::API::PublishSet do
5
+ include_context "unit"
6
+
7
+ let(:vm1_attrs) { JSON.load(File.read(File.join(File.expand_path('..', __FILE__), 'skeletons', 'vm1.json'))) }
8
+ let(:vm2_attrs) { vm1_attrs.merge("id" => "6981851", "name" => "VM2") }
9
+ let(:empty_environment_attrs) { JSON.load(File.read(File.join(File.expand_path('..', __FILE__), 'skeletons', 'empty_environment.json')))}
10
+ let(:empty_publish_set_attrs) { JSON.load(File.read(File.join(File.expand_path('..', __FILE__), 'skeletons', 'empty_publish_set.json')))}
11
+
12
+ let(:env_attrs) do
13
+ empty_environment_attrs.dup.tap do |ret|
14
+ ret['vms'] = [vm1_attrs, vm2_attrs]
15
+ end
16
+ end
17
+
18
+ let(:iso_env) do
19
+ # We have to create a Vagrantfile so there is a root path
20
+ env = isolated_environment
21
+ env.vagrantfile("")
22
+ env.create_vagrant_env
23
+ end
24
+ let(:machine) { iso_env.machine(iso_env.machine_names[0], :dummy) }
25
+ let(:env) {{ machine: machine, api_client: api_client }}
26
+
27
+ let(:environment) do
28
+ VagrantPlugins::Skytap::API::Environment.new(env_attrs, env)
29
+ end
30
+
31
+ let(:attrs) do
32
+ empty_publish_set_attrs.dup.tap do |ret|
33
+ ret['vms'] = [
34
+ {"vm_ref" => "http://example.com/vms/#{vm1_attrs['id']}"}
35
+ ]
36
+ end
37
+ end
38
+ let(:instance) { described_class.new(attrs, environment, env) }
39
+
40
+ let(:api_client) do
41
+ # By default, all GET requests will return an environment with VM1, VM2, and 1 network
42
+ double('api_client',
43
+ get: double('resp', body: JSON.dump(attrs))
44
+ )
45
+ end
46
+
47
+ # Ensure tests are not affected by Skytap credential environment variables
48
+ before :each do
49
+ ENV.stub(:[] => nil)
50
+ end
51
+
52
+ describe "vms" do
53
+ subject do
54
+ instance
55
+ end
56
+
57
+ it "returns only the vms in the publish_set" do
58
+ expect(instance.vms.count).to eq(1)
59
+ expect(instance.vms.first.name).to eq("VM1")
60
+ end
61
+ end
62
+
63
+ describe "password_protected?" do
64
+ subject do
65
+ instance
66
+ end
67
+
68
+ it "returns false if not set" do
69
+ expect(subject.password_protected?).to eq(false)
70
+ end
71
+
72
+ it "returns true if set" do
73
+ w_pw = described_class.new(attrs.merge("password" => "*******"), environment, env)
74
+ expect(w_pw.password_protected?).to eq(true)
75
+ end
76
+ end
77
+ end
78
+
@@ -0,0 +1,19 @@
1
+ {
2
+ "id": "1501798",
3
+ "name": "Vagrant publish set",
4
+ "url": "http://example.com/configurations/5570024/publish_sets/1501798",
5
+ "publish_set_type": "single_url",
6
+ "runtime_limit": null,
7
+ "runtime_left_in_seconds": null,
8
+ "expiration_date": null,
9
+ "expiration_date_tz": null,
10
+ "start_time": null,
11
+ "end_time": null,
12
+ "time_zone": null,
13
+ "multiple_url": false,
14
+ "password": null,
15
+ "desktops_url": "http://example.com/vms/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/desktops",
16
+ "use_smart_client": true,
17
+ "vms": [],
18
+ "custom_content_enabled": false
19
+ }
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-skytap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Astete
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-02 00:00:00.000000000 Z
11
+ date: 2015-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_pure
@@ -114,6 +114,7 @@ executables: []
114
114
  extensions: []
115
115
  extra_rdoc_files: []
116
116
  files:
117
+ - autossh.log
117
118
  - boxes/empty.box
118
119
  - boxes/metadata.json
119
120
  - boxes/README.md
@@ -163,6 +164,7 @@ files:
163
164
  - lib/vagrant-skytap/api/interface.rb
164
165
  - lib/vagrant-skytap/api/network.rb
165
166
  - lib/vagrant-skytap/api/public_ip.rb
167
+ - lib/vagrant-skytap/api/publish_set.rb
166
168
  - lib/vagrant-skytap/api/published_service.rb
167
169
  - lib/vagrant-skytap/api/resource.rb
168
170
  - lib/vagrant-skytap/api/runstate_operations.rb
@@ -170,6 +172,12 @@ files:
170
172
  - lib/vagrant-skytap/api/vm.rb
171
173
  - lib/vagrant-skytap/api/vpn.rb
172
174
  - lib/vagrant-skytap/api/vpn_attachment.rb
175
+ - lib/vagrant-skytap/cap/public_address.rb
176
+ - lib/vagrant-skytap/command/helpers.rb
177
+ - lib/vagrant-skytap/command/publish_url/create.rb
178
+ - lib/vagrant-skytap/command/publish_url/delete.rb
179
+ - lib/vagrant-skytap/command/publish_url/root.rb
180
+ - lib/vagrant-skytap/command/publish_url/show.rb
173
181
  - lib/vagrant-skytap/command/up.rb
174
182
  - lib/vagrant-skytap/config.rb
175
183
  - lib/vagrant-skytap/core_ext/object/blank.rb
@@ -200,8 +208,10 @@ files:
200
208
  - spec/unit/base.rb
201
209
  - spec/unit/config_spec.rb
202
210
  - spec/unit/environment_spec.rb
211
+ - spec/unit/publish_set_spec.rb
203
212
  - spec/unit/setup_helper_spec.rb
204
213
  - spec/unit/skeletons/empty_environment.json
214
+ - spec/unit/skeletons/empty_publish_set.json
205
215
  - spec/unit/skeletons/network1.json
206
216
  - spec/unit/skeletons/vm1.json
207
217
  - spec/unit/skeletons/vpn1.json
@@ -220,7 +230,6 @@ files:
220
230
  - tasks/test.rake
221
231
  - vagrant-skytap.gemspec
222
232
  - vagrant-spec.config.rb
223
- - Vagrantfile.keep
224
233
  - .byebug_history
225
234
  - .gitignore
226
235
  - .hgignore
data/Vagrantfile.keep DELETED
@@ -1,91 +0,0 @@
1
- Vagrant.configure(2) do |config|
2
- config.vm.box = "skytap/empty"
3
- config.vm.synced_folder ".", "/vagrant", disabled: true
4
-
5
- config.vm.provider :skytap do |skytap, override|
6
- skytap.username = "etrue"
7
- skytap.api_token = "fcb2620b72efddbc8239e25db9d812f510c7e166"
8
- #skytap.base_url = "https://cloud.skytap.com/"
9
- skytap.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
10
- #skytap.username = "vagrant_provider_admin"
11
- #skytap.api_token = "7c5718531a32eb90e92c804ce1f73da98be22cdf"
12
- #skytap.base_url = "https://test.skytap.com/"
13
- #skytap.username = "jsmith"
14
- #skytap.api_token = "754be5220955f35840498340606b4dfa89f7eb61"
15
- #skytap.base_url = "https://cloud.skytap.dev/"
16
- end
17
-
18
- GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/6869434'
19
- # for test user
20
- #GENERIC_UBUNTU = 'https://cloud.skytap.com/vms/4840008'
21
- # local user
22
- #GENERIC_UBUNTU = 'https://cloud.skytap.dev/vms/374'
23
-
24
- UBUNTU1 = "https://cloud.skytap.com/vms/7285844"
25
- UBUNTU2 = "https://cloud.skytap.com/vms/7285846"
26
- UBUNTU_WITH_VAGRANT = "https://cloud.skytap.com/vms/7397734"
27
- FROM_US_EAST = "https://cloud.skytap.com/vms/6232386"
28
- FROM_EMEA = "https://cloud.skytap.com/vms/4153172"
29
- ENG11490 = "https://cloud.skytap.com/templates/696065"
30
- NO_DISK = "https://cloud.skytap.com/vms/7500356"
31
-
32
- # may be gone by the time you see this
33
- ENVIRONMENT_VM = "https://cloud.skytap.com/vms/7457184"
34
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_A = "https://cloud.skytap.com/vms/7457184"
35
- UBUNTU_STOPPED_ENVIRONMENT_SOURCE_VM_B = "https://cloud.skytap.com/vms/7468766"
36
-
37
- # separate template
38
- # another ubuntu = 'https://cloud.skytap.com/vms/7242466'
39
- WINDOWS_WINRM_CONFIGURED = 'https://cloud.skytap.com/vms/7242468'
40
-
41
- config.vm.define "vm1" do |ubuntu|
42
- ubuntu.vm.hostname = "vm1"
43
- ubuntu.vm.provider :skytap do |box|
44
- box.vm_url = UBUNTU1#GENERIC_UBUNTU
45
- #box.cpus = 1
46
- #box.cpuspersocket = 1
47
- #box.ram = 1024
48
- #box.guestos = "ubuntu"
49
- #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
50
- end
51
-
52
- ubuntu.vm.network :forwarded_port, guest: 80, host: 8080
53
-
54
- #ubuntu.vm.synced_folder "vm1", "/synced", type: :nfs
55
- #ubuntu.vm.synced_folder "vm1", "/home/skytap/app", type: :nfs, :mount_options => ['actimeo=1']
56
- ubuntu.vm.communicator = :ssh
57
- ubuntu.ssh.username = "skytap"
58
- ubuntu.ssh.password = "ChangeMe!"
59
-
60
-
61
- #ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
62
- #ubuntu.vm.provision "shell", path: "provisioning/apache.sh"
63
- #ubuntu.vm.provision "rails", type: "shell", path: "provisioning/rails.sh"
64
- end
65
-
66
- # config.vm.define "vm2" do |windows|
67
- # windows.vm.provider :skytap do |box, override|
68
- # box.vm_url = WINDOWS_WINRM_CONFIGURED
69
- # override.vm.guest = "windows"
70
- # end
71
- # windows.vm.communicator = :winrm
72
- # end
73
- # config.winrm.username = 'Administrator'
74
- # config.winrm.password = 'admin'
75
- #
76
- # config.vm.define "vm3" do |ubuntu|
77
- # ubuntu.vm.hostname = "vm3"
78
- # ubuntu.vm.provider :skytap do |box|
79
- # box.vm_url = UBUNTU2#GENERIC_UBUNTU
80
- # #box.vpn_url = "cloud.skytap.com/vpns/vpn-711360"
81
- # end
82
- # ubuntu.vm.communicator = :ssh
83
- # ubuntu.ssh.username = "skytap"
84
- # ubuntu.ssh.password = "CarpYe$$$"
85
- # ubuntu.vm.synced_folder "vm3", "/synced", type: :nfs
86
- # ubuntu.vm.provision "shell", path: "provisioning/trivial.sh"
87
- # #ubuntu.vm.provision "shell", path: "provisioning/mysql.sh"
88
- # end
89
- end
90
-
91
-