chef-licensing 0.4.44 → 1.0.0

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.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/chef-licensing.gemspec +6 -3
  3. data/lib/chef-licensing/config.rb +9 -1
  4. data/lib/chef-licensing/context.rb +36 -1
  5. data/lib/chef-licensing/exceptions/invalid_file_format_version.rb +10 -0
  6. data/lib/chef-licensing/exceptions/license_file_corrupted.rb +9 -0
  7. data/lib/chef-licensing/exceptions/unsupported_content_type.rb +9 -0
  8. data/lib/chef-licensing/license.rb +5 -1
  9. data/lib/chef-licensing/license_key_fetcher/chef_licensing_interactions.yaml +85 -234
  10. data/lib/chef-licensing/license_key_fetcher/file.rb +71 -14
  11. data/lib/chef-licensing/license_key_fetcher/license_file/base.rb +63 -0
  12. data/lib/chef-licensing/license_key_fetcher/license_file/v3.rb +12 -0
  13. data/lib/chef-licensing/license_key_fetcher/license_file/v4.rb +27 -0
  14. data/lib/chef-licensing/license_key_fetcher.rb +45 -20
  15. data/lib/chef-licensing/list_license_keys.rb +9 -3
  16. data/lib/chef-licensing/restful_client/base.rb +62 -26
  17. data/lib/chef-licensing/restful_client/middleware/content_type_validator.rb +24 -0
  18. data/lib/chef-licensing/restful_client/middleware/exceptions_handler.rb +1 -3
  19. data/lib/chef-licensing/restful_client/v1.rb +0 -2
  20. data/lib/chef-licensing/tui_engine/tui_actions.rb +11 -88
  21. data/lib/chef-licensing/version.rb +1 -1
  22. data/lib/chef-licensing.rb +5 -0
  23. metadata +16 -13
  24. data/LICENSE +0 -1
  25. data/lib/chef-licensing/exceptions/license_generation_failed.rb +0 -9
  26. data/lib/chef-licensing/exceptions/license_generation_rejected.rb +0 -7
  27. data/lib/chef-licensing/license_key_generator.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: daba1b4af5298de677c11ea6bdfa10fe560e94f3dc26ba60e68f887be5d3d187
4
- data.tar.gz: c45e92d1bba749e0aff95328df2b35bcba959022584cc07ad2e475f8a89be945
3
+ metadata.gz: 5e5b5b44e654ed1893f1301c716881eb494bcfe486284269523e45e648f6efd9
4
+ data.tar.gz: bce944cdc127668e1b89ab4dde0aa1d11574a37c7958d5b3af6a33101b806ec1
5
5
  SHA512:
6
- metadata.gz: c0ff4a1cf85a1155badc2f18f1e31be42745c8952c495b87ab9af8067d13a3b2568e009c6a9bb0b1abf7812317994cf38d388c0220673e0a2027b590dbab26a8
7
- data.tar.gz: bf7296fdb8806695442b1b19d9968853984def094d126134e03774ec9bfed481cf8a66306848743a8b2c970f35b05dc6708583fe01a8222907435ce96da96ec2
6
+ metadata.gz: 777458fc88ca4e0349697ca50c6da364dd966d15e72c1e5122b504ff8446437827665bd7e0390801e39b6b0d0e826a0c385d434597805459caf26df2f833eba2
7
+ data.tar.gz: cc705ff5a9d5a8f626e74169bb683fd16db9928782226be465669521d2d0a688d644947625cd6ad931ab1fc53a386799aa4e0033296beefa53832361a2956443
@@ -7,12 +7,12 @@ Gem::Specification.new do |spec|
7
7
  spec.version = ChefLicensing::VERSION
8
8
  spec.authors = ["Inspec Team"]
9
9
  spec.email = ["inspec@progress.com"]
10
- spec.license = "LicenseRef-LICENSE"
10
+ spec.license = "Apache-2.0"
11
11
 
12
12
  spec.summary = %q{Chef License storage, generation, and entitlement}
13
13
  spec.description = %q{Ruby library to support CLI tools that use Progress Chef license storage, generation, and entitlement.}
14
14
  spec.homepage = "https://github.com/chef/chef-licensing"
15
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
15
+ spec.required_ruby_version = Gem::Requirement.new(">= 3.1.0")
16
16
 
17
17
  spec.metadata["homepage_uri"] = spec.homepage
