taste_tester 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,77 @@
1
+ #!/bin/bash
2
+
3
+ CONFLINK='/etc/chef/client.rb'
4
+ PRODCONF='/etc/chef/client-prod.rb'
5
+ CERTLINK='/etc/chef/client.pem'
6
+ PRODCERT='/etc/chef/client-prod.pem'
7
+ STAMPFILE='/etc/chef/test_timestamp'
8
+ MYSELF=$0
9
+ DRYRUN=0
10
+ DEBUG=0
11
+
12
+ debug() {
13
+ [ "$DEBUG" -eq 1 ] && echo $*
14
+ }
15
+
16
+ set_server_to_prod() {
17
+ ME=$(basename $MYSELF)
18
+ if [ -s $STAMPFILE ]; then
19
+ kill -- -$(cat $STAMPFILE)
20
+ fi
21
+ rm -f $CONFLINK
22
+ ln -s $PRODCONF $CONFLINK
23
+ # Legacy FB stuff, will go away
24
+ if [ -h $CERTLINK ]; then
25
+ rm $CERTLINK
26
+ ln -s $PRODCERT $CERTLINK
27
+ fi
28
+ rm -f $STAMPFILE
29
+ logger -p user.warning -t $ME Reverted to production Chef.
30
+ if [ -e '/usr/bin/wall' ]; then
31
+ echo "Reverted $(hostname) to production Chef." | wall
32
+ fi
33
+ }
34
+
35
+ check_server() {
36
+ if [ ! -h $CONFLINK ]; then
37
+ return
38
+ fi
39
+ current_config=$(readlink $CONFLINK)
40
+ if [ "$current_config" = $PRODCONF ]; then
41
+ if [ -f "$STAMPFILE" ]; then
42
+ rm -f $STAMPFILE
43
+ fi
44
+ return
45
+ fi
46
+
47
+ now=$(date +%s)
48
+ if [ "$(uname)" = 'Darwin' ]; then
49
+ stamp_time=$(stat -f "%m" -t "%z" $STAMPFILE)
50
+ stamp=$(date -r $stamp_time)
51
+ else
52
+ stamp=$(stat -c %y $STAMPFILE)
53
+ stamp_time=$(date +%s -d "$stamp")
54
+ fi
55
+
56
+ debug "$now vs $stamp_time"
57
+ if [ "$now" -gt "$stamp_time" ]; then
58
+ if [ $DRYRUN -eq 0 ]; then
59
+ set_server_to_prod
60
+ else
61
+ echo "DRYRUN: Would return server to prod"
62
+ fi
63
+ fi
64
+ }
65
+
66
+ while getopts 'dn' opt; do
67
+ case "$opt" in
68
+ d)
69
+ DEBUG=1
70
+ ;;
71
+ n)
72
+ DRYRUN=1
73
+ ;;
74
+ esac
75
+ done
76
+
77
+ check_server
metadata CHANGED
@@ -1,83 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taste_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
- - Marcin Sawicki
8
8
  - Phil Dibowitz
9
+ - Marcin Sawicki
9
10
  autorequire:
10
11
  bindir: bin
11
12
  cert_chain: []
12
- date: 2014-05-09 00:00:00.000000000 Z
13
+ date: 2014-09-04 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
- name: bundler
16
+ name: mixlib-config
16
17
  requirement: !ruby/object:Gem::Requirement
18
+ none: false
17
19
  requirements:
18
- - - ~>
20
+ - - ! '>='
19
21
  - !ruby/object:Gem::Version
20
- version: '1.3'
21
- type: :development
22
+ version: '0'
23
+ type: :runtime
22
24
  prerelease: false
23
25
  version_requirements: !ruby/object:Gem::Requirement
26
+ none: false
24
27
  requirements:
25
- - - ~>
28
+ - - ! '>='
26
29
  - !ruby/object:Gem::Version
27
- version: '1.3'
30
+ version: '0'
28
31
  - !ruby/object:Gem::Dependency
29
- name: rake
32
+ name: colorize
30
33
  requirement: !ruby/object:Gem::Requirement
34
+ none: false
31
35
  requirements:
32
- - - '>='
36
+ - - ! '>='
33
37
  - !ruby/object:Gem::Version
34
38
  version: '0'
35
- type: :development
39
+ type: :runtime
36
40
  prerelease: false
37
41
  version_requirements: !ruby/object:Gem::Requirement
42
+ none: false
38
43
  requirements:
39
- - - '>='
44
+ - - ! '>='
40
45
  - !ruby/object:Gem::Version
41
46
  version: '0'
