danarchy_deploy 0.2.8 → 0.2.9

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
  SHA256:
3
- metadata.gz: 637fb3a1e9810606d864cbc0acab785194ce1fd101c1d74b1135cda4cf489229
4
- data.tar.gz: 8886abdb6002348b7fe4fe1d9b27e90766bfd568b30513d246460b2c2dadd188
3
+ metadata.gz: 1cebdd523daec796bb3189d1fce8b0f48296e575a0c84ec731a3983acf856868
4
+ data.tar.gz: aaf5be0aa79434f6982051ab9472b868f591c4e0025a2fe076210fccf94fa4be
5
5
  SHA512:
6
- metadata.gz: 1bd45a91ea250c523e7ddaca5f8b06e91f8ebd52ede360389fb612354e383720b316f9652aa94400d6ec1204b02205b3556dcabf47842a17350e04c46389b1e9
7
- data.tar.gz: 74283e5e2b7ee9d6d3abb15791fc9a742c1e8329eba28d680185380e4682799749b13c848923f3c6b77b2c9ed3fa8585f3f8b0619289aecd11eae363737f9e12
6
+ metadata.gz: 0a08ce041b150b6033e6a6d644cd4f90682479fca8c214ede36c440e02eed573a3a9508ec432d219e9ba8097e73d901253c6ed1da9c12527c590f079dcf44395
7
+ data.tar.gz: ddbcf529c9b5a5612d3e6f455017e82fa98c870244fbfe6709e480bb07b9c787ffc5fd0ed53d686de796e3256646b309fa3dbb5493d4d9d55607fdf77b8ec8d9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ patch_0.2.9
2
+ - cleanup emerge --sync output
3
+ - change Date to Time
4
+ - fix hostnamectl set-hostname
5
+ - Fstab: skip formatting NFS mountpoints
6
+
1
7
  patch_0.2.8
2
8
  - Switch support from RVM to ASDF
3
9
  - users.rb: use Templater to handle authorized_users and sudoers
data/bin/danarchy_deploy CHANGED
@@ -1,7 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require_relative '../lib/danarchy_deploy'
3
3
  require 'danarchy_couchdb'
4
- require 'date'
5
4
  require 'optparse'
6
5
 
7
6
  deployment = nil
@@ -7,7 +7,7 @@ module DanarchyDeploy
7
7
  end
8
8
 
9
9
  class LetsEncrypt
10
- # DateTime.now > DateTime.parse(cert.grep(/Not After/).first.split(' : ').last) - 7
10
+ # Time.now > Time.parse(cert.grep(/Not After/).first.split(' : ').last) - 7
11
11
  end
12
12
  end
13
13
  end
@@ -10,7 +10,7 @@ module DanarchyDeploy
10
10
 
11
11
  tmparchive = false
12
12
  if !archive[:source] && archive[:data]
13
- archive[:source] = options[:deploy_dir] + "/.tmp_archive_#{DateTime.now.strftime("%Y%m%d_%H%M%S")}"
13
+ archive[:source] = options[:deploy_dir] + "/.tmp_archive_#{Time.now.strftime("%Y%m%d_%H%M%S")}"
14
14
  tmparchive = true
15
15
  data = DanarchyDeploy::Helpers.decode_base64(archive[:data])
16
16
  write_tmp_archive(archive[:source], data)
@@ -17,7 +17,7 @@ module DanarchyDeploy
17
17
 
18
18
  private
19
19
  def set_hostname(hostname)
20
- `hostnamectl hostname #{hostname}`
20
+ `hostnamectl set-hostname #{hostname}`
21
21
  end
22
22
  end
23
23
  end
@@ -60,7 +60,7 @@ module DanarchyDeploy
60
60
 
61
61
  private
62
62
  def set_hostname(hostname)
63
- `hostnamectl hostname #{hostname}`
63
+ `hostnamectl set-hostname #{hostname}`
64
64
  end
65
65
  end
66
66
  end
@@ -39,11 +39,7 @@ module DanarchyDeploy
39
39
  puts "\n > Formatting mountpoints"
40
40
 
41
41
  fstab[:mounts].each do |mount|
42
- fs_check = DanarchyDeploy::Helpers.run_command(
43
- "file -sL #{mount[:filesystem]}", options
44
- )
45
-
46
- if fs_check[:stdout] && fs_check[:stdout] =~ /.*data$/
42
+ if fs_check(mount, options) == true
47
43
  puts "\n > Formatting #{mount[:filesystem]}"
