danarchy_deploy 0.2.10 → 0.2.11

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
  SHA256:
3
- metadata.gz: bf92e113ddbc42b8b0ce95baf0a4fe1652d1f51e66c749ef1b073c38f92deb83
4
- data.tar.gz: 9badea3a6da5ccec2d5f3c481211533abc3a46b53493611b4c945905e6f960ae
3
+ metadata.gz: e323bccc146729696cefbbe7783e779ccfee0c3e2f58c73149c64862dd1f1c95
4
+ data.tar.gz: 45602e1b2852556ab4cb48324af4b8bb25e580aca57646a006df08f20841d495
5
5
  SHA512:
6
- metadata.gz: 97ff0fee694f105fe796e0be5e73b40e44fe9aff9f63b28e4aff327bfcae4573420f90ea92e3b93bbc8f168abb4e0ab1a3dcfb532e2ef9ab0b99e15f5fde82ba
7
- data.tar.gz: 43ce70a9b2d80697feaaee119ebbb5dbe93f6e2270fb381718ccef0a97f29dd041fa80c54372119a14553f748e76b632a86e8dacb48eac14c76faacd54f0dfa5
6
+ metadata.gz: 76aca576a0734fbed266ea5c14070276019c73aa3e4d9671fde21eacd1362cd23cae7faa17df62132d3cdccf0b61f25994163b35b97e88978e79cd7c0003cb20
7
+ data.tar.gz: 43a9f174a9e1048546c17a6a8b88dbc6940d419fa087a1e3acb3d1aaf88c98fb3b1d2e6eb2bf60037ce070825fb7581fc1d907169cf1d2ce14e3dc0bb7bb64fa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ patch_0.2.11
2
+ - gentoo: fix portage cron permissions
3
+ - restructure bin/exe dirs, update gemspec
4
+ - cleanup emerge --sync tmpdir on failure
5
+
1
6
  patch_0.2.10
2
7
  - fix set_hostname in debian, centos, opensuse
3
8
 
@@ -0,0 +1,24 @@
1
+
2
+ module DanarchyDeploy
3
+ module System
4
+ class BSD
5
+ def self.new(deployment, options)
6
+ puts "\n" + self.name
7
+ puts 'BSD detected! Using pkg.'
8
+
9
+ set_hostname(deployment[:hostname]) if !options[:pretend]
10
+ installer = 'pkg install -y '
11
+ update = 'pkg upgrade -y '
12
+ cleaner = 'pkg clean -y '
13
+
14
+ puts "\n Updating Pkg repos..."
15
+ DanarchyDeploy::Helpers.run_command('pkg update -q',options)
16
+ [installer, updater, cleaner]
17
+ end
18
+
19
+ private
20
+ def self.set_hostname(hostname)
21
+ `hostname #{hostname}`
22
+ end
23
+ end
24
+ end
@@ -37,8 +37,8 @@ module DanarchyDeploy
37
37
 
38
38
  private
39
39
  def self.emerge_sync_in_progress
40
- repo_path = `emerge --info | grep location`.chomp.split(': ').last
41
- Dir.exist?(repo_path + '/.tmp-unverified-download-quarantine')
40
+ @repo_path = `emerge --info | grep location`.chomp.split(': ').last
41
+ Dir.exist?(@repo_path + '/.tmp-unverified-download-quarantine')
42
42
  end
43
43
 
44
44
  def self.emerge_sync_wait
@@ -57,7 +57,14 @@ module DanarchyDeploy
57
57
  install_sync_cron(sync, options)
58
58
  elsif sync == true
59
59
  File.delete('/var/spool/cron/crontabs/portage') if File.exist?('/var/spool/cron/crontabs/portage')
