vagrant-1cloud 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (40) hide show
  1. checksums.yaml +4 -4
  2. metadata +3 -46
  3. data/Gemfile +0 -8
  4. data/LICENSE +0 -373
  5. data/README.md +0 -117
  6. data/Rakefile +0 -21
  7. data/build.sh +0 -32
  8. data/lib/vagrant-1cloud.rb +0 -20
  9. data/lib/vagrant-1cloud/actions.rb +0 -183
  10. data/lib/vagrant-1cloud/actions/check_state.rb +0 -19
  11. data/lib/vagrant-1cloud/actions/create.rb +0 -93
  12. data/lib/vagrant-1cloud/actions/destroy.rb +0 -31
  13. data/lib/vagrant-1cloud/actions/modify_provision_path.rb +0 -38
  14. data/lib/vagrant-1cloud/actions/power_off.rb +0 -35
  15. data/lib/vagrant-1cloud/actions/power_on.rb +0 -45
  16. data/lib/vagrant-1cloud/actions/private_network.rb +0 -108
  17. data/lib/vagrant-1cloud/actions/rebuild.rb +0 -78
  18. data/lib/vagrant-1cloud/actions/reload.rb +0 -42
  19. data/lib/vagrant-1cloud/actions/setup_key.rb +0 -60
  20. data/lib/vagrant-1cloud/actions/setup_sudo.rb +0 -43
  21. data/lib/vagrant-1cloud/actions/setup_user.rb +0 -58
  22. data/lib/vagrant-1cloud/actions/shut_down.rb +0 -35
  23. data/lib/vagrant-1cloud/commands/add_network.rb +0 -59
  24. data/lib/vagrant-1cloud/commands/create_network.rb +0 -135
  25. data/lib/vagrant-1cloud/commands/rebuild.rb +0 -29
  26. data/lib/vagrant-1cloud/config.rb +0 -62
  27. data/lib/vagrant-1cloud/errors.rb +0 -33
  28. data/lib/vagrant-1cloud/helpers/client.rb +0 -181
  29. data/lib/vagrant-1cloud/helpers/result.rb +0 -40
  30. data/lib/vagrant-1cloud/plugin.rb +0 -36
  31. data/lib/vagrant-1cloud/provider.rb +0 -106
  32. data/lib/vagrant-1cloud/version.rb +0 -5
  33. data/locales/en.yml +0 -90
  34. data/pom.xml +0 -59
  35. data/test/Vagrantfile +0 -14
  36. data/test/scripts/provision.sh +0 -3
  37. data/test/test.sh +0 -11
  38. data/test/test_id_rsa +0 -27
  39. data/test/test_id_rsa.pub +0 -1
  40. data/vagrant-1cloud.gemspec +0 -21
