vagrant-pyinfra 0.0.1
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 +7 -0
- data/.gitignore +1 -0
- data/Gemfile +9 -0
- data/LICENSE.md +7 -0
- data/README.md +1 -0
- data/example/Vagrantfile +7 -0
- data/example/deploy.py +9 -0
- data/lib/vagrant-pyinfra.rb +9 -0
- data/lib/vagrant-pyinfra/config.rb +44 -0
- data/lib/vagrant-pyinfra/plugin.rb +21 -0
- data/lib/vagrant-pyinfra/provisioner.rb +30 -0
- data/lib/vagrant-pyinfra/version.rb +5 -0
- data/vagrant-pyinfra.gemspec +17 -0
- metadata +55 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 7026760a16b76e8efd9c736fdc1ba3146730a2f0
|
4
|
+
data.tar.gz: 42d658de8a388a7a70f42bd230761877882f5cf1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 1125d5a203e64608a277c74491fd1e80e82c3d3fcf53b46814e22ff0b85db84a1ed583df1d2fea45a5d1fd1fcf13d7a208f1d6cf77553da5b9409f6bbd47e38d
|
7
|
+
data.tar.gz: a6141833028808cfc11e8ca72186e082cff974bcf1b0409bb50cdc757d8d4f30f06e7657157ac1a20433f6be8e19426f25158103faa4742006d14ada499743cf
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Gemfile.lock
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (C) 2016 Nick Barrett <pointlessrambler@gmail.com>
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Vagrant pyinfra Provisioner
|
data/example/Vagrantfile
ADDED
data/example/deploy.py
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Pyinfra
|
3
|
+
class Config < Vagrant.plugin('2', :config)
|
4
|
+
attr_accessor :deploy_file
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@deploy_file = UNSET_VALUE
|
8
|
+
end
|
9
|
+
|
10
|
+
def finalize!
|
11
|
+
@deploy_file = 'deploy.py' if @deploy_file == UNSET_VALUE
|
12
|
+
end
|
13
|
+
|
14
|
+
def execute(command)
|
15
|
+
output = ''
|
16
|
+
begin
|
17
|
+
IO.popen(command, 'w+') do |f|
|
18
|
+
f.close_write
|
19
|
+
output = f.read
|
20
|
+
end
|
21
|
+
output
|
22
|
+
rescue Errno::ENOENT
|
23
|
+
false
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate(env)
|
28
|
+
errors = _detected_errors
|
29
|
+
|
30
|
+
if not File.exist?(deploy_file) then
|
31
|
+
errors << "#{deploy_file} does not exist."
|
32
|
+
end
|
33
|
+
|
34
|
+
command = 'pyinfra --version'
|
35
|
+
output = execute(command)
|
36
|
+
if not output then
|
37
|
+
errors << 'pyinfra command does not exist.'
|
38
|
+
end
|
39
|
+
|
40
|
+
{'pyinfra provisioner' => errors}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Pyinfra
|
3
|
+
class Plugin < Vagrant.plugin('2')
|
4
|
+
name 'pyinfra'
|
5
|
+
|
6
|
+
description <<-DESC
|
7
|
+
Provision VMs with pyinfra.
|
8
|
+
DESC
|
9
|
+
|
10
|
+
config(:pyinfra, :provisioner) do
|
11
|
+
require_relative 'config'
|
12
|
+
Config
|
13
|
+
end
|
14
|
+
|
15
|
+
provisioner(:pyinfra) do
|
16
|
+
require_relative 'provisioner'
|
17
|
+
Provisioner
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Vagrant
|
2
|
+
module Pyinfra
|
3
|
+
class Provisioner < Vagrant.plugin('2', :provisioner)
|
4
|
+
def provision
|
5
|
+
ssh_info = @machine.ssh_info
|
6
|
+
user = ssh_info[:username]
|
7
|
+
host = ssh_info[:host]
|
8
|
+
port = ssh_info[:port]
|
9
|
+
|
10
|
+
if ssh_info[:private_key_path].kind_of?(Array)
|
11
|
+
private_key = ssh_info[:private_key_path][0]
|
12
|
+
else
|
13
|
+
private_key = ssh_info[:private_key_path]
|
14
|
+
end
|
15
|
+
|
16
|
+
pyinfra_command = (
|
17
|
+
"pyinfra " +
|
18
|
+
"-i #{host} " +
|
19
|
+
"--key #{private_key} " +
|
20
|
+
"--port #{port} " +
|
21
|
+
"--user #{user} " +
|
22
|
+
"#{config.deploy_file}"
|
23
|
+
)
|
24
|
+
|
25
|
+
puts "Running: #{pyinfra_command}"
|
26
|
+
system pyinfra_command
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require File.expand_path('../lib/vagrant-pyinfra/version', __FILE__)
|
2
|
+
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'vagrant-pyinfra'
|
6
|
+
s.version = Vagrant::Pyinfra::VERSION
|
7
|
+
s.date = '2016-12-28'
|
8
|
+
s.summary = 'Vagrant pyinfra provisioner.'
|
9
|
+
s.description = 'Provision Vagrant VMs with pyinfra.'
|
10
|
+
s.authors = ['Nick Barrett']
|
11
|
+
s.email = 'pointlessrambler@gmail.com'
|
12
|
+
s.files = `git ls-files`.split($\)
|
13
|
+
s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
14
|
+
s.require_paths = ['lib']
|
15
|
+
s.homepage = ''
|
16
|
+
s.license = 'MIT'
|
17
|
+
end
|
metadata
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vagrant-pyinfra
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nick Barrett
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: Provision Vagrant VMs with pyinfra.
|
14
|
+
email: pointlessrambler@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- ".gitignore"
|
20
|
+
- Gemfile
|
21
|
+
- LICENSE.md
|
22
|
+
- README.md
|
23
|
+
- example/Vagrantfile
|
24
|
+
- example/deploy.py
|
25
|
+
- lib/vagrant-pyinfra.rb
|
26
|
+
- lib/vagrant-pyinfra/config.rb
|
27
|
+
- lib/vagrant-pyinfra/plugin.rb
|
28
|
+
- lib/vagrant-pyinfra/provisioner.rb
|
29
|
+
- lib/vagrant-pyinfra/version.rb
|
30
|
+
- vagrant-pyinfra.gemspec
|
31
|
+
homepage: ''
|
32
|
+
licenses:
|
33
|
+
- MIT
|
34
|
+
metadata: {}
|
35
|
+
post_install_message:
|
36
|
+
rdoc_options: []
|
37
|
+
require_paths:
|
38
|
+
- lib
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
requirements: []
|
50
|
+
rubyforge_project:
|
51
|
+
rubygems_version: 2.6.8
|
52
|
+
signing_key:
|
53
|
+
specification_version: 4
|
54
|
+
summary: Vagrant pyinfra provisioner.
|
55
|
+
test_files: []
|