18
18
  spec.metadata["source_code_uri"] = "https://github.com/chef/chef-licensing"
@@ -30,6 +30,9 @@ Gem::Specification.new do |spec|
30
30
  spec.add_dependency "tty-prompt", "~> 0.23"
31
31
  spec.add_dependency "faraday", ">= 1", "< 3"
32
32
  spec.add_dependency "faraday-http-cache"
33
- spec.add_dependency "activesupport", "~> 7.0", ">= 7.0.4.2"
33
+ # Note: 7.1.0 does not defaults its cache_format_version to 7.1 but 6.1 instead which gives deprecation warnings
34
+ # Remove the version constraint when we can upgrade to 7.1.1 post stable release of Activesupport 7.1
35
+ # Similar issue with 7.0 existed: https://github.com/rails/rails/pull/45293
36
+ spec.add_dependency "activesupport", "~> 7.0", "< 7.1"
34
37
  spec.add_dependency "tty-spinner", "~> 0.9.3"
35
38
  end
@@ -13,7 +13,7 @@ require_relative "licensing_service/local"
13
13
  module ChefLicensing
14
14
  class Config
15
15
  class << self
16
- attr_writer :license_server_url, :logger, :output, :license_server_url_check_in_file
16
+ attr_writer :license_server_url, :logger, :output, :license_server_url_check_in_file, :license_add_command, :license_list_command
17
17
 
18
18
  # is_local_license_service is used by context class
19
19
  attr_accessor :is_local_license_service, :chef_entitlement_id, :chef_product_name, :chef_executable_name
@@ -39,6 +39,14 @@ module ChefLicensing
39
39
  def output
40
40
  @output ||= STDOUT
41
41
  end
42
+
43
+ def license_add_command
44
+ @license_add_command ||= "license add"
45
+ end
46
+
47
+ def license_list_command
48
+ @license_list_command ||= "license list"
49
+ end
42
50
  end
43
51
  end
44
52
  end
@@ -25,9 +25,20 @@ module ChefLicensing
25
25
  current_context(options).license_keys
26
26
  end
27
27
 
28
+ # Return license context object via current context
29
+ def license(options = {})
30
+ current_context(options).license
31
+ end
32
+
33
+ # Set license context object via current context
34
+ # Example: ChefLicensing::Context.license = license_context_object
35
+ def license=(license)
36
+ current_context.license = license
37
+ end
38
+
28
39
  private
29
40
 
30
- def current_context(options)
41
+ def current_context(options = {})
31
42
  return @current_context if @current_context
32
43
 
33
44
  @current_context = context_based_on_state(options)
@@ -63,6 +74,16 @@ module ChefLicensing
63
74
  @state.license_keys
64
75
  end
65
76
 
77
+ # Get license context from local or global state
78
+ def license
79
+ @state.license
80
+ end
81
+
82
+ # Set license context from local or global state
83
+ def license=(license)
84
+ @state.license = license
85
+ end
86
+
66
87
  class State
67
88
  attr_accessor :context, :options
68
89
 
@@ -70,6 +91,20 @@ module ChefLicensing
70
91
  def license_keys
71
92
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
72
93
  end
94
+
95
+ # Get license context in local or global state
96
+ def license
97
+ if license_keys.empty?
98
+ @license ||= nil
99
+ else
100
+ @license ||= ChefLicensing.client(license_keys: license_keys)
101
+ end
102
+ end
103
+
104
+ # Set license context in local or global state
105
+ def license=(license)
106
+ @license ||= license
107
+ end
73
108
  end
74
109
 
75
110
  # Implement various behaviors, associated with a state of the Context.
@@ -0,0 +1,10 @@
1
+ require_relative "error"
2
+
3
+ module ChefLicensing
4
+ class InvalidFileFormatVersion < Error
5
+ def message
6
+ super || "Invalid File Format Version"
7
+ end
8
+ end
9
+ end
10
+
@@ -0,0 +1,9 @@
1
+ require_relative "error"
2
+
3
+ module ChefLicensing
4
+ class LicenseFileCorrupted < Error
5
+ def message
6
+ super || "License file contents are corrupted"
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ require_relative "error"
2
+
3
+ module ChefLicensing
4
+ class UnsupportedContentType < Error
5
+ def message
6
+ super || "Unsupported content type"
7
+ end
8
+ end
9
+ end
@@ -133,6 +133,10 @@ module ChefLicensing
133
133
  status.eql?("Expired")