@@ -1,40 +0,0 @@
1
- module VagrantPlugins
2
- module OneCloud
3
- module Helpers
4
- class Result
5
- def initialize(body)
6
- @result = body
7
- end
8
-
9
- def [](key)
10
- @result[key.to_s]
11
- end
12
-
13
- def find_id(sub_obj, search)
14
- find(sub_obj, search)["ID"]
15
- end
16
-
17
- def find(sub_obj, search)
18
- key = search.keys.first
19
- value = search[key].to_s
20
- key = key.to_s
21
-
22
- result = @result[sub_obj.to_s].inject(nil) do |result, obj|
23
- obj[key] == value ? obj : result
24
- end
25
-
26
- result || error(sub_obj, key, value)
27
- end
28
-
29
- def error(sub_obj, key, value)
30
- raise(Errors::ResultMatchError, {
31
- :key => key,
32
- :value => value,
33
- :collection_name => sub_obj.to_s,
34
- :sub_obj => @result[sub_obj.to_s]
35
- })
36
- end
37
- end
38
- end
39
- end
40
- end
@@ -1,36 +0,0 @@
1
- module VagrantPlugins
2
- module OneCloud
3
- class Plugin < Vagrant.plugin('2')
4
- name 'OneCloud'
5
- description <<-DESC
6
- This plugin installs a provider that allows Vagrant to manage
7
- machines using 1cloud's API.
8
- DESC
9
-
10
- config(:onecloud, :provider) do
11
- require_relative 'config'
12
- Config
13
- end
14
-
15
- provider(:onecloud, parallel: true, defaultable: false) do
16
- require_relative 'provider'
17
- Provider
18
- end
19
-
20
- command(:rebuild) do
21
- require_relative 'commands/rebuild'
22
- Commands::Rebuild
23
- end
24
-
25
- command("add-network") do
26
- require_relative 'commands/add_network'
27
- Commands::AddNetwork
28
- end
29
-
30
- command("create-network") do
31
- require_relative 'commands/create_network'
32
- Commands::CreateNetwork
33
- end
34
- end
35
- end
36
- end
@@ -1,106 +0,0 @@
1
- require 'vagrant-1cloud/actions'
2
-
3
- module VagrantPlugins
4
- module OneCloud
5
- class Provider < Vagrant.plugin('2', :provider)
6
-
7
- # This class method caches status for all droplets within
8
- # the 1cloud account. A specific droplet's status
9
- # may be refreshed by passing :refresh => true as an option.
10
- def self.droplet(machine, opts = {})
11
- client = Helpers::ApiClient.new(machine)
12
-
13
- # load status of droplets if it has not been done before
14
- if !@droplets
15
- result = client.request('/Server')
16
- @droplets = result['body']
17
- end
18
-
19
- if opts[:refresh] && machine.id
20
- # refresh the droplet status for the given machine
21
- @droplets.delete_if { |d| d['ID'].to_s == machine.id }
22
- result = client.request("/Server/#{machine.id}")
23
- @droplets << droplet = result['body']
24
- else
25
- # lookup droplet status for the given machine
26
- droplet = @droplets.find { |d| d['ID'].to_s == machine.id }
27
- end
28
-
29
- # if lookup by id failed, check for a droplet with a matching name
30
- # and set the id to ensure vagrant stores locally
31
- # TODO allow the user to configure this behavior
32
- if !droplet
33
- name = machine.config.vm.hostname || machine.name
34
- droplet = @droplets.find { |d| d['Name'] == name.to_s }
35
- machine.id = droplet['ID'].to_s if droplet
36
- end
37
-
38
- droplet ||= {'State' => 'not_created'}
39
- end
40
-
41
- def initialize(machine)
42
- @machine = machine
43
- end
44
-
45
- def action(name)
46
- return Actions.send(name) if Actions.respond_to?(name)
47
- nil
48
- end
49
-
50
- # This method is called if the underlying machine ID changes. Providers
51
- # can use this method to load in new data for the actual backing
52
- # machine or to realize that the machine is now gone (the ID can
53
- # become `nil`). No parameters are given, since the underlying machine
54
- # is simply the machine instance given to this object. And no
55
- # return value is necessary.
56
- def machine_id_changed
57
- end
58
-
59
- # This should return a hash of information that explains how to
60
- # SSH into the machine. If the machine is not at a point where
61
- # SSH is even possible, then `nil` should be returned.
62
- #
63
- # The general structure of this returned hash should be the
64
- # following:
65
- #
66
- # {
67
- # :host => "1.2.3.4",
68
- # :port => "22",
69
- # :username => "mitchellh",
70
- # :private_key_path => "/path/to/my/key"
71
- # }
72
- #
73
- # **Note:** Vagrant only supports private key based authenticatonion,
74
- # mainly for the reason that there is no easy way to exec into an
75
- # `ssh` prompt with a password, whereas we can pass a private key
76
- # via commandline.
77
- def ssh_info
78
- droplet = Provider.droplet(@machine)
79
- return nil if droplet['State'].to_sym != :Active
80
- public_network = droplet['IP']
81
-
82
- return {
83
- :host => public_network,
84
- :port => '22',
85
- :username => 'root',
86
- :private_key_path => nil
87
- }
88
- end
89
-
90
- # This should return the state of the machine within this provider.
91
- # The state must be an instance of {MachineState}. Please read the
92
- # documentation of that class for more information.
93
- def state
94
- state = Provider.droplet(@machine)['State'].to_sym
95
- if state == :Active
96
- power = Provider.droplet(@machine)['IsPowerOn']
97
- if power == false
98
- state = :off
99
- end
100
- end
101
- long = short = state.to_s
102
- Vagrant::MachineState.new(state, short, long)
103
- end
104
- end
105
- end
106
- end
@@ -1,5 +0,0 @@
1
- module VagrantPlugins
2
- module OneCloud
3
- VERSION = '1.1.1'
4
- end
5
- end
@@ -1,90 +0,0 @@
1
- en:
2
- vagrant_1cloud:
3
- info:
4
- off: "VPS is off"
5
- not_created: "VPS has not been created"
6
- already_active: "VPS is already active"
7
- already_off: "VPS is already off"
8
- creating: "Creating a new VPS..."
9
- destroying: "Destroying the VPS..."
10
- shutting_down: "Shutting down the VPS..."
11
- powering_off: "Powering off the VPS..."
12
- powering_on: "Powering on the VPS..."
13
- rebuilding: "Rebuilding the VPS..."
14
- reloading: "Rebooting the VPS..."
15
- creating_user: "Creating user account: %{user}..."
16
- late_sudo_install_deb: "1clouds's debian image lacks sudo. Installing now."
17
- modifying_sudo: "Modifying sudoers file to remove tty requirement..."
18
- using_key: "Using existing SSH key: %{name}"
19
- creating_key: "Creating new SSH key: %{name}..."
20
- setting_private_network: "Setting private network..."
21
- creating_private_network: "Creating private network..."
22
- ssh: "Waiting for ssh to be ready"
23
- ssh_off: "ssh connection is off"
24
- ssh_on: "ssh connection is on"
25
- network_exists: "Private network %{network} already exists"
26
- network_missing: "Private network %{network} is missing"
27
- request: "Request: %{path}"
28
- params: "Parameters: %{params}"
29
- response: "Response: %{body}"
30
- already_connected: "VPS is already connected to %{network} network"
31
- config:
32
- token: "Token is required"
33
- private_key: "SSH private key path is required"
34
- public_key: "SSH public key not found: %{key}"
35
- errors:
36
- public_key: |-
37
- There was an issue reading the public key at:
38
-
39
- Path: %{path}
40
-
41
- Please check the file's permissions.
42
- api_status: |-
43
- There was an issue with the request made to the 1cloud
44
- API at:
45
-
46
- Path: %{path}
47
- URI Params: %{params}
48
-
49
- The response status from the API was:
50
-
51
- Status: %{status}
52
- Response: %{response}
53
- rsync: |-
54
- There was an error when attemping to rsync a share folder.
55
- Please inspect the error message below for more info.
56
-
57
- Host path: %{hostpath}
58
- Guest path: %{guestpath}
59
- Error: %{stderr}
60
- json: |-
61
- There was an issue with the JSON response from the 1cloud
62
- API at:
63
-
64
- Path: %{path}
65
- URI Params: %{params}
66
-
67
- The response JSON from the API was:
68
-
69
- Response: %{response}
70
- result_match: |-
71
- The result collection for %{collection_name}:
72
-
73
- %{sub_obj}
74
-
75
- Contained no object with the value "%{value}" for the the
76
- key "%{key}".
77
-
78
- Please ensure that the configured value exists in the collection.
79
- certificate: |-
80
- The secure connection to the 1cloud API has failed. Please
81
- ensure that your local certificates directory is defined in the
82
- provider config.
83
-
84
- config.vm.provider :1cloud do |vm|
85
- vm.ca_path = "/path/to/ssl/ca/cert.crt"
86
- end
87
-
88
- This is generally caused by the OpenSSL configuration associated
89
- with the Ruby install being unaware of the system specific ca
90
- certs.
data/pom.xml DELETED
@@ -1,59 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project xmlns="http://maven.apache.org/POM/4.0.0"
3
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5
- <modelVersion>4.0.0</modelVersion>
6
-
7
- <groupId>com.avtodoria.dc.docker</groupId>
8
- <artifactId>app.vagrant-1cloud</artifactId>
9
- <name>docker.app.vagrant-1cloud</name>
10
- <packaging>pom</packaging>
11
- <version>2.0.0-SNAPSHOT</version>
12
-
13
- <dependencies>
14
-
15
- <dependency>
16
- <groupId>com.avtodoria.dc.vagrant-plugins</groupId>
17
- <artifactId>vagrant-1cloud</artifactId>
18
- <type>gem</type>
19
- <version>2.0.0-SNAPSHOT</version>
20
- </dependency>
21
-
22
- </dependencies>
23
-
24
- <build>
25
- <plugins>
26
- <plugin>
27
- <groupId>org.apache.maven.plugins</groupId>
28
- <artifactId>maven-dependency-plugin</artifactId>
29
- <executions>
30
- <execution>
31
- <id>vagrant-1cloud</id>
32
- <phase>package</phase>
33
- <goals>
34
- <goal>copy</goal>
35
- </goals>
36
- <configuration>
37
- <artifactItems>
38
- <artifactItem>
39
- <groupId>com.avtodoria.dc.vagrant-plugins</groupId>
40
- <artifactId>vagrant-1cloud</artifactId>
41
- <version>2.0.0-SNAPSHOT</version>
42
- <type>gem</type>
43
- <overWrite>true</overWrite>
44
- <destFileName>vagrant-1cloud.gem</destFileName>
45
- </artifactItem>
46
- </artifactItems>
47
- <outputDirectory>
48
- ${project.build.directory}
49
- </outputDirectory>
50
- <overWriteIfNewer>true</overWriteIfNewer>
51
- <overWriteSnapshots>true</overWriteSnapshots>
52
- </configuration>
53
- </execution>
54
- </executions>
55
- </plugin>
56
- </plugins>
57
- </build>
58
-
59
- </project>
@@ -1,14 +0,0 @@
1
- Vagrant.require_plugin('vagrant-1cloud')
2
-
3
- Vagrant.configure('2') do |config|
4
- config.vm.define "test" do |t|
5
- t.vm.provider :onecloud do |provider, override|
6
- override.ssh.private_key_path = 'test_id_rsa'
7
- override.vm.box = 'onecloud'
8
- override.vm.hostname = 'test'
9
- override.vm.provision :shell, :path => 'scripts/provision.sh'
10
-
11
- provider.token = ENV['OC_TOKEN']
12
- end
13
- end
14
- end
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- echo 'Testing 1 2 3!'
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- cd test
4
-
5
- bundle exec vagrant up --provider=onecloud
6
- bundle exec vagrant up
7
- bundle exec vagrant provision
8
- bundle exec vagrant halt
9
- bundle exec vagrant destroy
10
-
11
- cd ..
@@ -1,27 +0,0 @@
1
- -----BEGIN RSA PRIVATE KEY-----
2
- MIIEowIBAAKCAQEAmxZRyfvgXFxlPW9ivoxffdK9erqpCp1oitghUtDxbzPSCbNw
3
- qBoiJcnPVA/TuCxMnruUcNEXYgKfTL8lD3A1Hom8N1pTAhSed5m4qAGqTMubT15s
4
- cSR+SnDdriShErB/9YSb9LVn1aR0MsFS3H/+x1j4w5d6hBas8BhDfuVd16shvoaA
5
- OKy0ywy+NBuvGy/6Au3q3t7M9wdelODRnYLSWWqaLeYExRKxWWc7ape+oduQoe4r
6
- BNVwGmIOjWOM9aFPEPVHdLGO+LQyPExdeuS0rW96a39U4p8GjGzsrkNcKzVOGjM3
7
- pIsGs3qOi7RzJ3z48HiBj9NT8I2fFpGHERerbQIDAQABAoIBABXsIcObhyuHJAh7
8
- JkopLZZro70lhZ+qgIyf4JYEUxyVBqu4YcRhbVJKJLSNSDBQksQdX+5SoCuKk1oV
9
- 6vcztU6Lyb9JVVKF96CQajnVgm04msutXUbhEbkUG0Hyi5JIwM3D4QfGXNcmWAaU
10
- rVHeBfXH7eI4F2l0ix2lUGUvpwRFRDq9HgpOjXzyc57B4jeF7na/UTnt+Uoi4hzZ
11
- FjjQ7nSLqEJLXtQBqt4EnAZu6/9JlAApunyMOX2oTqRNn8XGmD0Rc+AouipHM+Mc
12
- 9/fN9oqVxxXw2MdJA6S/sEFLEDrbifmyyHOereuZtOjdWLqsCdZwewYl8nuBnYEU
13
- GjVzYgECgYEAx+efis7xma28HWqtW9GLvjBcFAD/f+MDDeqX9TKFwf+91tUq0QZi
14
- SqXvmIvCnpsO8I70WEskT+pPwJWReAbZBrCbCVDbH34KEkAHywH9sK6chWnB8OpU
15
- 0mp0gH89A4bq/tedKVHCQ2sAbKgbIc1zf3zpmMQiV+smMDQXU1fTg/kCgYEAxpst
16
- BD2cYftFjxFZE1v8fx6t6oHtzYRtNNFT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Q1wrNU4aMzekiwazeo6LtHMnfPjweIGP01PwjZ8WkYcRF6tt onecloud provider test key
@@ -1,21 +0,0 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'vagrant-1cloud/version'
5
-
6
- Gem::Specification.new do |gem|
7
- gem.name = "vagrant-1cloud"
8
- gem.version = VagrantPlugins::OneCloud::VERSION
9
- gem.authors = ["Bulat Yusupov"]
10
- gem.email = ["usbulat@gmail.com"]
11
- gem.description = %q{Enables Vagrant to manage 1cloud droplets. Based on https://github.com/devopsgroup-io/vagrant-digitalocean.}
12
- gem.summary = gem.description
13
-
14
- gem.files = `git ls-files`.split($/)
15
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
16
- gem.require_paths = ["lib"]
17
-
18
- gem.add_dependency "faraday", ">= 0.8.6"
19
- gem.add_dependency "json"
20
- gem.add_dependency "log4r"
21
- end