vagrant-compose 0.7.0 → 0.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b301a6a6168fb5d273e7cc98304c808f07609304
4
- data.tar.gz: cf8fe8a74f47f7e7f85dbe3cfe8854545fe88ac2
3
+ metadata.gz: b2ca4a2adb7273d09c0650fa06fc3d3f059d8e3a
4
+ data.tar.gz: 95c5b8b69f87f119e51b76507cba24716902625c
5
5
  SHA512:
6
- metadata.gz: df46b624b131f9fc8e81c217b9d894ba1b6aaf3111de9e88438c6a00d3ec698efec71cdc82fcb6c477631547001ba09c56d336444ce2b87118d2358b2c295340
7
- data.tar.gz: 14403ed71cafd28eda089b2bfea7c918fb5c7f919aa9e6ae04ee37d5c1ab08c706edd7f2460132f35dafbe6dc1022c88f768c2a666faa8bd2956fe56be0f2250
6
+ metadata.gz: f24a63d849bd0b574bed06bdcc1e454b6549f93a1ef0bd4367888541cf889f5bdf79f5e13ccfc320c9a546ce4712181428e5a5a905ba2c56a335b42753df30d8
7
+ data.tar.gz: 1a682bf36be2fb2d1b6501bbae5ed7b04e29d206d7c8aa45192b584d0ecdd37f58787c2f2357d0e37826a44bd27eccc0b9503f633a5719c8a9cb217973db9496
data/.gitignore CHANGED
@@ -17,4 +17,4 @@ Vagrantfile
17
17
 
18
18
  # Test
19
19
  provisioning
20
- declarative.yaml
20
+ *.yaml
data/CHANGELOG.md CHANGED
@@ -35,3 +35,8 @@ ansible_group_vars_path and ansible_host_vars_path are not supported anymore
35
35
  # 0.7.0 (November 02, 2016)
36
36
 
37
37
  * introduced support for declarative cluster definition
38
+
39
+ # 0.7.1 (November 04, 2016)
40
+
41
+ * Minor fix
42
+
data/README.md CHANGED
@@ -33,13 +33,13 @@ Vagrant-compose supports two appraches for definining a cluster of VMs.
33
33
 
34
34
  Cluster are defined by using the some ruby knowledge that is required for writing Vagrantfiles.
35
35
 