134
134
  end
135
135
 
136
+ def exhausted?
137
+ status.eql?("Exhausted")
138
+ end
139
+
136
140
  def active?
137
141
  status.eql?("Active")
138
142
  end
@@ -148,4 +152,4 @@ module ChefLicensing
148
152
  status.eql?("Active") && expiration_status.eql?("Expired") && ((1..7).include? number_of_days_in_expiration)
149
153
  end
150
154
  end
151
- end
155
+ end
@@ -7,13 +7,13 @@ interactions:
7
7
  License ID Validation
8
8
 
9
9
  To continue using Chef <%= input[:chef_product_name] %>, a license ID is required.
10
- (Free, Trial, or Commercial)
10
+ (Free Tier, Trial, or Commercial)
11
11
 
12
12
  If you generated a license previously, you might
13
13
  have received it in an email.
14
14
 
15
15
  If you are a commercial user, you can also find it in the
16
- <%= input[:pastel].underline.green("supportlink.chef.io")%> portal.
16
+ <%= input[:pastel].underline.green("https://community.progress.com/s/products/chef")%> portal.
17
17
  ------------------------------------------------------------
18
18
  prompt_type: "say"
19
19
  paths: [ask_if_user_has_license_id]
@@ -46,7 +46,7 @@ interactions:
46
46
  paths: [add_license_info_in_restriction_flow]
47
47
 
48
48
  free_license_already_exist_message:
49
- messages: "A Free License already exists with following details: \n"
49
+ messages: "A Free Tier License already exists with following details: \n"
50
50
  prompt_type: "say"
51
51
  paths: [add_license_info_in_restriction_flow]
52
52
 
@@ -69,20 +69,20 @@ interactions:
69
69
 
70
70
  trial_restriction_message:
71
71
  prompt_type: "say"
72
- messages:
73
- Please generate a Free or Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} license add")%>.
72
+ messages: |
73
+ Please generate a Free Tier or Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} #{ChefLicensing::Config.license_add_command}")%>.
74
74
  paths: [exit_with_message]
75
75
 
76
76
  free_restriction_message:
77
77
  prompt_type: "say"
78
- messages:
79
- Please generate a Trial or Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} license add")%>.
78
+ messages: |
79
+ Please generate a Trial or Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} #{ChefLicensing::Config.license_add_command}")%>.
80
80
  paths: [exit_with_message]
81
81
 
82
82
  only_commercial_allowed_message:
83
83
  prompt_type: "say"
84
- messages:
85
- Please generate a Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} license add")%>.
84
+ messages: |
85
+ Please generate a Commercial License by running <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} #{ChefLicensing::Config.license_add_command}")%>.
86
86
  paths: [exit_with_message]
87
87
 
88
88
  prompt_license_expired:
@@ -90,11 +90,13 @@ interactions:
90
90
  ------------------------------------------------------------
91
91
  <%= input[:pastel].yellow("! [WARNING]")%> <%= input[:license_type] %> License Expired
92
92
 
93
- Get a Commercial License to receive bug fixes, updates
94
- and new features.
95
- Get a Free License to scan limited <%= input[:unit_measure] %>.
93
+ We hope you've been enjoying Chef <%= input[:chef_product_name] %>!
94
+ However, it seems like your license has expired.
96
95
 
97
- To get a new license, run <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} license add")%>
96
+ Reach out to our sales team at <%= input[:pastel].underline.green("chef-sales@progress.com")%>
97
+ to move to commercial tier.
98
+
99
+ To get a new license, run <%= input[:pastel].bold("#{ChefLicensing::Config.chef_executable_name} #{ChefLicensing::Config.license_add_command}") %>
98
100
  and select a license type.
99
101
  ------------------------------------------------------------
100
102
  prompt_type: "say"
@@ -105,9 +107,11 @@ interactions:
105
107
  ------------------------------------------------------------
106
108
  <%= input[:pastel].yellow("! [WARNING]")%> <%= input[:license_type] %> License Expired
107
109
 
108
- Get a Commercial License to receive bug fixes, updates
109
- and new features.
110
- Get a Free License to scan limited <%= input[:unit_measure] %>.
110
+ We hope you've been enjoying Chef <%= input[:chef_product_name] %>!
111
+ However, it seems like your license has expired.
112
+
113
+ Reach out to our sales team at <%= input[:pastel].underline.green("chef-sales@progress.com")%>
114
+ to move to commercial tier.
111
115
  ------------------------------------------------------------
