knife-push 1.0.0 → 1.0.1

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: ae06685f29fb7f0a741d56dc0f4d035e5868fe4b
4
- data.tar.gz: 580f66d1514d0ed2ebf45feb8e68726079029a68
3
+ metadata.gz: 038f57928247aec7d8738ba995ef7c55c0aad8df
4
+ data.tar.gz: c4a210015c78ef8ffb3c744cf0a3e177c5e1ce39
5
5
  SHA512:
6
- metadata.gz: b4a6d017bee2e73cfc05ba2d27ce5928da1074bc1ba3d40abc48742822f779cd6fcdccd2fb6634d8ed7545bbde4852dbd28177eb31aa6ff147b839a75cdc7e3a
7
- data.tar.gz: feb7b3f5a253a520a72501417f3d719e2be7ba38768e9efb325cad5e69ed5975bcae265af4476ceeb12d40073ce1ed2af01f42def985faf0c365afbd4a59e7f9
6
+ metadata.gz: bab6b08e47fabe72250eb77e928c9ff8da38abb9000553c145c80ac8672d6cc3c6db847edc45f950f7a7c8fab9fe14ac61efedebed44a3cc9e65834adb4756f1
7
+ data.tar.gz: d1312745ef63c28bca515568a0d1f19d246bc52ea10e8483c7e14ff1ac5e2361e941435f8040c16ad174227903303b69664a617f2e3ac162b0ffd2ae9f534622
@@ -101,7 +101,7 @@ class Chef
101
101
  sleep(config[:poll_interval].to_f)
102
102
  putc(".")
103
103
  job = rest.get_rest(job_uri)
104
- finished, state = JobHelpers.status_string(job)
104
+ finished, state = status_string(job)
105
105
  if state != previous_state
106
106
  puts state
107
107
  previous_state = state
@@ -98,16 +98,41 @@ class Chef
98
98
  job_json = {
99
99
  'command' => job_name,
100
100
  'nodes' => @node_names,
101
- 'capture_output' => config[:capture_output]
102
101
  }
103
- job_json['file'] = "raw:" + file_helper(config[:send_file]) if config[:send_file]
102
+
104
103
  job_json['quorum'] = get_quorum(config[:quorum], @node_names.length)
105
- env = get_env(config)
106
- job_json['env'] = env if env
107
- job_json['dir'] = config[:in_dir] if config[:in_dir]
108
- job_json['user'] = config[:as_user] if config[:as_user]
109
104
 
110
- job = run_helper(config, job_json)
105
+ v2_json = job_json.dup
106
+
107
+ v2_json['file'] = "raw:" + file_helper(config[:send_file]) if config[:send_file]
108
+
109
+ v2_json['capture_output'] = config[:capture_output]
110
+ env = get_env(config)
111
+ v2_json['env'] = env if env
112
+ v2_json['dir'] = config[:in_dir] if config[:in_dir]
113
+ v2_json['user'] = config[:as_user] if config[:as_user]
114
+
115
+ begin
116
+ job = run_helper(config, v2_json)
117
+ rescue Net::HTTPServerException => e
118
+ raise e if e.response.code != "400"
119
+
120
+ ui.warn "Falling back to Push Jobs v1 mode."
121
+
122
+ unless env.empty?
123
+ ui.error "Sending Environment attributes isn't possible for Push Jobs 1.0"
124
+ exit 1
125
+ end
126
+
127
+ %i{ send_file dir user }.each do |feature|
128
+ if config[feature]
129
+ ui.error "Can't use a 2.0 feature (#{feature.to_s}) with a 1.0 server"
130
+ exit 1
131
+ end
132
+ end
133
+
134
+ job = run_helper(config, job_json)
135
+ end
111
136
 
112
137
  output(job)
113
138
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Knife
3
3
  module Push
4
- VERSION = '1.0.0'
4
+ VERSION = '1.0.1'
5
5
  MAJOR, MINOR, TINY = VERSION.split('.')
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-push
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-11 00:00:00.000000000 Z
11
+ date: 2016-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Knife plugin for chef push
42
56
  email: jkeiser@opscode.com
43
57
  executables: []
@@ -75,9 +89,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
89
  version: '0'
76
90
  requirements: []
77
91
  rubyforge_project:
78
- rubygems_version: 2.2.3
92
+ rubygems_version: 2.4.5.1
79
93
  signing_key:
80
94
  specification_version: 4
81
95
  summary: Knife plugin for chef push
82
96
  test_files: []
83
- has_rdoc: true