mofa 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/mofa/upload_cmd.rb +13 -3
- data/lib/mofa/version.rb +1 -1
- metadata +2 -2
data/lib/mofa/upload_cmd.rb
CHANGED
@@ -43,16 +43,26 @@ class UploadCmd < MofaCmd
|
|
43
43
|
puts "Uploading cookbook pkg #{cookbook.pkg_name} to binrepo import folder #{Mofa::Config.config['binrepo_host']}:#{Mofa::Config.config['binrepo_import_dir']}..."
|
44
44
|
|
45
45
|
fail unless binrepo_up?
|
46
|
+
import_dir = Mofa::Config.config['binrepo_import_dir']
|
47
|
+
|
48
|
+
# if the upload target is not a proper binrepo with a designated ".../import" folder -> create the "right" folder structure
|
49
|
+
unless Mofa::Config.config['binrepo_import_dir'].match(/import$/)
|
50
|
+
Net::SSH.start(Mofa::Config.config['binrepo_host'], Mofa::Config.config['binrepo_ssh_user'], :keys => [Mofa::Config.config['binrepo_ssh_keyfile']], :port => Mofa::Config.config['binrepo_ssh_port'], :verbose => :error) do |ssh|
|
51
|
+
puts "Remotely creating target dir \"#{import_dir}/#{cookbook.name}/#{cookbook.version}\""
|
52
|
+
out = ssh_exec!(ssh, "[ -d #{import_dir}/#{cookbook.name}/#{cookbook.version} ] || mkdir -p #{import_dir}/#{cookbook.name}/#{cookbook.version}")
|
53
|
+
fail "ERROR (#{out[0]}): #{out[2]}" if out[0] != 0
|
54
|
+
import_dir = "#{import_dir}/#{cookbook.name}/#{cookbook.version}"
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
46
58
|
begin
|
47
59
|
Net::SFTP.start(Mofa::Config.config['binrepo_host'], Mofa::Config.config['binrepo_ssh_user'], :keys => [Mofa::Config.config['binrepo_ssh_keyfile']], :port => Mofa::Config.config['binrepo_ssh_port'], :verbose => :error) do |sftp|
|
48
|
-
sftp.upload!("#{cookbook.pkg_dir}/#{cookbook.pkg_name}", "#{
|
60
|
+
sftp.upload!("#{cookbook.pkg_dir}/#{cookbook.pkg_name}", "#{import_dir}/#{cookbook.pkg_name}")
|
49
61
|
end
|
50
62
|
puts "OK."
|
51
63
|
rescue RuntimeError => e
|
52
64
|
puts "Error: #{e.message}"
|
53
65
|
raise "Failed to upload cookbook #{cookbook.name}!"
|
54
66
|
end
|
55
|
-
|
56
67
|
end
|
57
|
-
|
58
68
|
end
|
data/lib/mofa/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-04-
|
12
|
+
date: 2015-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|