36
- see [Programmatic Approach](http://pippo) for more details.
36
+ see [Programmatic Approach](https://github.com/fabriziopandini/vagrant-compose/blob/master/doc/programmatic.md) for more details.
37
37
 
38
38
  - Declarative Approach
39
39
 
40
40
  By using the declarative approach also people with limited programming background can use vagrant-compose to easily define a cluster composed by many VMs; with declarative approach, the definition of the cluster is done in yaml, and the ruby programming part within the Vagrantfile is reduced to the minimum.
41
41
 
42
- see [Declarative Approach](http://pippo) for more details.
42
+ see [Declarative Approach](https://github.com/fabriziopandini/vagrant-compose/blob/master/doc/declarative.md) for more details.
43
43
 
44
44
  # Additional notes
45
45
  Vagrant compose will play nicely with all vagrant commands.
@@ -24,27 +24,27 @@ module VagrantPlugins
24
24
  # It defaults to current directory/provisioning
25
25
  attr_accessor :ansible_playbook_path
26
26
 
27
- # Costruttore di una istanza di cluster.
27
+ # Costruttore di una istanza di cluster.
28
28
  def initialize()
29
- @multimachine_filter = ""
29
+ @multimachine_filter = ""
30
30
  end
31
31
 
32
32
  # Implements cluster creation from a playbook file
33
- def from (file)
34
- # calls vagrant-playbook utility for executing the playbook file.
35
- playbook = YAML.load(pycompose (file))
33
+ def from (file)
34
+ # calls vagrant-playbook utility for executing the playbook file.
35
+ playbook = YAML.load(pycompose (file))
36
36
 
37
- # extract cluster attributes
38
- @name = playbook.keys[0]
39
- @box = playbook[@name]['box']
40
- @domain = playbook[@name]['domain']
41
- @ansible_playbook_path = playbook[@name]['ansible_playbook_path']
37
+ # extract cluster attributes
38
+ @name = playbook.keys[0]
39
+ @box = playbook[@name]['box']
40
+ @domain = playbook[@name]['domain']
41
+ @ansible_playbook_path = playbook[@name]['ansible_playbook_path']
42
42
 
43
43
  # extract nodes
44
44
  nodes = []
45
45
  playbook[@name]['nodes'].each do |node|
46
46
 
47
- boxname = node.keys[0]
47
+ boxname = node.keys[0]
48
48
 
49
49
  box = node[boxname]['box']
50
50
  hostname = node[boxname]['hostname']
@@ -64,74 +64,79 @@ module VagrantPlugins
64
64
  # extract ansible inventory, ansible_group_vars, ansible_host_vars
65
65
  ansible_groups = {}
66
66
  if playbook[@name].key?("ansible")
67
- ansible = playbook[@name]['ansible']
68
-
69
- # extract ansible inventory
70
- ansible_groups = ansible['inventory']
71
-
72
- # cleanup ansible_group_vars files
73
- # TODO: make safe
74
- ansible_group_vars_path = File.join(@ansible_playbook_path, 'group_vars')
75
-
76
- FileUtils.mkdir_p(ansible_group_vars_path) unless File.exists?(ansible_group_vars_path)
77
- Dir.foreach(ansible_group_vars_path) {|f| fn = File.join(ansible_group_vars_path, f); File.delete(fn) if f.end_with?(".yml")}
78
-
79
- #generazione ansible_group_vars file (NB. 1 group = 1 gruppo host ansible)
80
- ansible['group_vars'].each do |group, vars|
81
- # crea il file (se sono state generate delle variabili)
82
- unless vars.empty?
83
- # TODO: make safe
84
- File.open(File.join(ansible_group_vars_path,"#{group}.yml") , 'w+') do |file|
85
- file.puts YAML::dump(vars)
86
- end
87
- end
88
- end
89
-
90
- # cleanup ansible_host_vars files (NB. 1 nodo = 1 host)
91
- # TODO: make safe
92
- ansible_host_vars_path = File.join(@ansible_playbook_path, 'host_vars')
93
-
94
- FileUtils.mkdir_p(ansible_host_vars_path) unless File.exists?(ansible_host_vars_path)
95
- Dir.foreach(ansible_host_vars_path) {|f| fn = File.join(ansible_host_vars_path, f); File.delete(fn) if f.end_with?(".yml")}
96
-
97
- #generazione ansible_host_vars file
98
- ansible['host_vars'].each do |host, vars|
99
- # crea il file (se sono state generate delle variabili)
100
- unless vars.empty?
101
- # TODO: make safe
102
- File.open(File.join(ansible_host_vars_path,"#{host}.yml") , 'w+') do |file|
103
- file.puts YAML::dump(vars)
104
- end
105
- end
106
- end
107
- end
108
67
 
109
- return nodes, ansible_groups
110
- end
68
+ ansible = playbook[@name]['ansible']
69
+
70
+ # extract ansible inventory
71
+ ansible_groups = ansible['inventory']
72
+
73
+ # cleanup ansible_group_vars files
74
+ # TODO: make safe
75
+ ansible_group_vars_path = File.join(@ansible_playbook_path, 'group_vars')
76
+
77
+ FileUtils.mkdir_p(ansible_group_vars_path) unless File.exists?(ansible_group_vars_path)
78
+ Dir.foreach(ansible_group_vars_path) {|f| fn = File.join(ansible_group_vars_path, f); File.delete(fn) if f.end_with?(".yml")}
79
+
80
+ #generazione ansible_group_vars file (NB. 1 group = 1 gruppo host ansible)
81
+ if ansible.key?("group_vars")
82
+ ansible['group_vars'].each do |group, vars|
83
+ # crea il file (se sono state generate delle variabili)
84
+ unless vars.empty?
85
+ # TODO: make safe
86
+ File.open(File.join(ansible_group_vars_path,"#{group}.yml") , 'w+') do |file|
87
+ file.puts YAML::dump(vars)
88
+ end
89
+ end
90
+ end
91
+ end
92
+
93
+ # cleanup ansible_host_vars files (NB. 1 nodo = 1 host)
94
+ # TODO: make safe
95
+ ansible_host_vars_path = File.join(@ansible_playbook_path, 'host_vars')
96
+
97
+ FileUtils.mkdir_p(ansible_host_vars_path) unless File.exists?(ansible_host_vars_path)
98
+ Dir.foreach(ansible_host_vars_path) {|f| fn = File.join(ansible_host_vars_path, f); File.delete(fn) if f.end_with?(".yml")}
99
+
100
+ #generazione ansible_host_vars file
101
+ if ansible.key?("host_vars")
102
+ ansible['host_vars'].each do |host, vars|
103
+ # crea il file (se sono state generate delle variabili)
104
+ unless vars.empty?
105
+ # TODO: make safe
106
+ File.open(File.join(ansible_host_vars_path,"#{host}.yml") , 'w+') do |file|
107
+ file.puts YAML::dump(vars)
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
111
113
 
114
+ return nodes, ansible_groups
115
+ end
112
116
 
113
- # Executes pycompose command
114
- def pycompose (file)
115
- p_err = ""
116
- p_out = ""
117
117
 
118
- begin
119
- p_status = Open4::popen4("vagrant-playbook -f #{file}") do |pid, stdin, stdout, stderr|
120
- p_err = stderr.read.strip
121
- p_out = stdout.read.strip
122
- end
123
- rescue Errno::ENOENT
124
- raise VagrantPlugins::Compose::Errors::PyComposeMissing
125
- rescue Exception => e
126
- raise VagrantPlugins::Compose::Errors::PyComposeError, :message => e.message
127
- end
118
+ # Executes pycompose command
119
+ def pycompose (file)
120
+ p_err = ""
121
+ p_out = ""
122
+
123
+ begin
124
+ p_status = Open4::popen4("vagrant-playbook -f #{file}") do |pid, stdin, stdout, stderr|
125
+ p_err = stderr.read.strip
126
+ p_out = stdout.read.strip
127
+ end
128
+ rescue Errno::ENOENT
129
+ raise VagrantPlugins::Compose::Errors::PyComposeMissing
130
+ rescue Exception => e
131
+ raise VagrantPlugins::Compose::Errors::PyComposeError, :message => e.message
132
+ end
128
133
 
129
- if p_status.exitstatus != 0
130
- raise VagrantPlugins::Compose::Errors::PyComposeError, :message => p_err
131
- end
134
+ if p_status.exitstatus != 0
135
+ raise VagrantPlugins::Compose::Errors::PyComposeError, :message => p_err
136
+ end
132
137
 
133
- return p_out
134
- end
138
+ return p_out
139
+ end
135
140
 
136
141
  end
137
142
  end
@@ -1,5 +1,5 @@
1
1
  module Vagrant
2
2
  module Compose
3
- VERSION = "0.7.0"
3
+ VERSION = "0.7.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fabrizio Pandini
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-01 00:00:00.000000000 Z
11
+ date: 2016-11-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -92,7 +92,6 @@ files:
92
92
  - lib/vagrant/compose/version.rb
93
93
  - lib/vagrant/compose.rb
94
94
  - LICENCE
95
- - provisioning/group_vars/zookeeper.yml
96
95
  - Rakefile
97
96
  - README.md
98
97
  - vagrant-compose.gemspec
@@ -1,2 +0,0 @@
1
- ---
2
- x: 1