112
116
  prompt_type: "say"
113
117
  paths: [fetch_license_id]
@@ -195,12 +199,13 @@ interactions:
195
199
 
196
200
  validate_license_expiration:
197
201
  action: license_expiration_status?
198
- paths: [validation_success, prompt_license_about_to_expire, prompt_license_expired, prompt_license_expired_local_mode]
202
+ paths: [validation_success, prompt_license_about_to_expire, prompt_license_expired, prompt_license_expired_local_mode, prompt_license_exhausted]
199
203
  response_path_map:
200
204
  "active": validation_success
201
205
  "about_to_expire": prompt_license_about_to_expire
202
206
  "expired": prompt_license_expired
203
207
  "expired_in_local_mode": prompt_license_expired_local_mode
208
+ "exhausted_license": prompt_license_exhausted
204
209
 
205
210
  validation_success:
206
211
  messages: "✔ [Success] License validated successfully."
@@ -257,14 +262,14 @@ interactions:
257
262
  prompt_type: "select"
258
263
  messages: ["Select the type of license below and then enter user details\n" ,
259
264
  [
260
- "1. Free License\n Validity: Unlimited\n No. of units: 10 <%= input[:unit_measure] %>\n",
265
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 <%= input[:unit_measure] %>\n",
261
266
  "2. Commercial License\n",
262
267
  "3. Quit license generation"
263
268
  ]]
264
- paths: [free_license_disclaimer, commercial_license_selection, exit]
269
+ paths: [free_trial_license_selection, commercial_license_selection, exit]
265
270
  response_path_map:
266
- "1. Free License\n Validity: Unlimited\n No. of units: 10 nodes\n": free_license_disclaimer
267
- "1. Free License\n Validity: Unlimited\n No. of units: 10 targets\n": free_license_disclaimer
271
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 nodes\n": free_trial_license_selection
272
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 targets\n": free_trial_license_selection
268
273
  "2. Commercial License\n": commercial_license_selection
269
274
  "3. Quit license generation": exit
270
275
 
@@ -276,10 +281,10 @@ interactions:
276
281
  "2. Commercial License\n",
277
282
  "3. Quit license generation"
278
283
  ]]
279
- paths: [trial_license_selection, commercial_license_selection, exit]
284
+ paths: [free_trial_license_selection, commercial_license_selection, exit]
280
285
  response_path_map:
281
- "1. Trial License\n Validity: 30 Days\n No. of units: Unlimited nodes\n": trial_license_selection
282
- "1. Trial License\n Validity: 30 Days\n No. of units: Unlimited targets\n": trial_license_selection
286
+ "1. Trial License\n Validity: 30 Days\n No. of units: Unlimited nodes\n": free_trial_license_selection
287
+ "1. Trial License\n Validity: 30 Days\n No. of units: Unlimited targets\n": free_trial_license_selection
283
288
  "2. Commercial License\n": commercial_license_selection
284
289
  "3. Quit license generation": exit
285
290
 
@@ -287,34 +292,41 @@ interactions:
287
292
  prompt_type: "select"
288
293
  messages: ["Select the type of license below and then enter user details\n" ,
289
294
  [
290
- "1. Free License\n Validity: Unlimited\n No. of units: 10 <%= input[:unit_measure] %>\n",
295
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 <%= input[:unit_measure] %>\n",
291
296
  "2. Trial License\n Validity: 30 Days\n No. of units: Unlimited <%= input[:unit_measure] %>\n",
292
297
  "3. Commercial License\n",
293
298
  "4. Quit license generation"
294
299
  ]]
295
- paths: [free_license_disclaimer, commercial_license_selection, trial_license_selection, exit]
300
+ paths: [free_trial_license_selection, commercial_license_selection, exit]
296
301
  response_path_map:
297
- "1. Free License\n Validity: Unlimited\n No. of units: 10 nodes\n": free_license_disclaimer
298
- "1. Free License\n Validity: Unlimited\n No. of units: 10 targets\n": free_license_disclaimer
299
- "2. Trial License\n Validity: 30 Days\n No. of units: Unlimited nodes\n": trial_license_selection
300
- "2. Trial License\n Validity: 30 Days\n No. of units: Unlimited targets\n": trial_license_selection
302
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 nodes\n": free_trial_license_selection
303
+ "1. Free Tier License\n Validity: Unlimited\n No. of units: 10 targets\n": free_trial_license_selection
304
+ "2. Trial License\n Validity: 30 Days\n No. of units: Unlimited nodes\n": free_trial_license_selection
305
+ "2. Trial License\n Validity: 30 Days\n No. of units: Unlimited targets\n": free_trial_license_selection
301
306
  "3. Commercial License\n": commercial_license_selection
