vagrant-oneandone 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +33 -0
  3. data/.rspec +2 -0
  4. data/.rubocop.yml +29 -0
  5. data/.travis.yml +16 -0
  6. data/Gemfile +12 -0
  7. data/LICENSE +201 -0
  8. data/README.md +275 -0
  9. data/Rakefile +33 -0
  10. data/box/README.md +13 -0
  11. data/box/Vagrantfile +7 -0
  12. data/box/dummy.box +0 -0
  13. data/box/metadata.json +3 -0
  14. data/examples/01_coreos_simple/Vagrantfile +12 -0
  15. data/examples/02_django_centos7_app/Vagrantfile +14 -0
  16. data/examples/03_ubuntu12.04_shell_provision/Vagrantfile +19 -0
  17. data/examples/04_parallel_servers/Vagrantfile +26 -0
  18. data/examples/05_debian8_docker_provision/Vagrantfile +17 -0
  19. data/lib/vagrant-oneandone.rb +26 -0
  20. data/lib/vagrant-oneandone/action.rb +163 -0
  21. data/lib/vagrant-oneandone/action/connect_1and1.rb +28 -0
  22. data/lib/vagrant-oneandone/action/create.rb +76 -0
  23. data/lib/vagrant-oneandone/action/destroy.rb +69 -0
  24. data/lib/vagrant-oneandone/action/get_state.rb +17 -0
  25. data/lib/vagrant-oneandone/action/power_off.rb +49 -0
  26. data/lib/vagrant-oneandone/action/power_on.rb +39 -0
  27. data/lib/vagrant-oneandone/action/read_ssh_info.rb +54 -0
  28. data/lib/vagrant-oneandone/action/read_state.rb +44 -0
  29. data/lib/vagrant-oneandone/action/reload.rb +48 -0
  30. data/lib/vagrant-oneandone/command/list_appliances.rb +38 -0
  31. data/lib/vagrant-oneandone/command/list_datacenters.rb +36 -0
  32. data/lib/vagrant-oneandone/command/list_firewalls.rb +32 -0
  33. data/lib/vagrant-oneandone/command/list_ips.rb +45 -0
  34. data/lib/vagrant-oneandone/command/list_load_balancers.rb +43 -0
  35. data/lib/vagrant-oneandone/command/list_monitor_policies.rb +32 -0
  36. data/lib/vagrant-oneandone/command/list_servers.rb +32 -0
  37. data/lib/vagrant-oneandone/command/list_sizes.rb +43 -0
  38. data/lib/vagrant-oneandone/command/main.rb +85 -0
  39. data/lib/vagrant-oneandone/command/utils.rb +31 -0
  40. data/lib/vagrant-oneandone/config.rb +65 -0
  41. data/lib/vagrant-oneandone/config_resolver.rb +97 -0
  42. data/lib/vagrant-oneandone/errors.rb +45 -0
  43. data/lib/vagrant-oneandone/plugin.rb +36 -0
  44. data/lib/vagrant-oneandone/provider.rb +41 -0
  45. data/lib/vagrant-oneandone/version.rb +5 -0
  46. data/locales/en.yml +124 -0
  47. data/vagrant-oneandone.gemspec +29 -0
  48. data/vagrant-spec.config.rb +9 -0
  49. metadata +189 -0
