linecook-gem 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1394f08c49e9e0d3087096474ff4c203a7430cd6
4
- data.tar.gz: 8659d4cbe44597bf4d34b192615f6630674b728d
3
+ metadata.gz: 807017706c5a506cfb424b1ec39cd94b7c404c68
4
+ data.tar.gz: fa3b10d58e469b0b90c45bcc9ff83609e7a2302c
5
5
  SHA512:
6
- metadata.gz: d807b8c75dbaf23ac016efc1a759521a5952eef4e235db006c5627a9e2f013370c6e7b6876a1e70c20d9e75f3ff96609dc56cbce991f95d523bf97c0473cabff
7
- data.tar.gz: 3a9f30adbc6f4377dc3de19a498df2e1af17325abe989b80bc86b614f7bc16c9760afbb30f32f9571fe4015a76ab1585a1eae88eb660156dc132487a30f7e238
6
+ metadata.gz: a8b27d7bf3e905e3560f3febdac266db5304df8e951dd395f2cef086a4637e3ed2e4e5b17de9b7236458b7b0de798689b4ef10eec2fe81a51a4d35fff98ed60d
7
+ data.tar.gz: edac426ed6c88470c88621a6c4c5a7ee2b1da7a303e586f4d04d9c8d00603d68fa61e25f165d3c431253a11e996cf9ca6e3dad752a59851dfa60d8fe33ff23f6
@@ -24,26 +24,24 @@ module Linecook
24
24
 
25
25
  def encrypt_file(source, dest: nil, keypath: nil)
26
26
  dest ||= "/tmp/#{File.basename(source)}"
27
- capture("openssl enc -#{CIPHER} -out #{dest} -in #{source} -K #{@secret_key} -iv #{@iv}")
27
+ capture("openssl enc -#{CIPHER} -out #{dest} -in #{source} -pass 'pass:#{@secret_key}'", sudo: false)
28
28
  dest
29
29
  end
30
30
 
31
31
  def decrypt_file(source, dest: nil, keypath: nil)
32
32
  dest ||= "/tmp/#{File.basename(source)}-decrypted"
33
- capture("openssl enc -#{CIPHER} -out #{dest} -in #{source} -K #{@secret_key} -iv #{@iv} -d")
33
+ capture("openssl enc -#{CIPHER} -out #{dest} -in #{source} -pass pass:#{@secret_key}' -d", sudo: false)
34
34
  dest
35
35
  end
36
36
 
37
37
  def self.keygen
38
- iv = OpenSSL::Cipher::Cipher.new(CIPHER).random_iv.unpack('H*').first
39
38
  secret_key = Base64.encode64(OpenSSL::Random.random_bytes(KEY_BYTES)).unpack('H*').first
40
- "[:IV:#{iv}:KY:#{secret_key}]"
41
39
  end
42
40
 
43
41
  private
44
42
 
45
43
  def load_key
46
- @iv, @secret_key = Linecook.config[:aeskey].match(/\[:IV:(.+):KY:(.+)\]/m).captures
44
+ @secret_key = Linecook.config[:aeskey]
47
45
  end
48
46
  end
49
47
  end
@@ -23,7 +23,6 @@ module Linecook
23
23
  puts "Encrypting and uploading image #{path}"
24
24
  encrypted = Linecook::Crypto.new.encrypt_file(path)
25
25
  provider(profile).upload(encrypted)
26
- puts "Cleaning up encrypted tmp #{encrypted}"
27
26
  FileUtils.rm_f(encrypted)
28
27
  end
29
28
 
@@ -26,6 +26,8 @@ module Linecook
26
26
  build.ssh.run('sudo bash /tmp/chef_bootstrap')
27
27
  build.ssh.run('sudo rm -rf /etc/chef')
28
28
  build.ssh.stop_forwarding
29
+ Chefdepartie.stop
30
+ FileUtils.rm_rf(Cache.path)
29
31
  end
30
32
 
31
33
  private
@@ -56,11 +58,13 @@ module Linecook
56
58
  extend self
57
59
 
58
60
  def path
59
- FileUtils.mkdir_p(CACHE_PATH)
60
- cache_path = Dir.mktmpdir
61
- build
62
- copy(cache_path)
63
- cache_path
61
+ @cache_path ||= begin
62
+ FileUtils.mkdir_p(CACHE_PATH)
63
+ cache_path = Dir.mktmpdir
64
+ build
65
+ copy(cache_path)
66
+ cache_path
67
+ end
64
68
  end
65
69
 
66
70
  private
@@ -1,3 +1,3 @@
1
1
  module Linecook
2
- VERSION = '0.1.8'
2
+ VERSION = '0.1.9'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linecook-gem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dale Hamel