syncwrap 2.8.3 → 2.9.0

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.
Files changed (73) hide show
  1. checksums.yaml +4 -4
  2. data/History.rdoc +37 -0
  3. data/Manifest.txt +1 -0
  4. data/README.rdoc +1 -1
  5. data/Rakefile +7 -0
  6. data/bin/syncwrap +1 -1
  7. data/lib/syncwrap.rb +1 -1
  8. data/lib/syncwrap/amazon_ec2.rb +1 -1
  9. data/lib/syncwrap/amazon_ws.rb +1 -1
  10. data/lib/syncwrap/base.rb +2 -2
  11. data/lib/syncwrap/change_key_listener.rb +1 -1
  12. data/lib/syncwrap/cli.rb +1 -1
  13. data/lib/syncwrap/component.rb +1 -1
  14. data/lib/syncwrap/components/amazon_linux.rb +1 -1
  15. data/lib/syncwrap/components/arch.rb +4 -4
  16. data/lib/syncwrap/components/bundle.rb +1 -1
  17. data/lib/syncwrap/components/bundled_iyyov_daemon.rb +1 -1
  18. data/lib/syncwrap/components/bundler_gem.rb +1 -1
  19. data/lib/syncwrap/components/centos.rb +1 -1
  20. data/lib/syncwrap/components/change_guard.rb +1 -1
  21. data/lib/syncwrap/components/commercial_jdk.rb +1 -1
  22. data/lib/syncwrap/components/cruby_vm.rb +12 -7
  23. data/lib/syncwrap/components/debian.rb +33 -9
  24. data/lib/syncwrap/components/etc_hosts.rb +1 -1
  25. data/lib/syncwrap/components/geminabox.rb +1 -1
  26. data/lib/syncwrap/components/hashdot.rb +1 -1
  27. data/lib/syncwrap/components/iyyov.rb +1 -1
  28. data/lib/syncwrap/components/iyyov_daemon.rb +1 -1
  29. data/lib/syncwrap/components/jruby_vm.rb +19 -8
  30. data/lib/syncwrap/components/lvm_cache.rb +9 -4
  31. data/lib/syncwrap/components/mdraid.rb +1 -1
  32. data/lib/syncwrap/components/network.rb +18 -1
  33. data/lib/syncwrap/components/open_jdk.rb +20 -7
  34. data/lib/syncwrap/components/postgresql.rb +18 -9
  35. data/lib/syncwrap/components/puma.rb +1 -1
  36. data/lib/syncwrap/components/qpid.rb +1 -1
  37. data/lib/syncwrap/components/rake_gem.rb +1 -1
  38. data/lib/syncwrap/components/rhel.rb +2 -2
  39. data/lib/syncwrap/components/run_user.rb +1 -1
  40. data/lib/syncwrap/components/source_tree.rb +1 -1
  41. data/lib/syncwrap/components/tarpit_gem.rb +1 -1
  42. data/lib/syncwrap/components/ubuntu.rb +1 -1
  43. data/lib/syncwrap/components/users.rb +4 -14
  44. data/lib/syncwrap/context.rb +1 -1
  45. data/lib/syncwrap/distro.rb +1 -1
  46. data/lib/syncwrap/formatter.rb +1 -1
  47. data/lib/syncwrap/git_help.rb +1 -1
  48. data/lib/syncwrap/hash_support.rb +1 -1
  49. data/lib/syncwrap/host.rb +1 -1
  50. data/lib/syncwrap/main.rb +1 -1
  51. data/lib/syncwrap/path_util.rb +1 -1
  52. data/lib/syncwrap/rsync.rb +1 -1
  53. data/lib/syncwrap/ruby_support.rb +1 -1
  54. data/lib/syncwrap/shell.rb +1 -1
  55. data/lib/syncwrap/sudoers.rb +67 -0
  56. data/lib/syncwrap/systemd.rb +29 -6
  57. data/lib/syncwrap/systemd_service.rb +2 -2
  58. data/lib/syncwrap/user_data.rb +6 -9
  59. data/lib/syncwrap/version_support.rb +1 -1
  60. data/lib/syncwrap/zone_balancer.rb +1 -1
  61. data/sync/postgresql/postgresql.conf.erb +3 -3
  62. data/sync/src/hashdot/profiles/jruby.hdp.erb +4 -0
  63. data/test/setup.rb +1 -4
  64. data/test/test_components.rb +2 -1
  65. data/test/test_context.rb +1 -1
  66. data/test/test_context_rput.rb +1 -1
  67. data/test/test_rsync.rb +1 -1
  68. data/test/test_shell.rb +1 -1
  69. data/test/test_space.rb +1 -1
  70. data/test/test_space_main.rb +1 -1
  71. data/test/test_version_support.rb +1 -1
  72. data/test/test_zone_balancer.rb +1 -1
  73. metadata +8 -7
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -19,14 +19,37 @@ module SyncWrap
19
19
  # Support module for the systemd service manager, PID 1
