landscape-turner 1.5.0 → 1.6.0

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: 4c4fe0a8a8c79aa180889465f95c1e318fcc8101
4
- data.tar.gz: 2d67990ab696469ebc70673c4f603cf25dcf8345
3
+ metadata.gz: fce39e5e4432beb6819c739ea116a9ddc491d50a
4
+ data.tar.gz: dbbdc68c5a9fd9fbf5d911c668cb7e627f02f1dd
5
5
  SHA512:
6
- metadata.gz: 2a5b44b8e3aee06592865e2a6684626a23459e3931ab44de90a89a800321334a97aca8536534a62eecd64b38955be85feaa4a0659b3299336a2d732d379eaa5b
7
- data.tar.gz: e46b52fe5b359d83728342bb8806942d57d216ede933fd4d8dab71dfb4945e4bbb74b52b56c4c54a1465be14a759a6fed105f60c7b91a71e895011fd9a0973b0
6
+ metadata.gz: 487cde05678cc20b3ef9e45a1820203a2b7b494f4f77ded0a9f52e21ac746ed4aec20e33b57a1eb31bf0687fa22d7ae7a90379b70f6ed53c997d4005bec8a32d
7
+ data.tar.gz: 838ae56c7e4ddfce499d39447720b0247e533df47b6c3eb7d28655eedaf0e44280c02603b0cbe7844bafc13a5a48bdf3480b1a14d32e820187149ce8c33c1fe8
data/README.md CHANGED
@@ -1,10 +1,6 @@
1
1
  # Landscape Turner
2
2
 
3
- Landscape Turner is a set of two ruby scripts for backing up the Landscape service, `landscape-turner-backup` and `landscape-turner-restore`.
4
-
5
- ## License
6
-
7
- Landscape Turner is MIT Licensed.
3
+ Landscape Turner is a set of two ruby scripts for backing up the Landscape service, `landscape-turner-backup` and `landscape-turner-restore` .
8
4
 
9
5
  ## General Usage
10
6
 
@@ -34,6 +30,7 @@ Path to prefix default landscape dirs (/var, /etc), default is nothing.
34
30
  ### -p, --no-op
35
31
  No-op (dry run)
36
32
 
33
+
37
34
  To override specific paths, use `-o name1=path1 -o name2=path2 -o name3=path3`. To disable specific paths for backup, use `-d name1 -d name2`. Overrides have higher priority than `--landscape-prefix`.
38
35
 
39
36
  ## Options for landscape-turner-restore
data/Rakefile CHANGED
@@ -1,8 +1,3 @@
1
- #
2
- # Copyright 2016, DAQRI LLC.
3
- #
4
- # This code is covered by the MIT License (see LICENSE.txt)
5
-
6
1
  require "rake/testtask"
7
2
 
8
3
  Rake::TestTask.new do |t|
data/bin/console CHANGED
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
- # Copyright 2016, DAQRI LLC.
4
- #
5
- # This code is covered by the MIT License (see LICENSE.txt)
6
2
 
7
3
  require "bundler/setup"
8
4
  require "landscape_turner"
data/bin/setup CHANGED
@@ -1,11 +1,8 @@
1
1
  #!/usr/bin/env bash
2
- #
3
- # Copyright 2016, DAQRI LLC.
4
- #
5
- # This code is covered by the MIT License (see LICENSE.txt)
6
-
7
2
  set -euo pipefail
8
3
  IFS=$'\n\t'
9
4
  set -vx
10
5
 
11
6
  bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,8 +1,4 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
- # Copyright 2016, DAQRI LLC.
4
- #
5
- # This code is covered by the MIT License (see LICENSE.txt)
6
2
 
7
3
  require 'landscape-turner/backup'
8
4
 
@@ -1,14 +1,10 @@
1
1
  #!/usr/bin/env ruby
2
- #
3
- # Copyright 2016, DAQRI LLC.
4
- #
5
- # This code is covered by the MIT License (see LICENSE.txt)
6
2
 