48
44
  mkfs = DanarchyDeploy::Helpers.run_command(
49
45
  "mkfs -t #{mount[:type]} #{mount[:filesystem]}", options
@@ -55,6 +51,20 @@ module DanarchyDeploy
55
51
  !Dir.exist?(mount[:mountpoint])
56
52
  end
57
53
  end
54
+
55
+ def self.fs_check(mount, options)
56
+ return false if mount[:type] =~ /^nfs/
57
+
58
+ fs_check = DanarchyDeploy::Helpers.run_command(
59
+ "file -sL #{mount[:filesystem]}", options
60
+ )
61
+
62
+ if fs_check[:stdout] && fs_check[:stdout] =~ /.*data$/
63
+ return true
64
+ else
65
+ return false
66
+ end
67
+ end
58
68
  end
59
69
  end
60
70
  end
@@ -49,18 +49,19 @@ module DanarchyDeploy
49
49
  end
50
50
 
51
51
  def self.emerge_sync(sync, options)
52
+ puts "\n > Gentoo Emerge Sync"
52
53
  if sync.nil?
53
- install_cron_template(sync, options)
54
+ install_sync_cron(sync, options)
54
55
  elsif sync == false
55
- puts "\nNot running emerge sync; set to: #{sync}"
56
- install_cron_template(sync, options)
56
+ puts "\n - Not running emerge sync; set to: #{sync}"
57
+ install_sync_cron(sync, options)
57
58
  elsif sync == true
58
59
  File.delete('/var/spool/cron/crontabs/portage') if File.exist?('/var/spool/cron/crontabs/portage')
59
60
  DanarchyDeploy::Helpers.run_command('emerge --sync &>/var/log/emerge-sync.log', options)
60
61
  elsif sync =~ /([0-9]{1,2}|\*|\@[a-z]{4,7})/i
61
- install_cron_template(sync, options)
62
+ install_sync_cron(sync, options)
62
63
  else
63
- puts "\nUnknown sync cron time: #{sync}. Not running emerge sync!"
64
+ puts "\n ! Unknown sync cron time: #{sync}. Not running emerge sync!"
64
65
  end
65
66
  end
66
67
 
@@ -73,7 +74,7 @@ module DanarchyDeploy
73
74
  end
74
75
  end
75
76
 
76
- def self.install_cron_template(sync, options)
77
+ def self.install_sync_cron(sync, options)
77
78
  templates = if sync.nil? || sync == false
78
79
  [
79
80
  {
@@ -21,7 +21,7 @@ module DanarchyDeploy
21
21
 
22
22
  private
23
23
  def set_hostname(hostname)
24
- `hostnamectl hostname #{hostname}`
24
+ `hostnamectl set-hostname #{hostname}`
25
25
  end
26
26
  end
27
27
  end
@@ -25,7 +25,7 @@ module DanarchyDeploy
25
25
  else
26
26
  puts "\n - Not installing packages."
27
27
  puts " |_ Packages selected: #{deployment[:packages].count}"
28
- puts " |_ Updates selected: #{deployment[:system][:update]}"
28
+ puts " |_ Install/Update: #{deployment[:system][:update]}"
29
29
  end
30
30
 
31
31
  puts "\n > #{deployment[:os].capitalize} System Updates"
@@ -35,7 +35,7 @@ module DanarchyDeploy
35
35
  puts updater_result[:stdout] if updater_result[:stdout]
36
36
  else
37
37
  puts "\n - Not running #{deployment[:os].capitalize} system updates."
38
- puts " |_ Updates selected: #{deployment[:system][:update]}"
38
+ puts " |_ Install/Update: #{deployment[:system][:update]}"
39
39
  end
40
40
 
41
41
  if install_result || updater_result
@@ -1,3 +1,3 @@
1
1
  module DanarchyDeploy
2
- VERSION = "0.2.8"
2
+ VERSION = "0.2.9"
3
3
  end
@@ -9,6 +9,7 @@ module DanarchyDeploy
9
9
  require_relative 'danarchy_deploy/templater'
10
10
  require_relative 'danarchy_deploy/users'
11
11
  require_relative 'danarchy_deploy/version'
12
+ require 'time'
12
13
 
13
14
  class LocalDeploy
14
15
  def self.new(deployment, options)
@@ -26,7 +27,7 @@ module DanarchyDeploy
26
27
  deployment = DanarchyDeploy::Users.new(deployment, options)
27
28
  deployment = DanarchyDeploy::Services::Init.new(deployment, options)
28
29
 
29
- deployment[:last_deploy] = DateTime.now.strftime("%Y/%m/%d %H:%M:%S")
30
+ deployment[:last_deploy] = Time.now.strftime("%Y/%m/%d %H:%M:%S")
30
31
  puts "\nFinished Local Deployment at #{deployment[:last_deploy]}!"
31
32
 
32
33
  if options[:deploy_file].end_with?('.json')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danarchy_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan James
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-07 00:00:00.000000000 Z
11
+ date: 2024-09-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danarchy_couchdb