chef_backup 0.0.1.dev.1 → 0.0.1.dev.2

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
  SHA1:
3
- metadata.gz: 1bec5855a4a67f6d47efbf80b1b13be09338de3d
4
- data.tar.gz: c02131b03380815d3a79c281da26fb8fe51f7f7f
3
+ metadata.gz: 77676069a215d7829c14023e70d43e71d27581a1
4
+ data.tar.gz: e218d8428ec0edb82a440f9003db3035435e539d
5
5
  SHA512:
6
- metadata.gz: 34616288ba8212f0e86fb3e5b26ad75bd6a912c9de52123ea954179c1a52ced09ed5f4f00368bf2c17b4ddb32642ba0f78e76a0da0071510bf8851bc0af93a1f
7
- data.tar.gz: 02e5d4f0bc8868228c9f329702adfe8099c7f866e7f2e82760a65cd153a487c861e950184eddc938e578db894eb41ac6fcb6a84e7498641a7cbc7a0bb0e26f32
6
+ metadata.gz: e3850ccefb42090d4c73decaa3c9c661d50529aee9eb00a667bb97f648337871e2dafa9fbe1ad6c8cbb082f6ccb908a3d8799721da778c133402530fdb7c5d7c
7
+ data.tar.gz: d89dc2fb4ef4bc7d95f907e1dec161cb26a0ff2749cee9e8cb1069e823c345d255a42227edd0cf48f638cbc2277d497fedc90689f95102b8f5f4a77599331708
data/README.md CHANGED
@@ -1,21 +1,9 @@
1
1
  # ChefBackup
