gaddygaddy 0.1.87 → 0.1.88

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +13 -5
  2. data/lib/gaddygaddy-client.rb +41 -1
  3. metadata +20 -20
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b0fd49d5c4ea0d76eb73d8fcbf586b8ffa1dfddf
4
- data.tar.gz: 342d32afccfbb5844135958c80a8bbcb50c6632f
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MTFiYmY2ZjIwYjczY2EzZDM3Njc1Yjk2MGI5Y2FjMDYyOGIyODdhYw==
5
+ data.tar.gz: !binary |-
6
+ Mzg5MzBmMGI1NzI4NDcwZWFiZDU0NTkwN2FhOTE3ZDFmMWMwNzNkZQ==
5
7
  SHA512:
6
- metadata.gz: 22a9c6feb5887d6dee2c75b8f407ac4fd22a12595f85c61d1c0ea1086a615926b6a0e8ee6cd5ed9a2ceab8b1c495910366c00b981f251e8d719f4bad4281d21b
7
- data.tar.gz: fd836c76617315e7b9730e8ea531c97d4c29ad35b8c4dfbb2602d19463415e8b95da2e9d6fd0ffae9831c3a6f2af9ff04f4bd83c64a2220e117ae33e9b4c378c
8
+ metadata.gz: !binary |-
9
+ NTA3MWVkMjgxMzUzNjA0NTc5YTI3MzUzYmM1ZjE4NjY0NjJlMjI5NDI1YjBj
10
+ YWZhNGE5ZjcwNWJlMzc3OWU1YjVjODFkMzU5N2FmYTFjZDBjMDk5OWEzODRj
11
+ YjlmMTVkOTRjYzZhNDg5MTg4OTg5MTA0OTAyNmI0YWFjYmExNGY=
12
+ data.tar.gz: !binary |-
13
+ NjAxNWQ5YmEwODczNTNiZWY5Yzk0ZTJlNzgyNmY1ODg3MDA5NTgwZWYzODc2
14
+ ZDVkMzdmZDJkZjRkZWM1YTE4NWE3NmI1MzdkZDVhNzY5MTU0YWQ0ZmE2YTJj
15
+ ZWExZjYyMWIzYjcwZWQ3NGQ2MDdjYTk1MmExNzU2NzgyNTAyMjQ=
@@ -138,7 +138,21 @@ class GaddyGaddy_Client
138
138
 
139
139
  command :chef_config do |opts|
140
140
  opts.banner = "Usage: chef_config [options]"
141
- opts.description = "Will download the config and place it in a directory"
141
+ opts.description = "Will download the chef config and place it in a directory"
142
+ end
143
+
144
+ command :gaddy_file do |opts|
145
+ opts.banner = "Usage: gaddy_file [options]"
146
+ opts.description = "Will download the gaddy config and place it in /conf"
147
+ opts.on("-g", "--gaddy gaddy_name", "Name of gaddy") do |gaddy_name|
148
+ @options[:gaddy_name] = gaddy_name
149
+ end
150
+ opts.on("-u", "--user user_name", "User name") do |user_name|
151
+ @options[:user_name] = user_name
152
+ end
153
+ opts.on("-p", "--password password", "Password") do |password|
154
+ @options[:password] = password
155
+ end
142
156
  end
143
157
 
144
158
  command :send_device_data do |opts|
@@ -248,6 +262,30 @@ class GaddyGaddy_Client
248
262
  conf_file.close
249
263
  end
250
264
 
265
+ def get_gaddy_config(name, user, password)
266
+ path = URI.encode("/device/config_file/1/#{name}?user_name=#{user}&user_password=#{password}").gsub('+', '%2B')
267
+ puts path
268
+ response = Request.client_service_get get_host, path
269
+ logger.debug "Got config file: #{response}"
270
+ response
271
+ end
272
+
273
+ # Get the gaddy configuration and place it in /conf named gaddy_NAME.gcf
274
+ def gaddy_config
275
+ begin
276
+ FileUtils.mkdir_p conf_dir
277
+ rescue Exception => e
278
+ raise e.inspect
279
+ end
280
+ name = @options[:gaddy_name]
281
+ conf_content = get_gaddy_config(name, @options[:user_name], @options[:password])
282
+ gaddy_file_name = "gaddy_#{name}.gcf"
283
+ conf_file = File.open File.join(conf_dir, gaddy_file_name), "w"
284
+ conf_file.write conf_content.to_json
285
+ conf_file.close
286
+
287
+ end
288
+
251
289
  # Check that the config file exist and has valid content, this will also be validated toward the server
252
290
  def config_valid
253
291
  config_ok = false
@@ -387,6 +425,8 @@ class GaddyGaddy_Client
387
425
  chef_files.get_cookbooks @options[:file_host], @options[:cookbooks_version]
388
426
  when "chef_config"
389
427
  get_chef_config
428
+ when 'gaddy_file'
429
+ gaddy_config
390
430
  when 'send_device_data'
391
431
  send_device_data
392
432
  when "verify_installation"
metadata CHANGED
@@ -1,102 +1,102 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gaddygaddy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.87
4
+ version: 0.1.88
5
5
  platform: ruby
6
6
  authors:
7
7
  - GaddyGaddy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-06 00:00:00.000000000 Z
11
+ date: 2015-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: i18n
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: log4r
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - ! '>='
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
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: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rest-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - ! '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
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: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: stringex
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: :runtime
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
  - !ruby/object:Gem::Dependency
70
70
  name: subcommand
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - ! '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - ! '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: systemu
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - ! '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - ! '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
- description: |-
98
- Tools to be used on the client for the Gaddygaddy service. gaddygaddy-client are used to communicate with the gaddygaddy service\
99
- to update the client with configuration files and update with instance information
97
+ description: ! "Tools to be used on the client for the Gaddygaddy service. gaddygaddy-client
98
+ are used to communicate with the gaddygaddy service\\\n to update
99
+ the client with configuration files and update with instance information"
100
100
  email: support@gaddygaddy.com
101
101
  executables:
102
102
  - interval
@@ -144,17 +144,17 @@ require_paths:
144
144
  - lib
145
145
  required_ruby_version: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - ">="
147
+ - - ! '>='
148
148
  - !ruby/object:Gem::Version
149
149
  version: '0'
150
150
  required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - ">="
152
+ - - ! '>='
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
156
  rubyforge_project:
157
- rubygems_version: 2.2.2
157
+ rubygems_version: 2.4.5
158
158
  signing_key:
159
159
  specification_version: 4
160
160
  summary: Client tools used for the Gaddygaddy service