taste_tester 0.0.14 → 0.0.19

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.
@@ -14,19 +14,19 @@
14
14
  # See the License for the specific language governing permissions and
15
15
  # limitations under the License.
16
16
 
17
- CONFIG_PATH='/etc/chef'
18
- CONFIG_NAME='client'
19
-
20
- CONFIG_FILE="${CONFIG_FILE:-/etc/taste-untester-config}"
21
- if [ -e "$CONFIG_FILE" ]; then
22
- source "$COFNIG_FILE"
23
- fi
24
-
17
+ # default configs
25
18
  CONFLINK='/etc/chef/client.rb'
26
19
  PRODCONF='/etc/chef/client-prod.rb'
27
20
  CERTLINK='/etc/chef/client.pem'
28
21
  PRODCERT='/etc/chef/client-prod.pem'
29
22
  STAMPFILE='/etc/chef/test_timestamp'
23
+
24
+ # let the config file overwrite them
25
+ CONFIG_FILE="${CONFIG_FILE:-/etc/taste-untester-config}"
26
+ if [ -e "$CONFIG_FILE" ]; then
27
+ source "$CONFIG_FILE"
28
+ fi
29
+
30
30
  MYSELF=$0
31
31
  DRYRUN=0
32
32
  DEBUG=0
@@ -0,0 +1,85 @@
1
+ # Copyright 2020-present Facebook
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
15
+ [CmdletBinding()]
16
+ param(
17
+ [switch]$dryrun
18
+ )
19
+
20
+ # keep these as *forward* slashes
21
+ $CONFLINK = 'C:/chef/client.rb'
22
+ $PRODCONF = 'C:/chef/client-prod.rb'
23
+ $CERTLINK = 'C:/chef/client.pem'
24
+ $PRODCERT = 'C:/chef/client-prod.pem'
25
+ $STAMPFILE = 'C:/chef/test_timestamp'
26
+ $MYSELF = $0
27
+
28
+ function log($msg) {
29
+ Write-EventLog -LogName "Application" -Source "taste-tester" `
30
+ -EventID 2 -EntryType Warning -Message $msg
31
+ }
32
+
33
+ function set_server_to_prod {
34
+ if (Test-Path $STAMPFILE) {
35
+ $content = Get-Content $STAMPFILE
36
+ if ($content -ne $null) {
37
+ kill $content -Force 2>$null
38
+ }
39
+ }
40
+ rm -Force $CONFLINK
41
+ New-Item -ItemType symboliclink -Force -Value $PRODCONF $CONFLINK
42
+ if (Test-Path $STAMPFILE) {
43
+ rm -Force $STAMPFILE
44
+ }
45
+ log "Reverted to production Chef."
46
+ }
47
+
48
+ function check_server {
49
+ # this is the only way to check if something is a symlink, apparently
50
+ if (-Not ((get-item $CONFLINK).Attributes.ToString() -match "ReparsePoint")) {
51
+ Write-Verbose "$CONFLINK is not a link..."
52
+ return
53
+ }
54
+ $current_config = (Get-Item $CONFLINK).target
55
+ if ($current_config -eq $PRODCONF) {
56
+ if (Test-Path $STAMPFILE) {
57
+ rm -Force $STAMPFILE
58
+ }
59
+ return
60
+ }
61
+
62
+ $revert = $false
63
+ if (-Not (Test-Path $STAMPFILE)) {
64
+ $revert = $true
65
+ } else {
66
+ $now = [int][double]::Parse(
67
+ $(Get-Date -date (Get-Date).ToUniversalTime()-uformat %s)
68
+ )
69
+ $stamp_time = Get-Date -Date `
70
+ (Get-Item $STAMPFILE).LastWriteTime.ToUniversalTime() -UFormat %s
71
+ Write-Verbose "$now vs $stamp_time"
72
+ if ($now -gt $stamp_time) {
73
+ $revert = $true
74
+ }
75
+ }
76
+ if ($revert) {
77
+ if ($dryrun) {
78
+ echo "DRYRUN: Would return server to prod"
79
+ } else {
80
+ set_server_to_prod
81
+ }
82
+ }
83
+ }
84
+
85
+ check_server
metadata CHANGED
@@ -1,15 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taste_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Phil Dibowitz
8
8
  - Marcin Sawicki
9
9
  autorequire:
10
- bindir: bin
10
+ bindir:
11
+ - bin
11
12
  cert_chain: []