302
307
  "4. Quit license generation": exit
303
308
 
304
- free_license_disclaimer:
305
- messages: '<%= input[:pastel].bold("A Free License can be used for personal, non-commercial use only.\n")%>'
306
- prompt_type: "warn"
307
- paths: [free_license_selection]
308
-
309
- free_license_selection:
310
- messages: "Type: Free License\n Validity: Unlimited\n No. of units: 10 <%= input[:unit_measure] %>\n"
311
- prompt_type: "silent"
312
- paths: [check_if_user_details_are_present]
309
+ # Note: The below link is specific to InSpec; as per PO there will be different link for other products.
310
+ # We need to update the link for other products once we have the link or update to a common link.
311
+ free_trial_license_selection:
312
+ messages: ["<%= input[:pastel].yellow(\"!\") %> Kindly complete the user registration at <%= input[:pastel].blue.underline.blue(\"https://www.chef.io/license-generation-free-trial\") %>\nOnce you submit the details, you will receive the license ID on the email id you provided.\n\nSelect an option",
313
+ [
314
+ Validate license now,
315
+ Quit and validate license later
316
+ ]
317
+ ]
318
+ prompt_type: "select"
319
+ paths: [validate_license_later_message, ask_for_license_id]
320
+ response_path_map:
321
+ "Validate license now": ask_for_license_id
322
+ "Quit and validate license later": validate_license_later_message
313
323
 
314
- trial_license_selection:
315
- messages: "Type: Trial License\n Validity: 30 days\n No. of units: Unlimited <%= input[:unit_measure] %>\n"
316
- prompt_type: "silent"
317
- paths: [check_if_user_details_are_present]
324
+ # TODO: Update the link for other ways to validate the license document.
325
+ validate_license_later_message:
326
+ messages: |
327
+ You can enter the license later on by selecting <%= input[:pastel].bold("'I already have a license ID'") %> when prompted for license.
328
+ To learn about more ways to enter the license, kindly visit <%= input[:pastel].blue.underline.blue("www.docs.chef.io") %>.
329
+ paths: [exit]
318
330
 
319
331
  commercial_license_selection:
