vagrant-opsworks 0.0.5 → 0.0.8

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: 766caa1de0d13b688ce42c9b608db05752182e67
4
- data.tar.gz: 02981e7a488c63fe05f42c5e242771b51f373ce9
3
+ metadata.gz: 9dd57f8c18a8b61cfdaf3f751859221cde75816d
4
+ data.tar.gz: edacca8d60558893cd1d72d1286e9a7b15e0103d
5
5
  SHA512:
6
- metadata.gz: 243fe0387d0ca9789ffafc4a66bffe8447094ffc12752c128a12326106a30bf44547a4c56003c11467bef5f68946cd585e217e9537a4d0f85796722bac6ee97b
7
- data.tar.gz: f57d48e251a93043b5133a6f21647c3ae2c32da4653e77a9b1b2bf158a807301fcd130ab0c71fcfb270234338b51f4e04b4fb2496646df5eab19fdffbd496fdb
6
+ metadata.gz: 53f7f35568d7abe63e824cd0a78cf5a9d41f33092aadd52b294de4c75fb9c8fe412acbe2d0101888f2902e4493ae711022fa696c7f6ae02cbfd77c4c5031fa9a
7
+ data.tar.gz: aaacc79f7cb8a27d3d83d95e9a2ca89c0a7bc392f0e6e6bbec407e807b6ffc2777fae364dd47a81fe66eac1359815b326e3ca873a73150b2a40c34a97750f0d5
@@ -1,5 +1,7 @@
1
1
  module VagrantPlugins
2
2
  module OpsWorks
3
+ require_relative 'custom_json'
4
+
3
5
  class Config < ::Vagrant.plugin('2', :config)
4
6
  # @return [Boolean]
5
7
  # disable use of OpsWorks in Vagrant
@@ -76,8 +78,8 @@ module VagrantPlugins
76
78
  @ignore_instances = Array.new if @ignore_instances == UNSET_VALUE
77
79
  @ignore_layers = Array.new if @ignore_layers == UNSET_VALUE
78
80
  @ignore_recipes = Array.new if @ignore_recipes == UNSET_VALUE
79
- @supplimental_json = Hash.new if @supplimental_json == UNSET_VALUE
80
- @supplimental_json = merge_hash({
81
+
82
+ default_json = VagrantPlugins::OpsWorks::CustomJson.new({
81
83
  :opsworks => {
82
84
  :agent_version => @agent_version,
83
85
  :ruby_version => '2.0.0',
@@ -94,10 +96,13 @@ module VagrantPlugins
94
96
  },
95
97
  },
96
98
  :sudoers => [{:name => 'vagrant'}]
97
- }, @supplimental_json)
99
+ })
100
+
101
+ @supplimental_json = default_json if @supplimental_json == UNSET_VALUE
102
+ @supplimental_json = default_json.deep_merge(@supplimental_json) unless @supplimental_json == UNSET_VALUE
98
103
  end
99
104
 
100
- # TODO: refactor hash merging logic to mixin
105
+ # TODO: implement proper merge handling
101
106
  # def merge(other)
102
107
  # super.tap do |result|
103
108
  # result.ignore_apps = Array.new if other.ignore_apps.nil?
@@ -129,28 +134,6 @@ module VagrantPlugins
129
134
  {'opsworks configuration' => errors}
130
135
  end
131
136
 
132
- protected
133
-
134
- def merge_hash(old, new)
135
- old = unsymbolize_keys(old)
136
- new = unsymbolize_keys(new)
137
-
138
- new.each_pair{|current_key,new_value|
139
- old_value = old[current_key]
140
-
141
- old[current_key] = if old_value.is_a?(Hash) && new_value.is_a?(Hash)
142
- merge_hash(old_value, new_value)
143
- else
144
- new_value
145
- end
146
- }
147
- old
148
- end
149
-
150
- def unsymbolize_keys(h)
151
- return Hash[h.map{ |k,v| [k.to_s, v] }]
152
- end
153
-
154
137
  end
155
138
  end
156
139
  end
@@ -2,6 +2,15 @@ module VagrantPlugins::OpsWorks
2
2
  require 'vagrant/util/hash_with_indifferent_access'
3
3
  class CustomJson < ::Vagrant::Util::HashWithIndifferentAccess
4
4
 
5
+ def initialize(hash={}, &block)
6
+ super(hash, &block)
7
+
8
+ self.each_pair do |k,v|
9
+ v = self.class.new(v) if v.is_a?(Hash)
10
+ self[k] = v
11
+ end
12
+ end
13
+
5
14
  def deep_merge(other_json, &block)
6
15
  dup.deep_merge!(other_json, &block)
7
16
  end
@@ -17,7 +17,7 @@ module VagrantPlugins::OpsWorks::Loader
17
17
  end
18
18
 
19
19
  env[:config].vm.provision :shell do |s|
20
- s.inline = "DEBIAN_FRONTEND=noninteractive apt-get -qq install acl &&setfacl -m o:rw $SSH_AUTH_SOCK && setfacl -m o:x $(dirname $SSH_AUTH_SOCK)"
20
+ s.inline = '[ -n "$SSH_AUTH_SOCK" ] && DEBIAN_FRONTEND=noninteractive apt-get -qq install acl && setfacl -m o:rw $SSH_AUTH_SOCK && setfacl -m o:x $(dirname $SSH_AUTH_SOCK)'
21
21
  end
22
22
 
23
23
  @app.pass(env)
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module OpsWorks
3
- VERSION = '0.0.5'
3
+ VERSION = '0.0.8'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-opsworks
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Buzonas