42
- description: Write a gem description
43
- email:
44
- - odcinek@gmail.com
45
- - phil@ipom.com
46
- executables: []
47
+ - !ruby/object:Gem::Dependency
48
+ name: between_meals
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ description: Utility for testing Chef changes using chef-zero
64
+ email:
65
+ executables:
66
+ - taste-tester
47
67
  extensions: []
48
- extra_rdoc_files: []
68
+ extra_rdoc_files:
69
+ - README.md
70
+ - LICENSE
49
71
  files:
50
- - .gitignore
51
- - Gemfile
52
- - LICENSE.txt
53
72
  - README.md
54
- - Rakefile
55
- - lib/taste_tester.rb
56
- - lib/taste_tester/version.rb
57
- - taste_tester.gemspec
58
- homepage: ''
73
+ - LICENSE
74
+ - lib/taste_tester/host.rb
75
+ - lib/taste_tester/ssh.rb
76
+ - lib/taste_tester/tunnel.rb
77
+ - lib/taste_tester/server.rb
78
+ - lib/taste_tester/client.rb
79
+ - lib/taste_tester/hooks.rb
80
+ - lib/taste_tester/config.rb
81
+ - lib/taste_tester/logging.rb
82
+ - lib/taste_tester/state.rb
83
+ - lib/taste_tester/commands.rb
84
+ - bin/taste-tester
85
+ - scripts/taste-untester
86
+ homepage: https://github.com/facebook/taste-tester
59
87
  licenses:
60
- - MIT
61
- metadata: {}
88
+ - Apache
62
89
  post_install_message:
63
90
  rdoc_options: []
64
91
  require_paths:
65
92
  - lib
66
93
  required_ruby_version: !ruby/object:Gem::Requirement
94
+ none: false
67
95
  requirements:
68
- - - '>='
96
+ - - ! '>='
69
97
  - !ruby/object:Gem::Version
70
98
  version: '0'
71
99
  required_rubygems_version: !ruby/object:Gem::Requirement
100
+ none: false
72
101
  requirements:
73
- - - '>='
102
+ - - ! '>='
74
103
  - !ruby/object:Gem::Version
75
104
  version: '0'
76
105
  requirements: []
77
106
  rubyforge_project:
78
- rubygems_version: 2.0.14
107
+ rubygems_version: 1.8.29
79
108
  signing_key:
80
- specification_version: 4
81
- summary: Write a gem summary
109
+ specification_version: 3
110
+ summary: Taste Tester
82
111
  test_files: []
83
- has_rdoc:
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 05ac74c9f5bb9650c6f7a47d3a500327ca174a12
4
- data.tar.gz: cc0135d643e4f7f91038e7739979a8c85b60ab51
5
- SHA512:
6
- metadata.gz: 093436d91f74ea027b48041945056b9204f1e323acddb2d27ab43d6278beb86e4a2aa23adaf6ee630804c07b9e1d4080a764592db4ce66ac30b151ccafaa11e0
7
- data.tar.gz: 3ce88dbe66ed15ccaba9b5f17be0225374dae5fa4dc7d30454a0edfa463665c203e692f4bee7aa191c5fa19c4158737f4ba8bc2f61dd443a809edf4e80e44c20
data/.gitignore DELETED
@@ -1,17 +0,0 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- .yardoc
6
- Gemfile.lock
7
- InstalledFiles
8
- _yardoc
9
- coverage
10
- doc/
11
- lib/bundler/man
12
- pkg
13
- rdoc
14
- spec/reports
15
- test/tmp
16
- test/version_tmp
17
- tmp
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in taste_tester.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,22 +0,0 @@
1
- Copyright (c) 2014 Marcin Sawicki
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Rakefile DELETED
@@ -1 +0,0 @@
1
- require "bundler/gem_tasks"
@@ -1,3 +0,0 @@
1
- module TasteTester
2
- VERSION = "0.0.1"
3
- end
data/lib/taste_tester.rb DELETED
@@ -1,5 +0,0 @@
1
- require "taste_tester/version"
2
-
3
- module TasteTester
4
- # Your code goes here...
5
- end
data/taste_tester.gemspec DELETED
@@ -1,23 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'taste_tester/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "taste_tester"
8
- spec.version = TasteTester::VERSION
9
- spec.authors = ["Marcin Sawicki", "Phil Dibowitz"]
10
- spec.email = ["odcinek@gmail.com", "phil@ipom.com"]
11
- spec.description = %q{Write a gem description}
12
- spec.summary = %q{Write a gem summary}
13
- spec.homepage = ""
14
- spec.license = "MIT"
15
-
16
- spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
20
-
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- end