dust-deploy 0.16.3 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,13 @@
1
1
  Changelog
2
2
  =============
3
3
 
4
+ 0.16.4
5
+ ------------
6
+
7
+ - adds support for RedHat to the mysql recipe
8
+ - fixes small bug in hash_check recipe
9
+
10
+
4
11
  0.16.3
5
12
  ------------
6
13
 
@@ -25,7 +25,7 @@ class HashCheck < Recipe
25
25
  ret = @node.exec("python -c \"import crypt; print(crypt.crypt('#{password}', '\\$#{method}\\$#{salt}\\$'));\"")
26
26
 
27
27
  unless ret[:exit_code] == 0
28
- return msg.failed('error during hash creation (is python installed?)')
28
+ return @node.messages.add('error during hash creation (is python installed?)').failed
29
29
  end
30
30
  if hash == ret[:stdout].chomp
31
31
  @node.messages.add("user #{user} has a weak password! (#{password})", :indent => 2).failed
@@ -1,9 +1,12 @@
1
1
  class Mysql < Recipe
2
2
  desc 'mysql:deploy', 'installs and configures mysql database'
3
3
  def deploy
4
- return unless @node.uses_apt? :quiet=>false
4
+ # apt/yum both use mysql-server
5
5
  @node.install_package 'mysql-server'
6
6
 
7
+ service = @node.uses_rpm? ? 'mysqld' : 'mysql'
8
+ config = @node.uses_rpm? ? '/etc/my.cnf' : '/etc/mysql/my.cnf'
9
+
7
10
  @config = default_config.deep_merge @config
8
11
 
9
12
  @node.messages.add("configuring mysql\n")
@@ -12,66 +15,91 @@ class Mysql < Recipe
12
15
  @config['mysqld']['innodb_buffer_pool_size'] ||= get_innodb_buffer_pool_size
13
16
  @node.messages.add("set innodb buffer pool to '#{@config['mysqld']['innodb_buffer_pool_size']}'", :indent => 2).ok
14
17
 
15
- @node.write '/etc/mysql/my.cnf', generate_my_cnf
18
+ @node.write(config, generate_my_cnf)
16
19
 
17
- @node.restart_service 'mysql' if options.restart?
18
- @node.reload_service 'mysql' if options.reload?
20
+ @node.restart_service(service) if options.restart?
21
+ @node.reload_service(service) if options.reload?
19
22
  end
20
23
 
21
24
  desc 'mysql:status', 'displays status of the mysql daemon'
22
25
  def status
23
26
  return unless @node.package_installed? 'mysql-server'
24
- @node.print_service_status 'mysql'
27
+ @node.print_service_status('mysql')
25
28
  end
26
29
 
27
30
 
28
31
  private
29
32
 
30
33
  def default_config