320
332
  messages: ["Get in touch with the Sales Team by filling out the form available at <%= input[:pastel].blue.underline.blue(\"https://www.chef.io/contact-us\") %>\n",
@@ -323,212 +335,51 @@ interactions:
323
335
  prompt_type: "select"
324
336
  paths: [exit_with_message]
325
337
 
326
- check_if_user_details_are_present:
327
- action: are_user_details_present?
328
- paths: [ask_for_user_details, print_to_review_details]
329
- response_path_map:
330
- "true": "print_to_review_details"
331
- "false": "ask_for_user_details"
332
-
333
- ask_for_user_details:
334
- messages: |
335
- Please enter the following details:
336
- First Name, Last Name, Email, Company, Phone
337
-
338
- paths: [gather_user_first_name_for_license_generation]
339
-
340
- gather_user_first_name_for_license_generation:
341
- messages: "Enter First Name: "
342
- prompt_type: "ask"
343
- paths: [validate_user_first_name_for_license_generation]
344
-
345
- validate_user_first_name_for_license_generation:
346
- action: is_user_name_valid?
347
- paths: [gather_user_last_name_for_license_generation, user_first_name_validation_failure]
348
- response_path_map:
349
- "true": gather_user_last_name_for_license_generation
350
- "false": user_first_name_validation_failure
351
-
352
- user_first_name_validation_failure:
353
- messages: "Invalid name. It should contain only A-Z/a-z alphabets."
354
- prompt_type: "error"
355
- paths: [gather_user_first_name_for_license_generation]
356
-
357
- gather_user_last_name_for_license_generation:
358
- messages: "Enter Last Name: "
359
- prompt_type: "ask"
360
- paths: [validate_user_last_name_for_license_generation]
361
-
362
- validate_user_last_name_for_license_generation:
363
- action: is_user_name_valid?
364
- paths: [gather_user_email_for_license_generation, user_last_name_validation_failure]
365
- response_path_map:
366
- "true": gather_user_email_for_license_generation
367
- "false": user_last_name_validation_failure
368
-
369
- user_last_name_validation_failure:
370
- messages: "Invalid name. It should contain only A-Z/a-z alphabets."
371
- prompt_type: "error"
372
- paths: [gather_user_last_name_for_license_generation]
373
-
374
- gather_user_email_for_license_generation:
375
- messages: "Enter Email Address: "
376
- prompt_type: "ask"
377
- paths: [validate_user_email_for_license_generation]
378
-
379
- validate_user_email_for_license_generation:
380
- action: is_email_valid?
381
- paths: [gather_user_company_for_license_generation, user_email_validation_failure]
382
- response_path_map:
383
- "true": gather_user_company_for_license_generation
384
- "false": user_email_validation_failure
385
-
386
- user_email_validation_failure:
387
- messages: "Invalid email address."
388
- prompt_type: "error"
389
- paths: [gather_user_email_for_license_generation]
390
-
391
- gather_user_company_for_license_generation:
392
- messages: "Enter Company Name: "
393
- prompt_type: "ask"
394
- paths: [validate_user_company_name_for_license_generation]
395
-
396
- validate_user_company_name_for_license_generation:
397
- action: is_company_name_valid?
398
- paths: [gather_user_phone_no_for_license_generation, user_company_name_validation_failure]
399
- response_path_map:
400
- "true": gather_user_phone_no_for_license_generation
401
- "false": user_company_name_validation_failure
402
-
403
- user_company_name_validation_failure:
404
- messages: "Invalid company name. It should contain only A-Z/a-z alphabets, numbers or special characters."
405
- prompt_type: "error"
406
- paths: [gather_user_company_for_license_generation]
407
-
408
- gather_user_phone_no_for_license_generation:
409
- messages: "Enter phone number: "
410
- prompt_type: "ask"
411
- paths: [validate_user_phone_no]
338
+ fetch_license_id:
339
+ action: fetch_license_id
340
+ paths: [is_commercial_license]
412
341
 
413
- validate_user_phone_no:
414
- action: is_phone_no_valid?
415
- paths: [print_to_review_details, user_phone_no_validation_failure]
342
+ is_commercial_license:
343
+ action: is_commercial_license?
416
344
  response_path_map:
417
- "true": print_to_review_details
418
- "false": user_phone_no_validation_failure
345
+ "true": exit
346
+ "false": warn_non_commercial_license
347
+ paths: [warn_non_commercial_license, exit]
419
348
 
420
- user_phone_no_validation_failure:
421
- messages: "Please enter a valid phone number."
422
- prompt_type: "error"
423
- paths: [gather_user_phone_no_for_license_generation]
424
-
425
- print_to_review_details:
349
+ warn_non_commercial_license:
426
350
  messages: |
427
351
  ------------------------------------------------------------
428
- Review the details below and confirm to proceed.
429
- ------------------------------------------------------------
430
- License Details
352
+ <%= input[:pastel].yellow("! [WARNING]")%> Non-Commercial License
431
353
 
432
- <%= input[:free_license_selection] || input[:trial_license_selection] %>
433
- User Details
354
+ You are using a <%= input[:license_type].downcase == "free" ? "free tier" : "trial" %> version - not meant for commercial usage.
434
355
 
435
- First Name: <%= input[:gather_user_first_name_for_license_generation] %>
436
- Last Name: <%= input[:gather_user_last_name_for_license_generation] %>
437
- Email: <%= input[:gather_user_email_for_license_generation] %>
438
- Company: <%= input[:gather_user_company_for_license_generation] %>
439
- Phone number: <%= input[:gather_user_phone_no_for_license_generation] %>
356
+ If you are using it for commercial purposes, please reach
357
+ out to our sales team at <%= input[:pastel].underline.green("chef-sales@progress.com")%> to get
358
+ commercial license to be compliant with Progress Chef MLSA.
440
359
  ------------------------------------------------------------
441
360
  prompt_type: "say"
442
- paths: [ask_for_review_confirmation]
443
-
444
- ask_for_review_confirmation:
445
- prompt_type: "select"
446
- messages: ["Please select", ["Confirm the details and proceed", "Reselect the license type", "Edit user details", "Quit the license generation process"]]
447
- paths: [pre_license_generation, clear_current_license_type_selection, ask_for_user_details, exit]
448
- response_path_map:
449
- "Confirm the details and proceed": pre_license_generation
450
- "Reselect the license type": clear_current_license_type_selection
451
- "Edit user details": ask_for_user_details
452
- "Quit the license generation process": exit
453
-
454
- clear_current_license_type_selection:
455
- action: clear_license_type_selection
456
- paths: [info_of_license_types]
457
-
458
- pre_license_generation:
459
- action: select_license_generation_based_on_type
460
- paths: [generate_free_license, generate_trial_license]
461
- response_path_map:
462
- "free": generate_free_license
463
- "trial": generate_trial_license
464
-
465
- generate_free_license:
466
- action: generate_free_license
467
- paths: [free_license_generation_success, license_generation_failure]
468
- response_path_map:
469
- "true": free_license_generation_success
470
- "false": license_generation_failure
471
-
472
- generate_trial_license:
473
- action: generate_trial_license
474
- paths: [trial_license_generation_success, license_generation_failure]
475
- response_path_map:
476
- "true": trial_license_generation_success
477
- "false": license_generation_failure
478
-
479
- free_license_generation_success:
480
- messages: |
481
- <%= input[:pastel].green("✔ [Success] License generated successfully") %>
482
-
483
- The license ID has been sent to <%= input[:gather_user_email_for_license_generation] %>.
484
- paths: [ask_for_license_id]
485
-
486
- trial_license_generation_success:
487
- messages: |
488
- <%= input[:pastel].green("✔ [Success] License generated successfully") %>
489
-
490
- The license ID has been sent to <%= input[:gather_user_email_for_license_generation] %>.
491
- paths: [ask_for_license_id]
492
-
493
- fetch_license_id:
494
- action: fetch_license_id
495
361
  paths: [exit]
496
362
 
497
- license_generation_failure:
498
- messages: "✖ [Error] License generation failed."
499
- prompt_type: "error"
500
- paths: [check_failure_reason]
501
-
502
- check_failure_reason:
503
- action: license_generation_rejected?
504
- paths: [fetch_license_failure_error_msg, fetch_license_failure_rejection_msg]
505
- response_path_map:
506
- "true": fetch_license_failure_rejection_msg
507
- "false": fetch_license_failure_error_msg
508
-
509
- fetch_license_failure_error_msg:
510
- action: fetch_license_failure_error_msg
511
- paths: [license_generation_with_errors]
363
+ prompt_license_exhausted:
364
+ messages: |
365
+ ------------------------------------------------------------
366
+ <%= input[:pastel].yellow("! [WARNING]")%> <%= input[:license_type].capitalize %> License Exhausted
512
367
 
513
- fetch_license_failure_rejection_msg:
514
- action: fetch_license_failure_rejection_msg
515
- paths: [license_generation_rejected]
368
+ We hope you've been enjoying Chef <%= input[:chef_product_name] %>!
369
+ However, it seems like you have exceeded your entitled usage limit on <%= input[:unit_measure] %>.
516
370
 
517
- license_generation_rejected:
518
- messages: ["Your request for a license was denied for the following reason: <%= input[:fetch_license_failure_rejection_msg] %>. Please select one of the following options:", ["Try again", "Skip"]]
519
- prompt_type: "select"
520
- paths: [pre_license_generation, skip_message]
521
- response_path_map:
522
- "Try again": pre_license_generation
523
- "Skip": skip_message
371
+ Reach out to our sales team at <%= input[:pastel].underline.green("chef-sales@progress.com")%>
372
+ to move to commercial-tier.
373
+ ------------------------------------------------------------
374
+ prompt_type: "say"
375
+ paths: [is_run_allowed_on_license_exhausted]
524
376
 
525
- license_generation_with_errors:
526
- messages: ["\nAn error occurred while generating your license.\nError message: <%= input[:fetch_license_failure_error_msg] %>\n", ["Try again", "Skip"]]
527
- prompt_type: "select"
528
- paths: [pre_license_generation, skip_message]
377
+ is_run_allowed_on_license_exhausted:
378
+ action: is_run_allowed_on_license_exhausted?
529
379
  response_path_map:
530
- "Try again": pre_license_generation
531
- "Skip": skip_message
380
+ "true": fetch_license_id
381
+ "false": exit
382
+ paths: [fetch_license_id, exit]
532
383
 
533
384
  exit:
534
385
  messages: ""