20
20
  module SystemD
21
21
 
22
- # Run systemd `systemctl` command with args via sudo as root. A
23
- # trailing hash is interpreted as options and passed to
22
+ # Run systemd `systemctl` command with args via sudo. If the first
23
+ # arg is 'status', defer to #systemctl_status. A trailing hash is
24
+ # interpreted as options and passed to sudo. Since systemctl
25
+ # returns non-zero for a variety of normal conditions, the :accept
26
+ # option can be passed to account for these, as well as :error =>
27
+ # false.
28
+ def systemctl( *args )
29
+ opts = args.last.is_a?( Hash ) && args.pop || {}
30
+ args.flatten!
31
+ if args.first == 'status'
32
+ args.shift
33
+ systemctl_status( *args, opts )
34
+ else
35
+ sudo( "systemctl #{args.join ' '}", opts )
36
+ end
37
+ end
38
+
39
+ # Run `systemctl status` via sudo, with special case stripping of
40
+ # whitespace from the end of line output via a sed filter. This is
41
+ # not an issue with an interactive terminal because output is
42
+ # piped to pager (less), apparently with '--chop-long-lines'.
43
+ #
44
+ # A trailing hash is interpreted as options and passed to
24
45
  # sudo. Since systemctl returns non-zero for a variety of normal
25
46
  # conditions, the :accept option can be passed to account for
26
47
  # these, as well as :error => false.
27
- def systemctl( *args )
28
- opts = args.last.is_a?( Hash ) && args.pop || {}
29
- sudo( "systemctl #{args.join ' '}", opts )
48
+ def systemctl_status( *units )
49
+ opts = units.last.is_a?( Hash ) && units.pop || {}
50
+ sudo( <<-SH, opts )
51
+ systemctl status #{units.join ' '} | sed -E -e 's/\\s+$//'
52
+ SH
30
53
  end
31
54
 
32
55
  # Expand given shortname to "shortname.service" as used for the
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -112,7 +112,7 @@ module SyncWrap
112
112
  # is also disabled, which may be relevent for merged commands.
113
113
  def status
114
114
  require_systemd_service!
115
- systemctl( 'status', *systemd_units, error: false, accept: [0,1,2,3] )
115
+ systemctl_status( *systemd_units, error: false, accept: [0,1,2,3] )
116
116
  end
117
117
 
118
118
  protected
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -14,23 +14,20 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
+ require 'syncwrap/sudoers'
18
+
17
19
  module SyncWrap
18
20
 
19
21
  # Utility methods for generating scripts to pass as user data.
20
22
  module UserData
23
+ extend Sudoers
21
24
 
22
25
  private
23
26
 
24
27
  # Returns an sh script to allow no password, no tty sudo for a
25
28
  # specified user by writing a file to /etc/sudoers.d/<user>
26
- def no_tty_sudoer( user )
27
- script = <<-SH
28
- #!/bin/sh -e
29
- echo '#{user} ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/#{user}
30
- echo 'Defaults:#{user} !requiretty' >> /etc/sudoers.d/#{user}
31
- chmod 440 /etc/sudoers.d/#{user}
32
- SH
33
- script.split( "\n" ).map( &:strip ).join( "\n" )
29
+ def no_tty_sudoer( user, opts = {} )
30
+ self.sudoers_d_script( user, opts )
34
31
  end
35
32
 
36
33
  module_function :no_tty_sudoer
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You may
@@ -38,7 +38,7 @@
38
38
  # option or PGDATA environment variable, represented here as ConfigDir.
39
39
 
40
40
  <% if pg_specify_etc_config %>
41
- data_directory = '/var/lib/postgresql/<%= pg_version %>/main'
41
+ data_directory = '<%= pg_data_dir %>'
42
42
  # use data in another directory
43
43
  # (change requires restart)
44
44
  hba_file = '/etc/postgresql/<%= pg_version %>/main/pg_hba.conf'
@@ -175,7 +175,7 @@ max_stack_depth = <%= max_stack_depth %> # min 100kB
175
175
  #bgwriter_delay = 200ms # 10-10000ms between rounds
176
176
  #bgwriter_lru_maxpages = 100 # 0-1000 max buffers written/round
177
177
  #bgwriter_lru_multiplier = 2.0 # 0-10.0 multiplier on buffers scanned/round
