mobilize-ssh 1.0.71 → 1.0.72

Sign up to get free protection for your applications and to get access to all the features.
@@ -34,9 +34,17 @@ module Mobilize
34
34
  return true if file_hash.keys.length>0
35
35
  end
36
36
 
37
+ def Ssh.set_key_permissions(key_path)
38
+ #makes sure permissions are set as appropriate for ssh key
39
+ "chmod a-rwx #{key_path}".bash
40
+ "chmod u+rw #{key_path}".bash
41
+ return true
42
+ end
43
+
37
44
  def Ssh.scp(node,from_path,to_path)
38
45
  name,key,port,user = Ssh.host(node).ie{|h| ['name','key','port','user'].map{|k| h[k]}}
39
46
  key_path = "#{Base.root}/#{key}"
47
+ Ssh.set_key_permissions(key_path)
40
48
  opts = {:port=>(port || 22),:keys=>key_path}
41
49
  if Ssh.needs_gateway?(node)
42
50
  gname,gkey,gport,guser = Ssh.gateway(node).ie{|h| ['name','key','port','user'].map{|k| h[k]}}
@@ -54,6 +62,7 @@ module Mobilize
54
62
  def Ssh.run(node,command,file_hash=nil,su_user=nil)
55
63
  name,key,port,user = Ssh.host(node).ie{|h| ['name','key','port','user'].map{|k| h[k]}}
56
64
  key_path = "#{Base.root}/#{key}"
65
+ Ssh.set_key_permissions(key_path)
57
66
  opts = {:port=>(port || 22),:keys=>key_path}
58
67
  su_user ||= user
59
68
  file_hash ||= {}
@@ -94,13 +103,7 @@ module Mobilize
94
103
  end
95
104
  end
96
105
  #delete remote dir if necessary
97
- if rem_dir
98
- del_cmd = "rm -rf #{rem_dir}"
99
- if su_user
100
- del_cmd = %{sudo su #{su_user} -c "#{del_cmd}"}
101
- end
102
- Ssh.run(node,del_cmd)
103
- end
106
+ Ssh.run(node,"rm -rf #{rem_dir}") if rem_dir
104
107
  result
105
108
  end
106
109
 
@@ -1,5 +1,5 @@
1
1
  module Mobilize
2
2
  module Ssh
3
- VERSION = "1.0.71"
3
+ VERSION = "1.0.72"
4
4
  end
5
5
  end
data/mobilize-ssh.gemspec CHANGED
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
- gem.add_runtime_dependency "mobilize-base","1.0.81"
19
+ gem.add_runtime_dependency "mobilize-base","1.0.82"
20
20
  gem.add_runtime_dependency "net-ssh"
21
21
  gem.add_runtime_dependency "net-scp"
22
22
  gem.add_runtime_dependency "net-ssh-gateway"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mobilize-ssh
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.71
4
+ version: 1.0.72
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: 2012-12-17 00:00:00.000000000 Z
12
+ date: 2012-12-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mobilize-base
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.0.81
21
+ version: 1.0.82
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.81
29
+ version: 1.0.82
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: net-ssh
32
32
  requirement: !ruby/object:Gem::Requirement