60
- DanarchyDeploy::Helpers.run_command('emerge --sync &>/var/log/emerge-sync.log', options)
60
+ begin
61
+ DanarchyDeploy::Helpers.run_command('emerge --sync &>/var/log/emerge-sync.log', options)
62
+ ensure
63
+ if Dir.exist?("#{@repo_path}/.tmp-unverified-download-quarantine")
64
+ puts "\n ! emerge --sync may have failed: cleaning up tmp path."
65
+ DanarchyDeploy::Helpers.run_command("rm -rf #{@repo_path}/.tmp-unverified-download-quarantine", options)
66
+ end
67
+ end
61
68
  elsif sync =~ /([0-9]{1,2}|\*|\@[a-z]{4,7})/i
62
69
  install_sync_cron(sync, options)
63
70
  else
@@ -75,50 +82,48 @@ module DanarchyDeploy
75
82
  end
76
83
 
77
84
  def self.install_sync_cron(sync, options)
78
- templates = if sync.nil? || sync == false
79
- [
80
- {
81
- target: '/var/spool/cron/crontabs/portage',
82
- remove: true
83
- }
84
- ]
85
- else
86
- [
87
- {
88
- source: 'builtin::system/crontab.erb',
89
- target: '/var/spool/cron/crontabs/portage',
90
- dir_perms: {
91
- owner: 'root',
92
- group: 'crontab',
93
- mode: '1730'
94
- },
95
- file_perms: {
96
- owner: 'portage',
97
- group: 'crontab',
98
- mode: '0600'
99
- },
100
- variables: {
101
- shell: '/bin/bash',
102
- path: '/usr/local/sbin:/usr/local/bin:/usr/bin',
103
- env: '',
104
- jobs: [
105
- {
106
- schedule: sync,
107
- command: 'emerge --sync &>/var/log/emerge-sync.log'
108
- },
109
- {
110
- schedule: '@daily',
111
- command: 'eclean-dist &>/dev/null'
112
- },
113
- {
114
- schedule: '@daily',
115
- command: 'eclean-pkg &>/dev/null'
116
- }
117
- ]
118
- }
119
- }
120
- ]
121
- end
85
+ templates = Array.new
86
+ if sync.nil? || sync == false
87
+ DanarchyDeploy::Helpers.run_command(
88
+ 'id portage | grep cron >/dev/null && usermod -r -G cron portage',
89
+ options)
90
+
91
+ templates.push({ target: '/var/spool/cron/crontabs/portage',
92
+ remove: true })
93
+ else
94
+ DanarchyDeploy::Helpers.run_command(
95
+ 'id portage | grep cron >/dev/null || usermod -a -G cron portage',
96
+ options)
97
+
98
+ # User must be a member of the 'cron' group.
99
+ # User's actual crontab file is chown'd as ${user}:crontab
100
+ templates.push({ source: 'builtin::system/crontab.erb',
101
+ target: '/var/spool/cron/crontabs/portage',
102
+ file_perms: {
103
+ owner: 'portage',
104
+ group: 'crontab',
105
+ mode: '0600'
106
+ },
107
+ variables: {
108
+ shell: '/bin/bash',
109
+ path: '/usr/local/sbin:/usr/local/bin:/usr/bin',
110
+ env: '',
111
+ jobs: [
112
+ {
113
+ schedule: sync,
114
+ command: 'emerge --sync &>/var/log/emerge-sync.log'
115
+ },
116
+ {
117
+ schedule: '@daily',
118
+ command: 'eclean-dist &>/dev/null'
119
+ },
120
+ {
121
+ schedule: '@daily',
122
+ command: 'eclean-pkg &>/dev/null'
123
+ }
124
+ ]
125
+ } })
126
+ end
122
127
 
123
128
  DanarchyDeploy::Templater.new(templates, options)
124
129
  end
@@ -1,3 +1,3 @@
1
1
  module DanarchyDeploy
2
- VERSION = "0.2.10"
2
+ VERSION = "0.2.11"
3
3
  end
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.10
4
+ version: 0.2.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan James
8
8
  autorequire:
9
- bindir: bin
9
+ bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-12 00:00:00.000000000 Z
11
+ date: 2024-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: danarchy_couchdb
@@ -71,27 +71,19 @@ description: DanarchyDeploy intends to simplify Gentoo Linux (and other distro)
71
71
  email:
72
72
  - dan@danarchy.me