7
3
  require 'landscape-turner/restore'
8
4
 
9
5
  if ENV['USER'] != "root"
10
6
  puts "You must have root permissions to run this tool."
11
- exit
7
+ exit
12
8
  end
13
-
9
+
14
10
  Restore.restore_with_cli_args
@@ -1,8 +1,3 @@
1
- #
2
- # Copyright 2016, DAQRI LLC.
3
- #
4
- # This code is covered by the MIT License (see LICENSE.txt)
5
-
6
1
  require_relative 'helpers'
7
2
  require 'fileutils'
8
3
  require 'pathname'
@@ -32,7 +27,14 @@ class Backup
32
27
  opt :landscape_prefix, "Path to prefix default landscape dirs (/var, /etc) with", :default => "/"
33
28
  opt :no_op, "No-op (dry run)"
34
29
  opt :sudo, "Program to use as sudo", :default => "sudo"
35
-
30
+ opt :x509_certificate, "Path to landscape x509 certificate", :type => String
31
+ opt :ca_certificate, "Path to landscape CA certificatess" , :type => String
32
+ opt :ssl_private_key, "Path to Landscape's private key", :type => String
33
+ opt :postgresql_config, "Path to landscape's Postgresql config", :type => String
34
+ opt :apache_config, "Path to Apache config", :type => String
35
+ opt :hash_id_database, "Path to Hash ID databases", :type => String
36
+ opt :landscape_dir, "Path to landscape directory", :type => String
37
+ opt :landscape_default, "Path to default landscape server directory", :type => String
36
38
  banner <<-USAGE
37
39
  To override specific paths, use -o name1=path1 -o name2=path2 -o name3=path3
38
40
  To disable specific paths for backup, use -d name1 -d name2
@@ -48,17 +50,16 @@ Names with default values:
48
50
  prefix = new_args[:landscape_prefix]
49
51
  paths.each { |k, v| paths[k] = "#{prefix}#{v}" }
50
52
 
51
- (new_args[:override] || []).each do |o|
52
- key, val = o.split("=")
53
- key = key.to_sym
54
- raise "Unrecognized name argument: #{key.inspect}!" unless paths[key]
55
- paths[key] = val
56
- end
57
-
53
+ path_args = new_args.clone
54
+ [:snapshot_path, :override, :disable, :no_db, :landscape_prefix, :no_op, :sudo].each { |k| path_args.delete(k) }
55
+ (path_args || []).each do |o|
56
+ raise "Unrecognized path argument: #{key.inspect}!" unless paths[o]
57
+ paths[o] = path_args[o]
58
+ end
59
+
58
60
  (new_args[:disable] || []).each do |d|
59
- d = d.to_sym
60
- raise "Unrecognized name argument: #{d.inspect}!" unless paths[d]
61
- paths.delete d
61
+ raise "Unrecognized name argument: #{d.inspect}!" unless paths[key]
62
+ paths.delete d.to_sym
62
63
  end
63
64
 
64
65
  backup_landscape(new_args, paths, prefix)
@@ -97,16 +98,16 @@ Names with default values:
97
98
  end
98
99
  # remove the folder where we stored everything
99
100
  operate ? FileUtils.remove_dir(destination) : nil
100
- puts "Finished backing up to #{destination}"
101
+ puts "Finished backing up to #{destination}"
101
102
  end
102
103
 
103
104
  def self.dump_landscape_databases(backup_destination)
104
105
  FileUtils.mkdir("#{backup_destination}/postgresql_backup") rescue nil
105
- get_landscape_databases().each { |database_name|
106
+ get_landscape_databases().each { |database_name|
106
107
  # pg_dump dbname > outfile
107
108
  safe_system("cd /tmp && sudo -u postgres pg_dump #{database_name} > #{database_name}.bak")
108
109
  FileUtils.mv("/tmp/#{database_name}.bak","#{backup_destination}/postgresql_backup/")
109
- }
110
+ }
110
111
  end