178
- #bgwriter_flush_after = 0 # 0 disables,
178
+ #bgwriter_flush_after = 0 # measured in pages, 0 disables,
179
179
  # default is 512kB on linux, 0 otherwise (9.6+)
180
180
 
181
181
  # - Asynchronous Behavior -
@@ -186,7 +186,7 @@ effective_io_concurrency = <%= effective_io_concurrency %>
186
186
  #max_parallel_workers_per_gather = 0 # taken from max_worker_processes (9.6+)
187
187
  #old_snapshot_threshold = -1 # 1min-60d; -1 disables; 0 is immediate (9.6+)
188
188
  # (change requires restart)
189
- #backend_flush_after = 0 # 0 disables, default is 0
189
+ #backend_flush_after = 0 # measured in pages, 0 disables
190
190
 
191
191
  #------------------------------------------------------------------------------
192
192
  # WRITE AHEAD LOG
@@ -10,4 +10,8 @@ jruby.bindir = <%= local_root %>/bin
10
10
  hashdot.profile += jruby-common
11
11
 
12
12
  # Rubygems Home (Install)
13
+ <% if jruby_gem_home_prop? %>
13
14
  jruby.gem.home = <%= local_root %>/lib/jruby/gems
15
+ <% else %>
16
+ hashdot.env.GEM_HOME = <%= local_root %>/lib/jruby/gems
17
+ <% end %>
data/test/setup.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  #--
2
- # Copyright (c) 2011-2016 David Kellum
2
+ # Copyright (c) 2011-2017 David Kellum
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License"); you
5
5
  # may not use this file except in compliance with the License. You
@@ -14,10 +14,7 @@
14
14
  # permissions and limitations under the License.
15
15
  #++
16
16
 
17
- require 'rubygems'
18
17
  require 'bundler/setup'
19
-
20
- require 'minitest/unit'
21
18
  require 'minitest/autorun'
22
19
 
23
20
  begin
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
@@ -40,6 +40,7 @@ module SyncWrap
40
40
  [ [ RHEL, CommercialJDK ],
41
41
  [ Debian ],
42
42
  [ Debian, CRubyVM ],
43
+ [ Debian, OpenJDK, JRubyVM, jruby_version: '9.1.12.0' ],
43
44
  [ CentOS, CRubyVM ],
44
45
  [ Arch, CRubyVM ],
45
46
  [ EtcHosts ],
data/test/test_context.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
data/test/test_rsync.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
data/test/test_shell.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
data/test/test_space.rb CHANGED
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
@@ -2,7 +2,7 @@
2
2
  #.hashdot.profile += jruby-shortlived
3
3
 
4
4
  #--
5
- # Copyright (c) 2011-2016 David Kellum
5
+ # Copyright (c) 2011-2017 David Kellum
6
6
  #
7
7
  # Licensed under the Apache License, Version 2.0 (the "License"); you
8
8
  # may not use this file except in compliance with the License. You
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syncwrap
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.3
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Kellum
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-31 00:00:00.000000000 Z
11
+ date: 2017-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: term-ansicolor
@@ -98,28 +98,28 @@ dependencies:
98
98
  requirements:
99
99
  - - "~>"
100
100
  - !ruby/object:Gem::Version
101
- version: 5.8.4
101
+ version: 5.9.1
102
102
  type: :development
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 5.8.4
108
+ version: 5.9.1
109
109
  - !ruby/object:Gem::Dependency
110
110
  name: rdoc
111
111
  requirement: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 4.0.1
115
+ version: 4.3.0
116
116
  type: :development
117
117
  prerelease: false
118
118
  version_requirements: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 4.0.1
122
+ version: 4.3.0
123
123
  - !ruby/object:Gem::Dependency
124
124
  name: rjack-tarpit
125
125
  requirement: !ruby/object:Gem::Requirement
@@ -213,6 +213,7 @@ files:
213
213
  - lib/syncwrap/rsync.rb
214
214
  - lib/syncwrap/ruby_support.rb
215
215
  - lib/syncwrap/shell.rb
216
+ - lib/syncwrap/sudoers.rb
216
217
  - lib/syncwrap/systemd.rb
217
218
  - lib/syncwrap/systemd_service.rb
218
219
  - lib/syncwrap/user_data.rb
@@ -284,7 +285,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
284
285
  version: '0'
285
286
  requirements: []
286
287
  rubyforge_project:
287
- rubygems_version: 2.6.6
288
+ rubygems_version: 2.6.10
288
289
  signing_key:
289
290
  specification_version: 4
290
291
  summary: A rather direct provisioning and deployment system in ruby, bash over ssh,