31
- { 'client' => {
34
+ my_cnf = {}
35
+
36
+ # overall defaults
37
+ my_cnf['mysqld'] = {
38
+ 'bind-address' => '127.0.0.1',
39
+ 'port' => 3306,
40
+ 'user' => 'mysql',
41
+ 'symbolic-links' => 0,
42
+ 'skip-external-locking' => true,
43
+ 'key_buffer' => '16M',
44
+ 'max_allowed_packet' => '16M',
45
+ 'thread_stack' => '192K',
46
+ 'thread_cache_size' => 8,
47
+ 'myisam-recover' => 'BACKUP',
48
+ 'query_cache_limit' => '1M',
49
+ 'query_cache_size' => '16M',
50
+ 'expire_logs_days' => 10,
51
+ 'max_binlog_size' => '100M',
52
+ 'innodb_file_per_table' => 1,
53
+ 'innodb_thread_concurrency' => 0,
54
+ 'innodb_flush_log_at_trx_commit' => 1,
55
+ 'innodb_additional_mem_pool_size' => '16M',
56
+ 'innodb_log_buffer_size' => '4M'
57
+ }
58
+
59
+ my_cnf['mysqldump'] = {
60
+ 'quick' => true,
61
+ 'quote-names' => true,
62
+ 'max_allowed_packet' => '16M'
63
+ }
64
+
65
+ my_cnf['mysql'] = {}
66
+
67
+ my_cnf['isamchk'] = {
68
+ 'key_buffer' => '16M'
69
+ }
70
+
71
+ # debian specific
72
+ if @node.uses_apt?
73
+ my_cnf['client'] = {
32
74
  'port' => 3306,
33
75
  'socket' => '/var/run/mysqld/mysqld.sock'
34
- },
35
- 'mysqld_safe' => {
76
+ }
77
+
78
+ my_cnf['mysqld_safe'] = {
36
79
  'socket' => '/var/run/mysqld/mysqld.sock',
37
80
  'nice' => 0
38
- },
39
- 'mysqld' => {
40
- 'bind-address' => '127.0.0.1',
41
- 'port' => 3306,
42
- 'user' => 'mysql',
43
- 'pid-file' => '/var/run/mysqld/mysqld.pid',
44
- 'socket' => '/var/run/mysqld/mysqld.sock',
45
- 'language' => '/usr/share/mysql/english',
46
- 'basedir' => '/usr',
47
- 'datadir' => '/var/lib/mysql',
48
- 'tmpdir' => '/tmp',
49
- 'skip-external-locking' => true,
50
- 'key_buffer' => '16M',
51
- 'max_allowed_packet' => '16M',
52
- 'thread_stack' => '192K',
53
- 'thread_cache_size' => 8,
54
- 'myisam-recover' => 'BACKUP',
55
- 'query_cache_limit' => '1M',
56
- 'query_cache_size' => '16M',
57
- 'expire_logs_days' => 10,
58
- 'max_binlog_size' => '100M',
59
- 'innodb_file_per_table' => 1,
60
- 'innodb_thread_concurrency' => 0,
61
- 'innodb_flush_log_at_trx_commit' => 1,
62
- 'innodb_additional_mem_pool_size' => '16M',
63
- 'innodb_log_buffer_size' => '4M'
64
- },
65
- 'mysqldump' => {
66
- 'quick' => true,
67
- 'quote-names' => true,
68
- 'max_allowed_packet' => '16M'
69
- },
70
- 'mysql' => {},
71
- 'isamchk' => {
72
- 'key_buffer' => '16M',
73
81
  }
74
- }
82
+
83
+ my_cnf['mysqld']['pid-file'] = '/var/run/mysqld/mysqld.pid'
84
+ my_cnf['mysqld']['socket'] = '/var/run/mysqld/mysqld.sock'
85
+ my_cnf['mysqld']['language'] = '/usr/share/mysql/english'
86
+ my_cnf['mysqld']['basedir'] = '/usr'
87
+ my_cnf['mysqld']['datadir'] = '/var/lib/mysql'
88
+ my_cnf['mysqld']['tmpdir'] = '/tmp'
89
+ end
90
+
91
+ # centos specific
92
+ if @node.uses_rpm?
93
+ my_cnf['mysqld_safe'] = {
94
+ 'log-error' => '/var/log/mysqld.log',
95
+ 'pid-file' => '/var/run/mysqld/mysqld.pid'
96
+ }
97
+
98
+ my_cnf['mysqld']['datadir'] = '/var/lib/mysql'
99
+ my_cnf['mysqld']['socket'] = '/var/lib/mysql/mysql.sock'
100
+ end
101
+
102
+ my_cnf
75
103
  end
76
104
 
77
105
  def get_innodb_buffer_pool_size
@@ -100,8 +128,8 @@ class Mysql < Recipe
100
128
  my_cnf << "\n"
101
129
  end
102
130
 
103
- # add includedir
104
- my_cnf << "!includedir /etc/mysql/conf.d/\n"
131
+ # add includedir on debian/ubuntu
132
+ my_cnf << "!includedir /etc/mysql/conf.d/\n" if @node.uses_apt?
105
133
  my_cnf
106
134
  end
107
135
  end
@@ -12,6 +12,7 @@ class Skel < Recipe
12
12
  Dir["#{@template_path}/.*"].each do |file|
13
13
  next unless File.file?(file)
14
14
  @node.deploy_file(file, "#{home}/#{File.basename(file)}", { :binding => binding, :indent => 2 })
15
+ @node.chown("#{user}:#{@node.get_gid(user)}", "#{home}/#{File.basename(file)}")
15
16
  end
16
17
  end
17
18
  end
@@ -1,3 +1,3 @@
1
1
  module Dust
2
- VERSION = "0.16.3"
2
+ VERSION = "0.16.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dust-deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.3
4
+ version: 0.16.4
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-10-10 00:00:00.000000000 Z
12
+ date: 2012-11-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json