12
- date: 2019-08-02 00:00:00.000000000 Z
13
+ date: 2020-08-25 00:00:00.000000000 Z
13
14
  dependencies:
14
15
  - !ruby/object:Gem::Dependency
15
16
  name: between_meals
@@ -17,30 +18,16 @@ dependencies:
17
18
  requirements:
18
19
  - - ">="
19
20
  - !ruby/object:Gem::Version
20
- version: 0.0.6
21
+ version: 0.0.11
21
22
  type: :runtime
22
23
  prerelease: false
23
24
  version_requirements: !ruby/object:Gem::Requirement
24
25
  requirements:
25
26
  - - ">="
26
27
  - !ruby/object:Gem::Version
27
- version: 0.0.6
28
+ version: 0.0.11
28
29
  - !ruby/object:Gem::Dependency
29
- name: json
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - ">="
33
- - !ruby/object:Gem::Version
34
- version: 2.0.0
35
- type: :runtime
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - ">="
40
- - !ruby/object:Gem::Version
41
- version: 2.0.0
42
- - !ruby/object:Gem::Dependency
43
- name: mixlib-config
30
+ name: chef
44
31
  requirement: !ruby/object:Gem::Requirement
45
32
  requirements:
46
33
  - - ">="
@@ -68,33 +55,19 @@ dependencies:
68
55
  - !ruby/object:Gem::Version
69
56
  version: '0'
70
57
  - !ruby/object:Gem::Dependency
71
- name: chef-zero
72
- requirement: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: '0'
77
- type: :development
78
- prerelease: false
79
- version_requirements: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: '0'
84
- - !ruby/object:Gem::Dependency
85
- name: knife-solo
58
+ name: json
86
59
  requirement: !ruby/object:Gem::Requirement
87
60
  requirements:
88
61
  - - ">="
89
62
  - !ruby/object:Gem::Version
90
- version: '0'
91
- type: :development
63
+ version: 2.0.0
64
+ type: :runtime
92
65
  prerelease: false
93
66
  version_requirements: !ruby/object:Gem::Requirement
94
67
  requirements:
95
68
  - - ">="
96
69
  - !ruby/object:Gem::Version
97
- version: '0'
70
+ version: 2.0.0
98
71
  - !ruby/object:Gem::Dependency
99
72
  name: minitar
100
73
  requirement: !ruby/object:Gem::Requirement
@@ -110,19 +83,19 @@ dependencies:
110
83
  - !ruby/object:Gem::Version
111
84
  version: 0.6.1
112
85
  - !ruby/object:Gem::Dependency
113
- name: rubocop
86
+ name: mixlib-config
114
87
  requirement: !ruby/object:Gem::Requirement
115
88
  requirements:
116
- - - '='
89
+ - - ">="
117
90
  - !ruby/object:Gem::Version
118
- version: 0.49.1
119
- type: :development
91
+ version: '0'
92
+ type: :runtime
120
93
  prerelease: false
121
94
  version_requirements: !ruby/object:Gem::Requirement
122
95
  requirements:
123
- - - '='
96
+ - - ">="
124
97
  - !ruby/object:Gem::Version
125
- version: 0.49.1
98
+ version: '0'
126
99
  description: Utility for testing Chef changes using chef-zero
127
100
  email:
128
101
  executables:
@@ -146,13 +119,15 @@ files:
146
119
  - lib/taste_tester/noop.rb
147
120
  - lib/taste_tester/server.rb
148
121
  - lib/taste_tester/ssh.rb
122
+ - lib/taste_tester/ssh_util.rb
149
123
  - lib/taste_tester/state.rb
150
124
  - lib/taste_tester/tunnel.rb
151
125
  - lib/taste_tester/windows.rb
152
126
  - scripts/taste-untester
127
+ - scripts/taste-untester.ps1
153
128
  homepage: https://github.com/facebook/taste-tester
154
129
  licenses:
155
- - Apache
130
+ - Apache-2.0
156
131
  metadata: {}
157
132
  post_install_message:
158
133
  rdoc_options: []
@@ -169,8 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
144
  - !ruby/object:Gem::Version
170
145
  version: '0'
171
146
  requirements: []
172
- rubyforge_project:
173
- rubygems_version: 2.7.6.2
147
+ rubygems_version: 3.1.2
174
148
  signing_key:
175
149
  specification_version: 4
176
150
  summary: Taste Tester