111
112
 
112
113
  def self.check_consistent_tar(destination)
@@ -116,7 +117,7 @@ Names with default values:
116
117
  hash_folder1 = Open3.capture3("find #{destination} -type f 2>/dev/null -exec md5sum {} \;")
117
118
  hash_folder2 = Open3.capture3("find /tmp/tar_check -type f 2>/dev/null -exec md5sum {} \;")
118
119
  FileUtils.rm_rf("/tmp/tar_check")
119
- return hash_folder1 == hash_folder2
120
+ return hash_folder1 == hash_folder2
120
121
  end
121
122
 
122
123
  end
@@ -1,8 +1,3 @@
1
- #
2
- # Copyright 2016, DAQRI LLC.
3
- #
4
- # This code is covered by the MIT License (see LICENSE.txt)
5
-
6
1
  require 'open3'
7
2
 
8
3
  module LandscapeTurner
@@ -1,8 +1,3 @@
1
- #
2
- # Copyright 2016, DAQRI LLC.
3
- #
4
- # This code is covered by the MIT License (see LICENSE.txt)
5
-
6
1
  require_relative 'helpers'
7
2
  require_relative 'backup'
8
3
  require 'fileutils'
@@ -12,7 +7,7 @@ require 'fileutils'
12
7
 
13
8
  class Restore
14
9
  extend LandscapeTurner::Helpers
15
- POSTGRES_CONFIG = "/etc/postgresql/9.3/main"
10
+ POSTGRES_CONFIG = "/etc/postgresql/9.5/main"
16
11
  EXCLUDE_FILES = [POSTGRES_CONFIG]
17
12
  def self.restore_with_cli_args(args = ARGV)
18
13
  opts = Trollop.options(args) do
@@ -60,7 +55,7 @@ In addition to optional arguments, give exactly one .tar.gz file to restore.
60
55
  with_service_stopped("postgresql") do
61
56
  replace(POSTGRES_CONFIG,"/tmp/landscape_backup/#{POSTGRES_CONFIG}")
62
57
  end
63
- end
58
+ end
64
59
 
65
60
  puts "Restoration of Landscape configuration completed."
66
61
 
@@ -73,7 +68,7 @@ In addition to optional arguments, give exactly one .tar.gz file to restore.
73
68
  puts "Copying #{filename} to #{File.dirname(filename_replace)}..."
74
69
  FileUtils.cp_r(filename, File.dirname(filename_replace), :preserve => true, :remove_destination => true)
75
70
  end
76
-
71
+
77
72
 
78
73
  def self.restore_landscape_databases(restore_location)
79
74
  #clear the databases first
@@ -88,5 +83,5 @@ In addition to optional arguments, give exactly one .tar.gz file to restore.
88
83
 
89
84
  end
90
85
 
91
-
86
+
92
87
  end
@@ -1,8 +1,3 @@
1
- #
2
- # Copyright 2016, DAQRI LLC.
3
- #
4
- # This code is covered by the MIT License (see LICENSE.txt)
5
-
6
1
  module LandscapeTurner
7
- VERSION = "1.5.0"
2
+ VERSION = "1.6.0"
8
3
  end
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: landscape-turner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Boisvert
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2016-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: trollop
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.11'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.11'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  description: A backup tool for the Landscape service that backs up the configuration
@@ -98,17 +98,17 @@ require_paths:
98
98
  - lib
99
99
  required_ruby_version: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  requirements:
106
- - - '>='
106
+ - - ">="
107
107
  - !ruby/object:Gem::Version
108
108
  version: '0'
109
109
  requirements: []
110
110
  rubyforge_project:
111
- rubygems_version: 2.4.8
111
+ rubygems_version: 2.5.1
112
112
  signing_key:
113
113
  specification_version: 4
114
114
  summary: Backup tool for the Landscape service