73
73
  executables:
74
- - console-dd
75
74
  - danarchy_deploy
76
- - setup-dd
77
75
  extensions: []
78
76
  extra_rdoc_files: []
79
77
  files:
80
78
  - ".asdf_versions.json"
81
- - ".gitignore"
82
79
  - ".rspec"
83
80
  - ".tool-versions"
84
81
  - ".travis.yml"
85
82
  - CHANGELOG.md
86
- - Gemfile
87
- - Gemfile.lock
88
83
  - LICENSE.txt
89
84
  - README.md
90
85
  - Rakefile
91
- - bin/console-dd
92
- - bin/danarchy_deploy
93
- - bin/setup-dd
94
- - danarchy_deploy.gemspec
86
+ - exe/danarchy_deploy
95
87
  - lib/danarchy_deploy.rb
96
88
  - lib/danarchy_deploy/applicator.rb
97
89
  - lib/danarchy_deploy/applicator/nginx.rb
@@ -117,6 +109,7 @@ files:
117
109
  - lib/danarchy_deploy/services/mysql/new_server.rb
118
110
  - lib/danarchy_deploy/services/mysql/privileges.rb
119
111
  - lib/danarchy_deploy/system.rb
112
+ - lib/danarchy_deploy/system/bsd.rb
120
113
  - lib/danarchy_deploy/system/centos.rb
121
114
  - lib/danarchy_deploy/system/cryptsetup.rb
122
115
  - lib/danarchy_deploy/system/debian.rb
data/.gitignore DELETED
@@ -1,12 +0,0 @@
1
- *~
2
- /.bundle/
3
- /.yardoc
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
-
11
- # rspec failure tracking
12
- .rspec_status
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- # git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in danarchy_deploy.gemspec
6
- gemspec
data/Gemfile.lock DELETED
@@ -1,27 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- danarchy_deploy (0.2.8)
5
- danarchy_couchdb (~> 0.1)
6
- mongo (~> 2.20)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- bson (5.0.1)
12
- danarchy_couchdb (0.1.3)
13
- mongo (2.20.1)
14
- bson (>= 4.14.1, < 6.0.0)
15
- rake (13.2.1)
16
-
17
- PLATFORMS
18
- ruby
19
- x86_64-linux
20
-
21
- DEPENDENCIES
22
- bundler (~> 2.5)
23
- danarchy_deploy!
24
- rake (~> 13.0)
25
-
26
- BUNDLED WITH
27
- 2.5.11
data/bin/console-dd DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "danarchy_deploy"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start(__FILE__)
data/bin/setup-dd DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,37 +0,0 @@
1
-
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "danarchy_deploy/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "danarchy_deploy"
8
- spec.version = DanarchyDeploy::VERSION
9
- spec.authors = ["Dan James"]
10
- spec.email = ["dan@danarchy.me"]
11
-
12
- spec.summary = %q{Pushes deployments locally or remotely based on a JSON/YAML/CouchDB template.}
13
- spec.description = %q{DanarchyDeploy intends to simplify Gentoo Linux (and other distro) deployments down to a single template from an input JSON or YAML file, or from a CouchDB file.}
14
- spec.homepage = "https://github.com/danarchy85/danarchy_deploy"
15
- spec.license = "MIT"
16
-
17
- if spec.respond_to?(:metadata)
18
- spec.metadata["allowed_push_host"] = "https://rubygems.org"
19
- else
20
- raise "RubyGems 2.0 or newer is required to protect against " \
21
- "public gem pushes."
22
- end
23
-
24
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
- f.match(%r{^(test|spec|features)/})
26
- end
27
- spec.bindir = "bin"
28
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
29
- spec.require_paths = ["lib"]
30
-
31
- spec.add_dependency 'danarchy_couchdb', '~> 0.1'
32
-
33
- spec.add_development_dependency 'bundler', '~> 2.5'
34
- spec.add_development_dependency 'rake', '~> 13.0'
35
-
36
- spec.add_runtime_dependency 'mongo', '~> 2.20'
37
- end
File without changes