@@ -0,0 +1,36 @@
1
+ begin
2
+ require 'vagrant'
3
+ rescue LoadError
4
+ raise 'The Vagrant 1&1 plugin must be run within Vagrant.'
5
+ end
6
+
7
+ module VagrantPlugins
8
+ module OneAndOne
9
+ class Plugin < Vagrant.plugin('2')
10
+ name 'OneAndOne'
11
+ description <<-DESC
12
+ This plugin installs a provider that allows Vagrant to manage
13
+ 1&1 Cloud servers.
14
+ DESC
15
+
16
+ config(:oneandone, :provider) do
17
+ require_relative 'config'
18
+ Config
19
+ end
20
+
21
+ provider(:oneandone, parallel: true) do
22
+ OneAndOne.init_i18n
23
+
24
+ require_relative 'provider'
25
+ Provider
26
+ end
27
+
28
+ command('oneandone') do
29
+ OneAndOne.init_i18n
30
+
31
+ require_relative 'command/main'
32
+ Command::Main
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
1
+ require 'vagrant'
2
+
3
+ # require "vagrant-oneandone/action"
4
+
5
+ module VagrantPlugins
6
+ module OneAndOne
7
+ class Provider < Vagrant.plugin('2', :provider)
8
+ def initialize(machine)
9
+ @machine = machine
10
+ end
11
+
12
+ def action(name)
13
+ action_method = "action_#{name}"
14
+ return Action.send(action_method) if Action.respond_to?(action_method)
15
+ nil
16
+ end
17
+
18
+ def ssh_info
19
+ env = @machine.action('read_ssh_info')
20
+ env[:machine_ssh_info]
21
+ end
22
+
23
+ def state
24
+ env = @machine.action('read_state')
25
+
26
+ state_id = env[:machine_state_id]
27
+
28
+ # Get the short and long description
29
+ short = I18n.t("vagrant_1and1.states.short_#{state_id}")
30
+ long = I18n.t("vagrant_1and1.states.long_#{state_id}")
31
+
32
+ # Return the MachineState object
33
+ Vagrant::MachineState.new(state_id, short, long)
34
+ end
35
+
36
+ def to_s
37
+ '1&1 Cloud Server'
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module OneAndOne
3
+ VERSION = '1.0.0'.freeze
4
+ end
5
+ end
@@ -0,0 +1,124 @@
1
+ en:
2
+ vagrant_1and1:
3
+ already_created: |-
4
+ The server is already created.
5
+ already_stopped: |-
6
+ The server is already stopped.
7
+ finding_fixed_instance_size: |-
8
+ Finding fixed instance size for the server...
9
+ finding_appliance: |-
10
+ Finding appliance for the server...
11
+ finding_datacenter: |-
12
+ Finding data center for the server...
13
+ finding_public_ip: |-
14
+ Finding unassigned public IP address...
15
+ creating_server: |-
16
+ Creating server...
17
+ reloading_server: |-
18
+ Restarting the server...
19
+ server_deleted: |-
20
+ The server has been destroyed.
21
+ starting_server: |-
22
+ Starting the server...
23
+ stopping_server: |-
24
+ Stopping the server...
25
+ powered_off: |-
26
+ The server has been stopped.
27
+ rebooted: |-
28
+ The server has been rebooted.
29
+ powered_on: |-
30
+ The server is up and running.
31
+ not_created: |-
32
+ The server hasn't been created yet. Run `vagrant up` first.
33
+ ready: |-
34
+ The server is ready!
35
+ rsync_folder: |-
36
+ Rsyncing folder: %{hostpath} => %{guestpath}
37
+ wait_deleting_server: |-
38
+ Waiting until the server is deleted...
39
+
40
+ command:
41
+ available_subcommands: |-
42
+ Available subcommands:
43
+ help_subcommands: |-
44
+ For help on any subcommand run
45
+ list_appliances: |-
46
+ List available 1&1 server appliances.
47
+ list_datacenters: |-
48
+ List 1&1 data centers.
49
+ list_firewalls: |-
50
+ List available 1&1 firewall policies.
51
+ list_load_balancers: |-
52
+ List available 1&1 load balancers.
53
+ list_monitor_policies: |-
54
+ List available 1&1 monitoring policies.
55
+ list_public_ips: |-
56
+ List available 1&1 public IPs.
57
+ list_servers: |-
58
+ List available 1&1 servers.
59
+ list_sizes: |-
60
+ List available fixed-server sizes.
61
+ synopsis: |-
62
+ oneandone provider specific commands
63
+
64
+ config:
65
+ api_key_required: |-
66
+ 1&1 API key is required.
67
+ private_key: |-
68
+ "Private key path is required."
69
+ public_key: |-
70
+ "Public key not found: %{key}."
71
+
72
+ errors:
73
+ could_not_delete: |-
74
+ The server could not be deleted.
75
+ instance_not_found: |-
76
+ Vagrant was unable to find the 1&1 server used for your vagrant machine.
77
+ It might be already deleted.
78
+ ip_address_already_in_use: |-
79
+ The specified IP address is already assigned to another entity.
80
+ missing_api_key: |-
81
+ 1&1 API key not found. Use either ONEANDONE_API_KEY environment
82
+ variable or specify the key in the command line. See the command help.
83
+ no_matching_fixed_size: |-
84
+ No matching fixed-instance size was found! Please check your server size
85
+ setting.
86
+ no_matching_appliance: |-
87
+ No matching server appliance was found! Please check your server appliance
88
+ setting to make sure you have specified a valid server appliance.
89
+ no_matching_datacenter: |-
90
+ No matching data center was found! Please check your data center
91
+ setting to make sure you have specified a valid data center.
92
+ no_matching_public_ip: |-
93
+ No matching public IP was found! Please specify a valid public IP address.
94
+ ssh_key_not_found: |-
95
+ SSH key inaccesible or not found: %{key}. Make sure you have specified a valid path.
96
+ rsync_error: |-
97
+ There was an error when attemping to rsync a share folder.
98
+ Please inspect the error message below for more info.
99
+
100
+ Host path: %{hostpath}
101
+ Guest path: %{guestpath}
102
+ Error: %{stderr}
103
+ unsupported_appliance: |-
104
+ 1&1 vagrant plugin currently supports only Linux OS appliances.
105
+
106
+ states:
107
+ short_active: |-
108
+ active
109
+ long_active: |-
110
+ The server is up and running. Run `vagrant ssh` to access it.
111
+ short_deploying: |-
112
+ deploying
113
+ long_deploying: |-
114
+ The server is currently being deployed. You must wait for this to
115
+ complete before you can access or delete it.
116
+ short_not_created: |-
117
+ not created
118
+ long_not_created: |-
119
+ The server is not created. Run `vagrant up` to create it.
120
+ short_off: |-
121
+ off
122
+ long_off: |-
123
+ The server is powered off. Run `vagrant up` to start it.
124
+
@@ -0,0 +1,29 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-oneandone/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'vagrant-oneandone'
8
+ spec.version = VagrantPlugins::OneAndOne::VERSION
9
+ spec.authors = ['Nurfet Becirevic']
10
+ spec.email = ['nurfet@stackpointcloud.com']
11
+
12
+ spec.description = 'Enables Vagrant to manage 1&1 Cloud servers'
13
+ spec.summary = spec.description
14
+ spec.homepage = 'https://github.com/1and1/oneandone-cloudserver-vagrant'
15
+ spec.license = 'Apache-2.0'
16
+
17
+ spec.add_runtime_dependency 'fog-oneandone'
18
+ spec.add_runtime_dependency 'i18n', '~> 0.6.0'
19
+ spec.add_runtime_dependency 'terminal-table', '~> 1.7.2'
20
+
21
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.require_paths = ['lib']
24
+
25
+ spec.add_development_dependency 'bundler', '~> 1.12'
26
+ spec.add_development_dependency 'rake', '~> 10.0'
27
+ spec.add_development_dependency 'rspec', '~> 2.14'
28
+ spec.add_development_dependency 'rubocop', '~> 0.39'
29
+ end
@@ -0,0 +1,9 @@
1
+ Vagrant::Spec::Acceptance.configure do |c|
2
+ c.component_paths << File.expand_path('../spec/acceptance', __FILE__)
3
+ c.skeleton_paths << File.expand_path('../spec/acceptance/skeletons', __FILE__)
4
+
5
+ c.env['PRIVATE_KEY_PATH'] = File.expand_path('../spec/keys/test_id_rsa', __FILE__)
6
+
7
+ c.provider 'oneandone',
8
+ box: File.expand_path('../box/dummy.box', __FILE__)
9
+ end
metadata ADDED
@@ -0,0 +1,189 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-oneandone
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Nurfet Becirevic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-10-20 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: fog-oneandone
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: i18n
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: terminal-table
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 1.7.2
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 1.7.2
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rake
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '10.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '10.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '2.14'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '2.14'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.39'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.39'
111
+ description: Enables Vagrant to manage 1&1 Cloud servers
112
+ email:
113
+ - nurfet@stackpointcloud.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - ".gitignore"
119
+ - ".rspec"
120
+ - ".rubocop.yml"
121
+ - ".travis.yml"
122
+ - Gemfile
123
+ - LICENSE
124
+ - README.md
125
+ - Rakefile
126
+ - box/README.md
127
+ - box/Vagrantfile
128
+ - box/dummy.box
129
+ - box/metadata.json
130
+ - examples/01_coreos_simple/Vagrantfile
131
+ - examples/02_django_centos7_app/Vagrantfile
132
+ - examples/03_ubuntu12.04_shell_provision/Vagrantfile
133
+ - examples/04_parallel_servers/Vagrantfile
134
+ - examples/05_debian8_docker_provision/Vagrantfile
135
+ - lib/vagrant-oneandone.rb
136
+ - lib/vagrant-oneandone/action.rb
137
+ - lib/vagrant-oneandone/action/connect_1and1.rb
138
+ - lib/vagrant-oneandone/action/create.rb
139
+ - lib/vagrant-oneandone/action/destroy.rb
140
+ - lib/vagrant-oneandone/action/get_state.rb
141
+ - lib/vagrant-oneandone/action/power_off.rb
142
+ - lib/vagrant-oneandone/action/power_on.rb
143
+ - lib/vagrant-oneandone/action/read_ssh_info.rb
144
+ - lib/vagrant-oneandone/action/read_state.rb
145
+ - lib/vagrant-oneandone/action/reload.rb
146
+ - lib/vagrant-oneandone/command/list_appliances.rb
147
+ - lib/vagrant-oneandone/command/list_datacenters.rb
148
+ - lib/vagrant-oneandone/command/list_firewalls.rb
149
+ - lib/vagrant-oneandone/command/list_ips.rb
150
+ - lib/vagrant-oneandone/command/list_load_balancers.rb
151
+ - lib/vagrant-oneandone/command/list_monitor_policies.rb
152
+ - lib/vagrant-oneandone/command/list_servers.rb
153
+ - lib/vagrant-oneandone/command/list_sizes.rb
154
+ - lib/vagrant-oneandone/command/main.rb
155
+ - lib/vagrant-oneandone/command/utils.rb
156
+ - lib/vagrant-oneandone/config.rb
157
+ - lib/vagrant-oneandone/config_resolver.rb
158
+ - lib/vagrant-oneandone/errors.rb
159
+ - lib/vagrant-oneandone/plugin.rb
160
+ - lib/vagrant-oneandone/provider.rb
161
+ - lib/vagrant-oneandone/version.rb
162
+ - locales/en.yml
163
+ - vagrant-oneandone.gemspec
164
+ - vagrant-spec.config.rb
165
+ homepage: https://github.com/1and1/oneandone-cloudserver-vagrant
166
+ licenses:
167
+ - Apache-2.0
168
+ metadata: {}
169
+ post_install_message:
170
+ rdoc_options: []
171
+ require_paths:
172
+ - lib
173
+ required_ruby_version: !ruby/object:Gem::Requirement
174
+ requirements:
175
+ - - ">="
176
+ - !ruby/object:Gem::Version
177
+ version: '0'
178
+ required_rubygems_version: !ruby/object:Gem::Requirement
179
+ requirements:
180
+ - - ">="
181
+ - !ruby/object:Gem::Version
182
+ version: '0'
183
+ requirements: []
184
+ rubyforge_project:
185
+ rubygems_version: 2.6.7
186
+ signing_key:
187
+ specification_version: 4
188
+ summary: Enables Vagrant to manage 1&1 Cloud servers
189
+ test_files: []