quiverstaskrunner 0.1.254104 → 0.1.254172

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: df93667b776f70d0273680b76b91f231e1d616ae
4
- data.tar.gz: 5b0009ef84d365b926701200599dadee2104f03e
3
+ metadata.gz: 78db79e6ff6dbc49edc518e0f8b14a7069cf63e9
4
+ data.tar.gz: 0fe66d028a0ebcc644ae08519d2ba4a349ab632f
5
5
  SHA512:
6
- metadata.gz: aa0840201a1bc6946a40ee8e1967029b60629631be18d320d97e563a768d64968af718cf2d21eebdc174106d39bab87dd962ffcc5224a5eecf2d288cce79cce8
7
- data.tar.gz: 96c5dd8bb6322e68cd6e3144893c82a7c15747fead80f08552677fe14ab953c877f11acd90bfc288cc5bfc6d0de6540d8410dcef0dc855f3b04ba2f3e76cfc9d
6
+ metadata.gz: fd705939f1b2a9889cd34d2f853fb826b7919b83f616654d0eaa5ae14a2111380c3ea19392956e8baa5215a2269c0272b434c90092a689cc3470e808a15b89f2
7
+ data.tar.gz: d3dfc834a76d83f5867ca12ac3dd059221f5a48eece019ce42ec515d783e15ed3ccce1d4ba2d40d35b4e00df73192ca6d37eba04efefc2b44f31f9b74535078d
@@ -10,6 +10,14 @@ require "quiverstaskrunner/helpers/settingshelper"
10
10
  include QuiversTaskrunner
11
11
 
12
12
  module QuiversTaskrunner
13
+ @@get_settings_options = { :cli_params_black_list => ["env", "nos", "no-swap", "nod", "no-staging-del", "verbose" ] }
14
+ @@secrets = {
15
+ :cloud_services => "secrets/cloud_services.yml",
16
+ :storage => "secrets/storage.yml",
17
+ :certs => "secrets/certs.yml",
18
+ :global => "secrets/global.yml"
19
+ }
20
+
13
21
  module_function
14
22
 
15
23
  def is_update_message_on
@@ -22,11 +30,24 @@ module QuiversTaskrunner
22
30
  return update_message_on
23
31
  end
24
32
 
33
+ def list_secrets(options={})
34
+ env = env || EnvHelper.get_env("env")
35
+ white_list = options[:white_list]
36
+ if (!white_list.nil?) && (!white_list.empty?)
37
+ @@secrets
38
+ .reject { |k,v| !white_list.detect { |x| k == x } }
39
+ .each { |k,v| puts "#{k}".colorize("yellow"); puts; puts "#{SettingsHelper.get_settings(File.join(Dir.pwd, v), env, @@get_settings_options)}" }
40
+ else
41
+ @@secrets
42
+ .each { |k,v| puts "#{k}".colorize("yellow"); puts; puts "#{SettingsHelper.get_settings(File.join(Dir.pwd, v), env, @@get_settings_options)}" }
43
+ end
44
+ end
45
+
25
46
  def scale_host(cloud_service_name, service_configuration, service_definition, env=nil)
26
47
  env = env || EnvHelper.get_env("env")
27
48
 
28
49
  # 1. Get cloud service's details
29
- cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/cloud_services.yml"), env)
50
+ cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:cloud_services]), env, @@get_settings_options)
30
51
  cloud_service_details = cloud_services[cloud_service_name]
31
52
  raise StandardError, "No details were found for cloud service #{cloud_service_name}" unless cloud_service_details
32
53
  vmsize = cloud_service_details["vmsize"]
@@ -53,7 +74,7 @@ module QuiversTaskrunner
53
74
  subscription_id = EnvHelper.get_env("azure_subscription_id")
54
75
 
55
76
  # 2. Load secrets
56
- storage = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/storage.yml"), env)
77
+ storage = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:storage]), env, @@get_settings_options)
57
78
  storage_details = storage["blob"]
58
79
  raise StandardError, "No details were found for blob storage for the #{env} environment" unless storage_details
59
80
 
@@ -102,11 +123,11 @@ module QuiversTaskrunner
102
123
 
103
124
  def deploy_blob_pkg_to_staging(cloud_service_name, blob_pkg_name, pkg_dir, labels, options={})
104
125
  # 1. Load cloud service's details
