luban 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 555b9db7bfefbf548122ebead92affe65ed5269a
4
- data.tar.gz: bd4b6318133e7950e21e6c52d17fab5ebe0f1b56
3
+ metadata.gz: 89d11fd53f23fcf4561d6f6da521b1364110a2b5
4
+ data.tar.gz: 245fd0714c4b105a2eeedecc31c1517ad4d3bdf3
5
5
  SHA512:
6
- metadata.gz: af4f00a1aa72e2e61550a0104274e33f3af3a7be6e5dbd19b861422a9022dac1a5a2107af235f19b98894d72c80bbba9fc85b05f3c893d068107e041ad750e6a
7
- data.tar.gz: 7d5c2fc63d7b3652588df65fab8261be9ae05266c0691067d1e03d4a199cb20f1b475552d8d8edc6aeb3cef12570b5703dc77370b414778fa0c9f80f2aaf1baa
6
+ metadata.gz: 6559e03834e6972fe23db6837effed6b77f29157eb2a4dfc8de40df7c7f240b3091480696fb27eb89638ff1689a80904d7f7ae04bde189bd3f0e3bd15917d875
7
+ data.tar.gz: 3c8a3df7d6f64cec2d5f7209284ca2c804e1c725cb9f40f1ee5ca8f0128e444cc00107a55ea25213c86808d294b49c879c4d5eee7223f654f0986dc73476d137
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Change log
2
2
 
3
+ ## Version 0.9.6 (Oct 18, 2016)
4
+
5
+ Minor enhancements:
6
+ * Added logrotate configuration template for cronjobs in deployment application skeleton
7
+
8
+ Bug fixes:
9
+ * Checked authorization for all public keys before setting up promptless authentication
10
+ * Especially useful for multiple public keys passed in to setup promptless authentication
11
+
3
12
  ## Version 0.9.5 (Oct 18, 2016)
4
13
 
5
14
  New features:
@@ -2,6 +2,12 @@ module Luban
2
2
  module Deployment
3
3
  class Application
4
4
  class Authenticator < Luban::Deployment::Worker::Base
5
+ def public_keys
6
+ @public_keys = task.opts.public_keys || []
7
+ @public_keys.uniq!
8
+ @public_keys
9
+ end
10
+
5
11
  def private_key_file_name
6
12
  @private_key_file_name ||= "id_#{authen_key_type}"
7
13
  end
@@ -64,7 +70,7 @@ module Luban
64
70
  def promptless_authen_enabled?
65
71
  origin_auth_methods = host.ssh_options[:auth_methods]
66
72
  host.ssh_options[:auth_methods] = %w(publickey)
67
- capture('echo ok') == 'ok'
73
+ capture('echo ok') == 'ok' and keys_authorzied?
68
74
  rescue Net::SSH::AuthenticationFailed
69
75
  false
70
76
  ensure
@@ -84,8 +90,6 @@ module Luban
84
90
  end
85
91
 
86
92
  def add_authorized_keys
87
- public_keys = task.opts.public_keys || []
88
- public_keys.uniq!
89
93
  if file?(authorized_keys_file_path)
90
94
  public_keys.each { |k| add_authorized_key(k) unless key_authorized?(k) }
91
95
  else
@@ -100,6 +104,14 @@ module Luban
100
104
  def key_authorized?(key)
101
105
  test("grep -v \"^#\" #{authorized_keys_file_path} | grep -Fxq \"#{key}\"")
102
106
  end
107
+
108
+ def keys_authorzied?
109
+ if file?(authorized_keys_file_path)
110
+ public_keys.all? { |k| key_authorized?(k) }
111
+ else
112
+ false
113
+ end
114
+ end
103
115
  end
104
116
  end
105
117
  end
@@ -0,0 +1,15 @@
1
+ # Crontab logrotate configuration
2
+
3
+ <%%= log_path.join('cron.*.log') %> {
4
+ hourly
5
+ maxsize 5M
6
+ maxage 14
7
+ rotate <%%= 14 * 24 * (60 / 10) %>
8
+ missingok
9
+ compress
10
+ compresscmd <%%= `which gzip`.chomp %>
11
+ delaycompress
12
+ dateext
13
+ dateformat -%Y%m%d-%H%M%S
14
+ olddir archived_logs
15
+ }
@@ -1,5 +1,5 @@
1
1
  module Luban
2
2
  module Deployment
3
- VERSION = "0.9.5"
3
+ VERSION = "0.9.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: luban
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rubyist Lei
@@ -161,6 +161,7 @@ files:
161
161
  - lib/luban/deployment/templates/application/config/deploy/__stage/profile/.gitkeep
162
162
  - lib/luban/deployment/templates/application/config/deploy/__stage/templates/.gitkeep
163
163
  - lib/luban/deployment/templates/application/config/templates/profile/.gitkeep
164
+ - lib/luban/deployment/templates/application/config/templates/profile/app/crontab.logrotate.erb.erb
164
165
  - lib/luban/deployment/templates/application/lib/application.rb.erb
165
166
  - lib/luban/deployment/templates/crontab.erb
166
167
  - lib/luban/deployment/templates/crontab_footer.erb