2
- [![Build Status](https://travis-ci.org/ryancragun/chef_backup.svg?branch=master)](https://travis-ci.org/ryancragun/chef_backup)
2
+ [![Build Status](https://travis-ci.org/chef/chef_backup.svg?branch=master)](https://travis-ci.org/chef/chef_backup)
3
+ [![Gem Version](https://badge.fury.io/rb/chef_backup.svg)](http://badge.fury.io/rb/chef_backup)
3
4
 
4
- A gem that backs up and restores Chef servers.
5
-
6
- ## Installation
7
-
8
- Add this line to your application's Gemfile:
9
-
10
- gem 'chef_backup'
11
-
12
- And then execute:
13
-
14
- $ bundle
15
-
16
- Or install it yourself as:
17
-
18
- $ gem install chef_backup
5
+ A gem that backs up and restores Chef servers. Used as the backend for
6
+ `chef-server-ctl backup` and `chef-server-ctl restore`
19
7
 
20
8
  ## Usage
21
9
 
@@ -26,7 +14,7 @@ chef-server-ctl restore some_backup.tgz
26
14
 
27
15
  ## Contributing
28
16
 
29
- 1. Fork it ( https://github.com/ryancragun/chef_backup/fork )
17
+ 1. Fork it ( https://github.com/chef/chef_backup/fork )
30
18
  2. Create your feature branch (`git checkout -b my-new-feature`)
31
19
  3. Commit your changes (`git commit -am 'Add some feature'`)
32
20
  4. Push to the branch (`git push origin my-new-feature`)
@@ -8,9 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ChefBackup::VERSION
9
9
  spec.authors = ['Ryan Cragun']
10
10
  spec.email = ['me@ryan.ec']
11
- spec.summary = 'A library to backup an Enterprise Chef server'
11
+ spec.summary = 'A library to backup a Chef Server'
12
12
  spec.description = spec.summary
13
- spec.homepage = 'https://github.com/ryancragun/chef_backup'
13
+ spec.homepage = 'https://github.com/chef/chef_backup'
14
14
  spec.license = 'Apachev2'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
@@ -100,18 +100,6 @@ module Helpers
100
100
  File.directory?("/etc/#{service}")
101
101
  end
102
102
 
103
- def pg_dump?
104
- if frontend? # don't dump postgres on frontends
105
- false
106
- elsif private_chef['backup']['always_dump_db'] == true # defaults to true
107
- true
108
- elsif strategy !~ /lvm|ebs/ && backend? # backup non-block device backends
109
- true
110
- else
111
- false # if we made it here then we're on lvm/ebs and overrode defaults
112
- end
113
- end
114
-
115
103
  def strategy
116
104
  private_chef['backup']['strategy']
117
105
  end
@@ -15,25 +15,25 @@ module ChefBackup
15
15
  attr_accessor :stdout
16
16
 
17
17
  def initialize(logfile = nil)
18
- @stdout = logfile || $stdout
19
- @highline = HighLine.new($stdin, @stdout)
18
+ $stdout = logfile ? File.open(logfile, 'ab') : $stdout
19
+ @highline = HighLine.new($stdin, $stdout)
20
20
  end
21
21
 
22
22
  def log(msg, level = :info)
23
23
  case level
24
24
  when :warn
25
25
  msg = "WARNING: #{msg}"
26
- @stdout.puts(color? ? @highline.color(msg, :yellow) : msg)
26
+ $stdout.puts(color? ? @highline.color(msg, :yellow) : msg)
27
27
  when :error
28
28
  msg = "ERROR: #{msg}"
29
- @stdout.puts(color? ? @highline.color(msg, :red) : msg)
29
+ $stdout.puts(color? ? @highline.color(msg, :red) : msg)
30
30
  else
31
- @stdout.puts(msg)
31
+ $stdout.puts(msg)
32
32
  end
33
33
  end
34
34
 
35
35
  def color?
36
- @stdout.tty?
36
+ $stdout.tty?
37
37
  end
38
38
  end
39
39
  end
@@ -160,6 +160,11 @@ class TarBackup
160
160
  res = shell_out(cmd)
161
161
  res
162
162
  end
163
+
164
+ def pg_dump?
165
+ # defaults to true
166
+ private_chef['backup']['always_dump_db']
167
+ end
163
168
  end
164
169
  end
165
170
  end
@@ -1,4 +1,4 @@
1
1
  # ChefBackup module
2
2
  module ChefBackup
3
- VERSION = '0.0.1.dev.1'
3
+ VERSION = '0.0.1.dev.2'
4
4
  end
@@ -277,4 +277,18 @@ describe ChefBackup::Strategy::TarBackup do
277
277
  end
278
278
  end
279
279
  end
280
+
281
+ describe '.pg_dump?' do
282
+ it 'returns true' do
283
+ expect(subject.pg_dump?).to eq(true)
284
+ end
285
+
286
+ context 'when db dump is disabled' do
287
+ before { private_chef('backup' => { 'always_dump_db' => false }) }
288
+
289
+ it 'returns false' do
290
+ expect(subject.pg_dump?).to eq(false)
291
+ end
292
+ end
293
+ end
280
294
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef_backup
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.dev.1
4
+ version: 0.0.1.dev.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Cragun
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-19 00:00:00.000000000 Z
11
+ date: 2015-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: di-ruby-lvm
@@ -164,7 +164,7 @@ dependencies:
164
164
  - - ">="
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
- description: A library to backup an Enterprise Chef server
167
+ description: A library to backup a Chef Server
168
168
  email:
169
169
  - me@ryan.ec
170
170
  executables: []
@@ -213,7 +213,7 @@ files:
213
213
  - spec/unit/strategy/restore/shared_examples/restore.rb
214
214
  - spec/unit/strategy/restore/tar_spec.rb
215
215
  - spec/unit/strategy_spec.rb
216
- homepage: https://github.com/ryancragun/chef_backup
216
+ homepage: https://github.com/chef/chef_backup
217
217
  licenses:
218
218
  - Apachev2
219
219
  metadata: {}
@@ -236,7 +236,7 @@ rubyforge_project:
236
236
  rubygems_version: 2.2.2
237
237
  signing_key:
238
238
  specification_version: 4
239
- summary: A library to backup an Enterprise Chef server
239
+ summary: A library to backup a Chef Server
240
240
  test_files:
241
241
  - spec/fixtures/chef-server-running.json
242
242
  - spec/spec_helper.rb