105
- verbose = EnvHelper.get_env("verbose") || false
126
+ verbose = (defined? ARGV) && (!ARGV.nil?) && (!ARGV.empty?) && (ARGV.detect( |x| x == "verbose"))
106
127
  env = options[:env] || EnvHelper.get_env("env")
107
128
  timeout = options[:timeout] || 20*60 # 20 minutes
108
129
  update_message_on = is_update_message_on
109
- cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/cloud_services.yml"), env)
130
+ cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:cloud_services]), env, @@get_settings_options)
110
131
  cloud_service_details = cloud_services[cloud_service_name]
111
132
  raise StandardError, "No details were found for cloud service #{cloud_service_name}" unless cloud_service_details
112
133
  if verbose
@@ -114,7 +135,7 @@ module QuiversTaskrunner
114
135
  puts cloud_service_details
115
136
  end
116
137
  # 2. Load storage details
117
- storage = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/storage.yml"), env)
138
+ storage = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:storage]), env, @@get_settings_options)
118
139
  storage_details = storage["blob"]
119
140
  raise StandardError, "No details were found for blob storage for the #{env} environment" unless storage_details
120
141
 
@@ -197,7 +218,7 @@ module QuiversTaskrunner
197
218
  env = options[:env] || EnvHelper.get_env("env")
198
219
  timeout = options[:timeout] || 20*60 # 20 minutes
199
220
  update_message_on = is_update_message_on
200
- cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/cloud_services.yml"), env)
221
+ cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:cloud_services]), env, @@get_settings_options)
201
222
  cloud_service_details = cloud_services[cloud_service_name]
202
223
  cloud_srv_name = cloud_service_details["name"]
203
224
 
@@ -250,7 +271,7 @@ module QuiversTaskrunner
250
271
 
251
272
  # 1. Load cloud service's details
252
273
  env = env || EnvHelper.get_env("env")
253
- cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, "secrets/cloud_services.yml"), env)
274
+ cloud_services = SettingsHelper.get_settings(File.join(Dir.pwd, @@secrets[:cloud_services]), env, @@get_settings_options)
254
275
  cloud_service_details = cloud_services[cloud_service_name]
255
276
  raise StandardError, "No details were found for cloud service #{cloud_service_name}" unless cloud_service_details
256
277
  cloud_srv_name = cloud_service_details["name"]
@@ -8,7 +8,7 @@ module QuiversTaskrunner
8
8
  module_function
9
9
 
10
10
  def get_settings(filepath, env={}, options={})
11
- verbose = EnvHelper.get_env("verbose") || false
11
+ verbose = (defined? ARGV) && (!ARGV.nil?) && (!ARGV.empty?) && (ARGV.detect( |x| x == "verbose"))
12
12
  environment = env.is_a?(Hash) ? "defaults" : env
13
13
  file_contents = open(filepath).read
14
14
  YAML.load(ERB.new(file_contents).result).to_hash
@@ -36,17 +36,15 @@ module QuiversTaskrunner
36
36
 
37
37
  def get_cli_settings(options={})
38
38
  # Returns a Hash
39
- verbose = EnvHelper.get_env("verbose") || false
39
+ verbose = (defined? ARGV) && (!ARGV.nil?) && (!ARGV.empty?) && (ARGV.detect( |x| x == "verbose"))
40
40
  if verbose
41
41
  puts "ARGV:".colorize(:yellow)
42
42
  puts ARGV
43
43
  end
44
44
  separator = options[:sep] || "="
45
- ignore_keys = options[:ignore_keys]
45
+ ignore_keys = options[:cli_params_black_list]
46
46
  if defined? ARGV && !ARGV.empty?
47
- puts ignore_keys
48
47
  ignore_keys_exist = (defined? ignore_keys) && (!ignore_keys.nil?) && (ignore_keys.is_a?(Array)) && (!ignore_keys.empty?)
49
- puts ignore_keys_exist
50
48
  filtered_args =
51
49
  if (ignore_keys_exist)
52
50
  formatted_ignore_keys = ignore_keys.map { |x| "#{x}#{separator}" }
@@ -1 +1 @@
1
- module QuiversTaskrunner
1
+ module QuiversTaskrunner
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: quiverstaskrunner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.254104
4
+ version: 0.1.254172
5
5
  platform: ruby
6
6
  authors:
7
7
  - ndao