inprovise 0.2.17 → 0.2.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NzRlYjA0YmI2NjljZjU2YjcyMGFjNjE4NjY0MzI3MDBkMzgyMjdmNQ==
4
+ NTgyNGM2YjY2Y2IyODMxYjdiNTVmNjlmN2Y1N2U0NGE3ZmM0Yjk5Mg==
5
5
  data.tar.gz: !binary |-
6
- YTZhZGE4MWQ0ZmQ2M2Y1MTEyYTAxYjFmYjllZWE5ZjdjOTc2ZDVkNw==
6
+ NGFkYmE3ZDM0YWJhYjgxMjE0MjYxNDgyZTU2Y2IwODBhMGY2ZmI2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- MGFkYzNiZDg5OGEzYjc0MjZjYzIyNjM2M2QzMTIyZjVhZTdjMTQxOGIxYWNi
10
- YTI1ODJmOGE0MTRhMDg5MzQyYzAzZmRlZmM2YjVjZTc0OTE2N2EwY2ZmYWFk
11
- NGU4ZWQ0YTU0YTMwNzQ1Y2UxMjUyOGVhNDhkZTJjM2UwYmI3NGE=
9
+ YmNlMzUxYjMyNDhjYjc3OTgwZWVhMzk1NzRmNTRjMzA3YTMxODNjM2I4MmVl
10
+ YTdjYjhmMTMxOWIzNWM4ZGQwMzM4MDJjMTM2ODE2OWEyNzNkNWZhYWMyMGRk
11
+ NjY0ZjQ4ZDA1NmRkNWJlZjRjYjE3MGMxZDlkNWQwZjAyMDg0NDA=
12
12
  data.tar.gz: !binary |-
13
- ZTBmMTE4MTFlN2ZhMjc4M2QxNDdhNzg5MjllNmJkYjRmZDQ1OGQ5YTA2NTRj
14
- ODVkZmVkOTI5MDk2ZjE3NmIyY2QxZDNhZjBlMWRkYzQ1ZjNjM2ZhZmMxZGM4
15
- ZGFhZTAzNmY0ZGVjZmM1NzczYTYyNWViY2ZkNzQ5Njk3ODgwYTg=
13
+ ZjRjNjMzYzkzN2E4OTg3Y2QyNzI2N2QwZDllNjQxOTY2N2RiMDA5MDk2MDdj
14
+ YTNiMDc4ODQ0OTczNTNkYmNmYWM5YzE3MjU0ODMzOWMzNjlmNjRmOTAxN2Rl
15
+ ODhjMWJmZmZiZmRiNGYxZjYwMzg1YjYxYmE2YzQ3YWQ4MjllMTY=
@@ -15,9 +15,6 @@ Inprovise::CmdChannel.define('ssh') do
15
15
  super(node)
16
16
  @connection = nil
17
17
  @sftp = nil
18
- if @node.config.has_key?(:credentials) && @node.config[:credentials].has_key?(:'public-key')
19
- install_pubkey(@node.config[:credentials][:'public-key'])
20
- end
21
18
  end
22
19
 
23
20
  def close
@@ -136,58 +133,6 @@ Inprovise::CmdChannel.define('ssh') do
136
133
  end
137
134
  end
138
135
 
139
- def install_pubkey(pubkey_path)
140
- log_bak = @node.log
141
- begin
142
- @node.log_to(Inprovise::Logger.new(@node, 'ssh[init]'))
143
-
144
- # load public key
145
- pubkey = File.read(pubkey_path)
146
- # quit if already installed
147
- return if check_pubkey(pubkey)
148
-
149
- begin
150
- # create .ssh dir if necessary
151
- unless exists?('./.ssh')
152
- mkdir('./.ssh')
153
- set_permissions('./.ssh', 0755)
154
- end
155
- @node.log.remote("SFTP.APPEND: #{pubkey_path} -> ./.ssh/authorized_keys") if Inprovise.verbosity > 0
156
- sftp.file.open('./.ssh/authorized_keys', 'a') { |f| f.puts pubkey }
157
- # make sure the key file has the right permissions
158
- set_permissions('./.ssh/authorized_keys', 0644)
159
- rescue
160
- # using the SFTP option failed, let's try a more basic approach
161
- run('mkdir -p .ssh') # make sure the directory exists
162
- run('chmod 0755 ./.ssh') # and has the right permissions
163
- # upload pubkey file to remote temp file
164
- upload_path = "inprovise-upload-#{Digest::SHA1.file(pubkey_path).hexdigest}"
165
- upload(pubkey_path, upload_path)
166
- # concatenate temp file to ssh file
167
- run("cat #{upload_path} >> ./.ssh/authorized_keys")
168
- # remove temp file
169
- run("rm #{upload_path}")
170
- # make sure the key file has the right permissions
171
- run('chmod 0644 ./.ssh/authorized_keys')
172
- end
173
- ensure
174
- @node.log_to(log_bak)
175
- end
176
- end
177
-
178
- def check_pubkey(pubkey)
179
- # check if public key already configured
180
- if exists?('./.ssh/authorized_keys')
181
- auth_keys = begin
182
- content('./.ssh/authorized_keys')
183
- rescue
184
- run('cat ./.ssh/authorized_keys')
185
- end.split("\n")
186
- return auth_keys.any? { |key| key == pubkey }
187
- end
188
- false
189
- end
190
-
191
136
  def execute(cmd, forcelog=false)
192
137
  @node.log.remote("SSH: #{cmd}") if Inprovise.verbosity > 1 || forcelog
193
138
  output = ''
@@ -9,13 +9,6 @@ Inprovise::CmdHelper.define('cygwin', Inprovise::CmdHelper.implementations['linu
9
9
 
10
10
  def initialize(channel)
11
11
  super(channel)
12
- # only if this is *NOT* a sudo helper
13
- unless channel.node.user == admin_user
14
- if channel.node.config.has_key?(:credentials) && channel.node.config[:credentials].has_key?(:'public-key')
15
- # trigger sudo channel creation to have pubkey installed for admin as well
16
- sudo
17
- end
18
- end
19
12
  end
20
13
 
21
14
  # platform properties
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Inprovise
7
7
 
8
- VERSION = '0.2.17'
8
+ VERSION = '0.2.18'
9
9
 
10
10
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inprovise
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.17
4
+ version: 0.2.18
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Corino
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored