Skip to content

Commit

Permalink
Merge pull request #89 from skylerto/master
Browse files Browse the repository at this point in the history
Basic support for windows platform
  • Loading branch information
Jon Cowie committed Sep 4, 2018
2 parents d922a63 + a06dfe3 commit 9351db7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/provider_hab_package.rb
Expand Up @@ -90,7 +90,7 @@ def hab(*command)
if Gem::Requirement.new('>= 14.3.20').satisfied_by?(Gem::Version.new(Chef::VERSION))
shell_out!('hab', *command)
else
shell_out_with_timeout!(clean_array('hab', *command))
shell_out_with_timeout!(clean_array('hab', *command).join(' '))
end
rescue Errno::ENOENT
Chef::Log.fatal("'hab' binary not found, use the 'hab_install' resource to install it first")
Expand Down
6 changes: 3 additions & 3 deletions resources/config.rb
Expand Up @@ -55,14 +55,14 @@

tempfile = Tempfile.new(['hab_config', '.toml'])
command = [ 'hab', 'config', 'apply', opts, new_resource.service_group,
incarnation, tempfile.path ]
incarnation, tempfile.path ].flatten.compact.join(' ')
begin
tempfile.write(TOML::Generator.new(new_resource.config).body)
tempfile.close
if Gem::Requirement.new('>= 14.3.20').satisfied_by?(Gem::Version.new(Chef::VERSION))
shell_out!(*command)
shell_out!(command)
else
shell_out_compact!(*command)
shell_out_compact!(command)
end
ensure
tempfile.close
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/cookbooks/test/metadata.rb
Expand Up @@ -2,3 +2,4 @@
license 'Apache 2.0'
version '0.0.1'
depends 'habitat'
depends 'chocolatey'
15 changes: 15 additions & 0 deletions test/fixtures/cookbooks/test/recipes/win_config.rb
@@ -0,0 +1,15 @@
include_recipe 'chocolatey'
chocolatey_package 'habitat'
hab_package 'skylerto/splunkforwarder' do
version '7.0.3/20180418161444'
end

hab_config 'splunkforwarder.default' do
config(
directories: {
path: [
'C:/hab/pkgs/.../*.log',
],
}
)
end
5 changes: 5 additions & 0 deletions test/fixtures/cookbooks/test/recipes/win_package.rb
@@ -0,0 +1,5 @@
include_recipe 'chocolatey'
chocolatey_package 'habitat'
hab_package 'skylerto/splunkforwarder' do
version '7.0.3/20180418161444'
end

0 comments on commit 9351db7

Please sign in to comment.