Skip to content

Commit

Permalink
Checking license in the fresh automate installation
Browse files Browse the repository at this point in the history
Signed-off-by: jan shahid shaik <jashaik@progress.com>
  • Loading branch information
jashaik committed Oct 22, 2024
1 parent c7b743f commit 139b7d8
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/oc_erchef/apps/chef_license/src/chef_license_worker.erl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
message
}).

-define(DEFAULT_LICENSE_SCAN_INTERVAL, 6 * 60 * 60 * 1000). %milli seconds
-define(DEFAULT_LICENSE_SCAN_INTERVAL, 30000). %milli seconds

-define(DEFAULT_FILE_PATH, "/tmp/lic").

Expand Down Expand Up @@ -95,6 +95,8 @@ check_license(State) ->
State#state{license_cache=commercial_grace_period, grace_period=true, scanned_time = erlang:timestamp(), expiration_date=ExpDate, message=Msg};
{ok, trial_expired, ExpDate, Msg} ->
State#state{license_cache=trial_expired_expired, license_type = <<"trial">>, grace_period=undefined, scanned_time = erlang:timestamp(), expiration_date=ExpDate, message=Msg};
{error, no_license} ->
State#state{license_cache=trial_expired_expired, license_type = <<"trial">>, grace_period=undefined, scanned_time = erlang:timestamp(), expiration_date="", message=get_alert_message(trial_expired, "")};
{error, _} -> State
end.

Expand Down Expand Up @@ -133,6 +135,13 @@ process_license(LicJson) ->
_ ->
{error, invalid_response}
end;
undefined ->
case ej:get({<<"status">>}, LicJson) of
<<"OK">> ->
{error, no_license};
_ ->
{error, invalid_response}
end;
_ ->
{error, invalid_response}
end.
Expand Down

0 comments on commit 139b7d8

Please sign in to comment.