diff --git a/.expeditor/automate_build.sh b/.expeditor/automate_build.sh index c16289f3f5..833f6df448 100755 --- a/.expeditor/automate_build.sh +++ b/.expeditor/automate_build.sh @@ -42,6 +42,10 @@ HAB_FEAT_OFFLINE_INSTALL=true HAB_FEAT_IGNORE_LOCAL=false HAB_ORIGIN=chef HAB_CA git clone https://github.com/chef/automate.git cd automate +if [ "${AUTOMATE_BRANCH}" != "" ] +then + git checkout "${AUTOMATE_BRANCH}" +fi RESOLVED_RESULTS_DIR=$(realpath results/) export DO_CHECK=true diff --git a/.expeditor/chef_server.sh b/.expeditor/chef_server.sh index 622f8df755..2141d867cd 100755 --- a/.expeditor/chef_server.sh +++ b/.expeditor/chef_server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e #=============================================================================== #Downloading the automate repo @@ -6,7 +6,10 @@ git clone https://github.com/chef/automate.git cd automate -git checkout kalroy/cs_plan_changes +if [ "${AUTOMATE_BRANCH}" != "" ] +then + git checkout "${AUTOMATE_BRANCH}" +fi #=============================================================================== chmod +x ./integration/tests/chef_server.sh diff --git a/.expeditor/chef_server_only.sh b/.expeditor/chef_server_only.sh index 6d0ddcdc02..a9cf0aa28a 100755 --- a/.expeditor/chef_server_only.sh +++ b/.expeditor/chef_server_only.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e #=============================================================================== #Downloading the automate repo @@ -6,7 +6,10 @@ git clone https://github.com/chef/automate.git cd automate -git checkout kalroy/cs_plan_changes +if [ "${AUTOMATE_BRANCH}" != "" ] +then + git checkout "${AUTOMATE_BRANCH}" +fi #=============================================================================== chmod +x ./integration/tests/chef_server_only.sh diff --git a/.expeditor/ha_chef_server.sh b/.expeditor/ha_chef_server.sh index ceb2b4bdaf..dd9099c4e0 100644 --- a/.expeditor/ha_chef_server.sh +++ b/.expeditor/ha_chef_server.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -e #=============================================================================== #Downloading the automate repo @@ -6,7 +6,10 @@ git clone https://github.com/chef/automate.git cd automate -git checkout kalroy/cs_plan_changes +if [ "${AUTOMATE_BRANCH}" != "" ] +then + git checkout "${AUTOMATE_BRANCH}" +fi #=============================================================================== diff --git a/.expeditor/verify.pipeline.yml b/.expeditor/verify.pipeline.yml index 7c7d3cc809..c08df71858 100644 --- a/.expeditor/verify.pipeline.yml +++ b/.expeditor/verify.pipeline.yml @@ -259,6 +259,14 @@ steps: - .expeditor/ha_chef_server.sh env: IS_AUTOMATE: true + DOCKER_CONFIG: /var/lib/buildkite-agent/.docker + HAB_BLDR_CHANNEL: "stable" + #HAB_STUDIO_SECRET_HAB_BLDR_CHANNEL: "curl8" + #HAB_FALLBACK_CHANNEL: "stable" + HAB_STUDIO_SECRET_HAB_FALLBACK_CHANNEL: "stable" + GOPROXY: "https://proxy.golang.org,direct" + GOSUMDB: "sum.golang.org" + PGGSSENCMODE: "disable" timeout_in_minutes: 35 expeditor: secrets: diff --git a/.license_scout.yml b/.license_scout.yml index 519686d964..0e63904ddf 100644 --- a/.license_scout.yml +++ b/.license_scout.yml @@ -213,4 +213,6 @@ exceptions: reason: Exception made by Chef Legal - name: core/nss-myhostname reason: Exception made by Chef Legal + - name: core/xz + reason: Exception made by Chef Legal diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b1363452e..df1cb3b935 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,27 +1,36 @@ # Chef Server Changelog - -## [15.10.20](https://github.com/chef/chef-server/tree/15.10.20) (2024-11-22) + +## [15.10.24](https://github.com/chef/chef-server/tree/15.10.24) (2024-12-20) #### Merged Pull Requests -- Telemetry automate changes. [#3946](https://github.com/chef/chef-server/pull/3946) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) +- postgresql 13.14 -> 13.18 (CVE-2024-7348) [#3952](https://github.com/chef/chef-server/pull/3952) ([lbakerchef](https://github.com/lbakerchef)) - -### Changes since 15.10.12 release + +### Changes since 15.10.21 release #### Merged Pull Requests -- Telemetry automate changes. [#3946](https://github.com/chef/chef-server/pull/3946) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) -- License Enforcement Application [#3929](https://github.com/chef/chef-server/pull/3929) ([jashaik](https://github.com/jashaik)) -- Open-Search upgraded to 1.3.19 [#3931](https://github.com/chef/chef-server/pull/3931) ([talktovikas](https://github.com/talktovikas)) -- Build tests for embedded Chef-Server in Automate [#3917](https://github.com/chef/chef-server/pull/3917) ([talktovikas](https://github.com/talktovikas)) -- added updated production url spelling [#3908](https://github.com/chef/chef-server/pull/3908) ([vviveksharma](https://github.com/vviveksharma)) -- License Usage Pointer Update [#3906](https://github.com/chef/chef-server/pull/3906) ([dishanktiwari2501](https://github.com/dishanktiwari2501)) -- Update README file [#3905](https://github.com/chef/chef-server/pull/3905) ([kalroy](https://github.com/kalroy)) -- Added telemetry section in README [#3870](https://github.com/chef/chef-server/pull/3870) ([kalroy](https://github.com/kalroy)) +- postgresql 13.14 -> 13.18 (CVE-2024-7348) [#3952](https://github.com/chef/chef-server/pull/3952) ([lbakerchef](https://github.com/lbakerchef)) +- Pinning meck to 0.9.2. [#3966](https://github.com/chef/chef-server/pull/3966) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) +- Space changes to trigger version bump. [#3965](https://github.com/chef/chef-server/pull/3965) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) +## [15.10.21](https://github.com/chef/chef-server/tree/15.10.21) (2024-12-04) + +#### Merged Pull Requests +- Added telemetry section in README [#3870](https://github.com/chef/chef-server/pull/3870) ([kalroy](https://github.com/kalroy)) +- Update README file [#3905](https://github.com/chef/chef-server/pull/3905) ([kalroy](https://github.com/kalroy)) +- License Usage Pointer Update [#3906](https://github.com/chef/chef-server/pull/3906) ([dishanktiwari2501](https://github.com/dishanktiwari2501)) +- added updated production url spelling [#3908](https://github.com/chef/chef-server/pull/3908) ([vviveksharma](https://github.com/vviveksharma)) +- Build tests for embedded Chef-Server in Automate [#3917](https://github.com/chef/chef-server/pull/3917) ([talktovikas](https://github.com/talktovikas)) +- Open-Search upgraded to 1.3.19 [#3931](https://github.com/chef/chef-server/pull/3931) ([talktovikas](https://github.com/talktovikas)) +- License Enforcement Application [#3929](https://github.com/chef/chef-server/pull/3929) ([jashaik](https://github.com/jashaik)) +- Telemetry automate changes. [#3946](https://github.com/chef/chef-server/pull/3946) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) +- Telemetry code refactor. [#3948](https://github.com/chef/chef-server/pull/3948) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) + + ## [15.10.12](https://github.com/chef/chef-server/tree/15.10.12) (2024-08-29) #### Merged Pull Requests @@ -48,7 +57,6 @@ - Update the supported platforms [#3890](https://github.com/chef/chef-server/pull/3890) ([kalroy](https://github.com/kalroy)) - Fix for 12.17.15 -> 15.10.X upgrade [#3902](https://github.com/chef/chef-server/pull/3902) ([jashaik](https://github.com/jashaik)) - Fixing verify pipeline fixes. [#3903](https://github.com/chef/chef-server/pull/3903) ([sreepuramsudheer](https://github.com/sreepuramsudheer)) - ## [15.9.38](https://github.com/chef/chef-server/tree/15.9.38) (2024-05-30) diff --git a/README.md b/README.md index 58d9393170..3b4ac4e82f 100644 --- a/README.md +++ b/README.md @@ -129,7 +129,7 @@ If you're looking to contribute to certain parts of the Chef Infra Server, famil ## Chef Expeditor -The `chef/chef-server` repository, like many other Chef Software repositories, leverages an internal utility called Chef Expeditor to create a pub-sub model of actions across our various CI/CD utilities. +The `chef/chef-server` repository, like many other Chef Software repositories, leverages an internal utility called Chef Expeditor to create a pub-sub model of actions across our various CI/CD utilities. ## Contributing diff --git a/VERSION b/VERSION index 79aed8a5b3..6f658702e1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -15.10.20 \ No newline at end of file +15.10.24 \ No newline at end of file diff --git a/dev/defaults.yml b/dev/defaults.yml index 0210d9714e..3423bb3494 100644 --- a/dev/defaults.yml +++ b/dev/defaults.yml @@ -200,7 +200,7 @@ projects: # itself at this time. source_path: ../../src/chef-server-ctl/plugins # TODO - the gem version will eventually change, we need a good way to keep it in sync with our ruby version - dest_path: /opt/opscode/embedded/lib/ruby/gems/3.0.1/gems/chef-server-ctl-1.1.0/plugins + dest_path: /opt/opscode/embedded/lib/ruby/gems/3.1.6/gems/chef-server-ctl-1.1.0/plugins reconfigure_on_load: false upgrades: source_path: private-chef-upgrades diff --git a/omnibus/config/software/postgresql13.rb b/omnibus/config/software/postgresql13.rb index 98b9997bc9..2f13fbca44 100644 --- a/omnibus/config/software/postgresql13.rb +++ b/omnibus/config/software/postgresql13.rb @@ -16,7 +16,7 @@ name "postgresql13" -default_version "13.14" +default_version "13.18" license "PostgreSQL" license_file "COPYRIGHT" @@ -30,6 +30,7 @@ dependency "config_guess" source url: "https://ftp.postgresql.org/pub/source/v#{version}/postgresql-#{version}.tar.bz2" +version("13.18") { source sha256: "ceea92abee2a8c19408d278b68de6a78b6bd3dbb4fa2d653fa7ca745d666aab1" } version("13.14") { source sha256: "b8df078551898960bd500dc5d38a177e9905376df81fe7f2b660a1407fa6a5ed" } version("13.5") { source sha256: "9b81067a55edbaabc418aacef457dd8477642827499560b00615a6ea6c13f6b3" } version("13.6") { source sha256: "bafc7fa3d9d4da8fe71b84c63ba8bdfe8092935c30c0aa85c24b2c08508f67fc" } diff --git a/omnibus_overrides.rb b/omnibus_overrides.rb index 361c4230fb..f5f39970b0 100644 --- a/omnibus_overrides.rb +++ b/omnibus_overrides.rb @@ -4,13 +4,13 @@ # override :erlang, version: "24.3.2" override :'omnibus-ctl', version: "main" -override :chef, version: "v17.10.0" +override :chef, version: "v18.6.1" override :ohai, version: "v16.17.0" -override :ruby, version: "3.0.1" +override :ruby, version: "3.1.6" override :perl, version: "5.34.0" override :redis, version: "5.0.14" override :runit, version: "2.1.1" #standalone upgrade is failing, Needs to be reverted to 2.1.2 after fixing the umbrella -override :sqitch, version: "0.973" +override :sqitch, version: "1.4.0" override :logrotate, version: "3.19.0" diff --git a/src/bookshelf/habitat/plan.sh b/src/bookshelf/habitat/plan.sh index a91702cc0c..8bbb9d5db7 100644 --- a/src/bookshelf/habitat/plan.sh +++ b/src/bookshelf/habitat/plan.sh @@ -7,7 +7,7 @@ pkg_deps=( core/cacerts core/coreutils core/gcc-libs - core/sqitch_pg + core/sqitch ) pkg_build_deps=(core/make core/git core/gcc) pkg_bin_dirs=(bin) diff --git a/src/bookshelf/rebar.config b/src/bookshelf/rebar.config index bbd193b19e..c76fd0acd1 100644 --- a/src/bookshelf/rebar.config +++ b/src/bookshelf/rebar.config @@ -27,7 +27,8 @@ {iso8601, ".*", {git, "https://github.com/erlsci/iso8601", {tag, "1.2.3"}}}, {meck, ".*", - {git, "https://github.com/eproxus/meck", {branch, "master"}}}, + %% NOTE: Pinning version as main branch wants minimum_otp_vsn as 25 and we are currently at 24. + {git, "https://github.com/eproxus/meck", {ref, "5aaa24886db404f995c9a91b421367f6bfe6e566"}}}, {mini_s3, ".*", {git, "https://github.com/chef/mini_s3", {branch, "main"}}}, {mixer, ".*", diff --git a/src/chef-server-ctl/habitat/config/secrets-bootstrap.rb b/src/chef-server-ctl/habitat/config/secrets-bootstrap.rb index 9851610b9b..64120ff134 100644 --- a/src/chef-server-ctl/habitat/config/secrets-bootstrap.rb +++ b/src/chef-server-ctl/habitat/config/secrets-bootstrap.rb @@ -1,4 +1,4 @@ -#!{{pkgPathFor "core/ruby30"}}/bin/ruby +#!{{pkgPathFor "core/ruby31"}}/bin/ruby require "toml" require "openssl" diff --git a/src/chef-server-ctl/habitat/plan.sh b/src/chef-server-ctl/habitat/plan.sh index d7416f2feb..23217280f5 100644 --- a/src/chef-server-ctl/habitat/plan.sh +++ b/src/chef-server-ctl/habitat/plan.sh @@ -6,7 +6,7 @@ pkg_deps=( core/coreutils core/curl core/jq-static - core/ruby30 + core/ruby31/3.1.6/20240912144513 core/libffi core/postgresql-client core/gcc-libs @@ -115,7 +115,7 @@ EOF for i in chef-server-test knife chef-server-ctl; do sed -i "s#__PKG_PATH__#${pkg_prefix}#" $wrapper_bin_path/$i - sed -i "s#__RUBY_PATH__#$(pkg_path_for core/ruby30)#" $wrapper_bin_path/$i + sed -i "s#__RUBY_PATH__#$(pkg_path_for core/ruby31)#" $wrapper_bin_path/$i done } diff --git a/src/oc-id/habitat/plan.sh b/src/oc-id/habitat/plan.sh index 6d8e7c2979..e894ceea99 100644 --- a/src/oc-id/habitat/plan.sh +++ b/src/oc-id/habitat/plan.sh @@ -3,10 +3,10 @@ pkg_origin=chef pkg_maintainer="The Chef Server Maintainers " pkg_license=('Apache-2.0') pkg_deps=( - core/sqitch_pg + core/sqitch core/curl core/node14 - core/ruby30 + core/ruby31/3.1.6/20240912144513 core/rsync core/sed core/libffi diff --git a/src/oc_bifrost/habitat/plan.sh b/src/oc_bifrost/habitat/plan.sh index 04f7c34200..30c2be9d6c 100644 --- a/src/oc_bifrost/habitat/plan.sh +++ b/src/oc_bifrost/habitat/plan.sh @@ -8,7 +8,7 @@ pkg_deps=( core/coreutils core/curl core/gcc-libs - core/sqitch_pg + core/sqitch ) pkg_build_deps=(core/make core/git core/gcc) pkg_bin_dirs=(bin) diff --git a/src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_worker.erl b/src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_worker.erl index 285274359c..6ae63673e5 100644 --- a/src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_worker.erl +++ b/src/oc_erchef/apps/chef_telemetry/src/chef_telemetry_worker.erl @@ -18,11 +18,13 @@ ]). -record(current_scan, { + total_nodes = 0, + active_nodes = 0, + company_name = <<"">>, + fqdns = [], + license_id, scan_start_time, - scan_end_time, - total_nodes, - active_nodes, - company_name + scan_end_time }). -record(state, { @@ -91,6 +93,10 @@ handle_cast(send_data, State) -> try send_data(State) of State1 -> State1 catch + _:_ when State#state.ctl_command /= "Hab infra server" andalso State#state.ctl_command /= "chef-server-ctl" -> + timer:apply_after(60 * 1000, gen_server, cast, [self(), send_data]), + sqerl:execute(<<"delete from telemetry where property = 'last_send'">>), + State; _:_ -> State end, @@ -145,16 +151,17 @@ send_data(State) -> case chef_telemetry:is_enabled() of true -> State1 = init_req(State), - Hostname = get_fqdn(), - case check_send(Hostname) of + NodeName = to_binary("NODE:" ++ binary:bin_to_list(envy:get(oc_chef_wm, actions_fqdn, <<"">>, binary))), + case check_send(NodeName) of true -> [{_Server, ServerVersion, _, _}] = release_handler:which_releases(permanent), - State2 = get_nodes(State1), - State3 = get_company_name(State2), - State4 = get_api_fqdn(State3), - Req = generate_request(ServerVersion, State4), - send_req(Req, State3), - State3; + Funs = [fun get_total_nodes/1, fun get_active_nodes/1, fun get_company_name/1, fun get_api_fqdn/1, fun determine_license_id/1], + Pid = self(), + Res = [ erlang:spawn_monitor(runner(Pid, State1, Fun)) || Fun <- Funs ], + Current_scan = gather_res(Res, State1#state.current_scan, length(Funs)), + Req = generate_request(ServerVersion, State1#state{current_scan = Current_scan}), + send_req(Req, State1), + State1; _ -> State1 end; @@ -163,15 +170,15 @@ send_data(State) -> end, State6. -get_api_fqdn(State) -> - sqerl:execute(<<"delete from telemetry where property like 'FQDN:%' and event_timestamp < (current_timestamp - interval '86700')">>), - case sqerl:execute(<<"select trim(property) as property from telemetry where property like 'FQDN:%'">>) of +get_api_fqdn(_State) -> + sqerl:execute(<<"delete from telemetry where property like 'NODE:%' and event_timestamp < (current_timestamp - interval '86700')">>), + case sqerl:execute(<<"select trim(property) as property from telemetry where property like 'NODE:%'">>) of {ok, Rows} when is_list(Rows) -> FQDNs = [binary:part(FQDN, 5, size(FQDN) -5) || [{<<"property">>, FQDN}] <- Rows], FQDNs1 = mask(FQDNs), - State#state{fqdns = FQDNs1}; + FQDNs1; _ -> - State + [] end. get_org_nodes(OrgName, Query1, ReqId, DbContext) -> @@ -208,7 +215,7 @@ get_license_company_name()-> {_Lic, _Type, _GracePeriod, _ExpDate, _Msg, CN,_LID} = chef_license:get_license(), CN. -determine_license_id()-> +determine_license_id(_State)-> {_Lic, _Type, _GracePeriod, _ExpDate, _Msg, _CN, LicenseID} = chef_license:get_license(), case LicenseID of undefined -> @@ -221,8 +228,7 @@ determine_license_id()-> LicenseID end. - -get_company_name(State) -> +get_company_name(_State) -> CompanyName = case get_license_company_name() of CN when CN =:= undefined; CN=:= <<"">>; CN =:= "" -> @@ -250,9 +256,7 @@ get_company_name(State) -> end; CN -> CN end, - CurrentScan = State#state.current_scan, - State#state{ - current_scan = CurrentScan#current_scan{company_name = CompanyName}}. + CompanyName. get_most_occuring(List) -> FirstElement = lists:nth(1, List), @@ -274,17 +278,20 @@ get_most_occuring(List) -> Res1 = maps:fold(Fun1, {FirstElement, 0}, Map1), element(1, Res1). -get_nodes(#state{req_id = ReqId, db_context = DbContext} = State) -> +get_total_nodes(State) -> + Count = + case chef_db:count_nodes(State#state.db_context) of + Count1 when is_integer(Count1) -> Count1; + Error -> throw({db_error, Error}) + end, + Count. + +get_active_nodes(#state{req_id = ReqId, db_context = DbContext} = State) -> CurrentScan = State#state.current_scan, ScanStartTime = CurrentScan#current_scan.scan_start_time, ScanEndTime = CurrentScan#current_scan.scan_end_time, QueryString = lists:flatten(io_lib:format("ohai_time:{~p TO ~p}", [ScanStartTime, ScanEndTime])), Query1 = chef_index:query_from_params("node", QueryString, "0", "10000"), - Count = - case chef_db:count_nodes(DbContext) of - Count1 when is_integer(Count1) -> Count1; - Error -> throw({db_error, Error}) - end, Orgs = case chef_db:list(#oc_chef_organization{}, DbContext) of Orgs1 when is_list(Orgs1) -> Orgs1; @@ -295,15 +302,12 @@ get_nodes(#state{req_id = ReqId, db_context = DbContext} = State) -> Sum + Nodes end, ActiveNodes = lists:foldl(Fun, 0, Stats), - State#state{ - current_scan = CurrentScan#current_scan{ - total_nodes = Count, - active_nodes = ActiveNodes}}. + ActiveNodes. generate_request(ServerVersion, State) -> CurrentScan = State#state.current_scan, Res = jiffy:encode({[ - {<<"licenseId">>, determine_license_id()}, + {<<"licenseId">>, CurrentScan#current_scan.license_id}, {<<"customerName">>, State#state.current_scan#current_scan.company_name}, {<<"periods">>, [ {[ @@ -337,7 +341,7 @@ generate_request(ServerVersion, State) -> {<<"Infra Server">>, {[ {<<"deploymentType">>, <<"">>}, {<<"instanceId">>, <<"">>}, - {<<"fqdn">>, State#state.fqdns}, + {<<"fqdn">>, CurrentScan#current_scan.fqdns}, {<<"config_location">>, to_binary(State#state.running_file)}, {<<"binary_location">>, to_binary(State#state.ctl_command)} ]}} @@ -373,10 +377,6 @@ check_send(Hostname) -> Error end. -get_fqdn() -> - HostName = binary:bin_to_list(envy:get(oc_chef_wm, actions_fqdn, <<"">>, binary)), - to_binary("FQDN:" ++ HostName). - mask(FQDNs) -> Join = fun(Elements, Separator) -> [H | T] = Elements, @@ -439,3 +439,41 @@ mask(FQDNs) -> end end, lists:map(Fun, FQDNs). + +runner(Parent, State, Fun) -> + fun() -> + Res = Fun(State), + Parent ! {result, self(), Res} + end. + +gather_res(_Ids, Res, Count) when Count =< 0-> + Res; + +gather_res(Ids, Res, Count) -> + Fun = fun(Id) -> + fun({Id1,_}) -> + Id =/= Id1 + end + end, + receive + {result, Id, Ret} -> + case lists:search(Fun(Id), Ids) of + {value, _} -> + Res1 = erlang:setelement(length(lists:takewhile(Fun(Id), Ids)) + 2, Res, Ret), + gather_res(Ids, Res1, Count - 1); + _ -> + gather_res(Ids, Res, Count) + end; + {'DOWN', _Ref, process, _Id, normal} -> + gather_res(Ids, Res, Count); + {'DOWN', _Ref, process, Id, _Reason} -> + case lists:search(Fun(Id), Ids) of + {value, _} -> + gather_res(Ids, Res, Count - 1); + _ -> + gather_res(Ids, Res, Count) + end + after + 60000 -> + Res + end. \ No newline at end of file diff --git a/src/oc_erchef/apps/chef_telemetry/test/chef_telemetry_worker_test.erl b/src/oc_erchef/apps/chef_telemetry/test/chef_telemetry_worker_test.erl index d4494d5935..5fd91fdaba 100644 --- a/src/oc_erchef/apps/chef_telemetry/test/chef_telemetry_worker_test.erl +++ b/src/oc_erchef/apps/chef_telemetry/test/chef_telemetry_worker_test.erl @@ -64,7 +64,8 @@ enable_flag_test() -> execute(State, Expected, Env) -> set_env([{chef_telemetry, reporting_url, "http://127.0.0.1:9001/esi/payload:io"}] ++ Env), application:start(ibrowse), - put(state, State), + ets:new(telemetry_worker_test, [set, public, named_table]), + ets:insert(telemetry_worker_test, {state, State}), setup(), chef_telemetry_test_utils:start_server([]), register(telemetry_mock_consumer, self()), @@ -91,28 +92,28 @@ setup() -> meck:expect(release_handler, which_releases, fun(_) -> [{"chef_server", "15.9.38", [], []}] end), meck:expect(stats_hero, ctime, fun(_, _, Fun) -> Fun() end). -get_execute(<<"select trim(property) as property from telemetry where property like 'FQDN:%'">>) -> - State = get(state), +get_execute(<<"select trim(property) as property from telemetry where property like 'NODE:%'">>) -> + [{state, State}] = ets:lookup(telemetry_worker_test, state), State#state.fqdn_select; get_execute(<<"select telemetry_check_send('", _/binary>>) -> - State = get(state), + [{state, State}] = ets:lookup(telemetry_worker_test, state), State#state.should_send; get_execute(_) -> ok. adhoc_select([<<"email">>], <<"users">>, all) -> - State = get(state), + [{state, State}] = ets:lookup(telemetry_worker_test, state), {ok, State#state.user_emails}. count_nodes(_Context) -> - State = get(state), + [{state, State}] = ets:lookup(telemetry_worker_test, state), State#state.nodes_count. chef_db_list(Record, _context) -> RecordName = element(1, Record), - State = get(state), + [{state, State}] = ets:lookup(telemetry_worker_test, state), case RecordName of oc_chef_organization -> State#state.organizations; _ -> [] @@ -123,10 +124,10 @@ org_metadata(_context, OrgName) -> {OrgName1, OrgName1}. index_search(_) -> - State = get(state), + [{state, State}] = ets:lookup(telemetry_worker_test, state), [Nodes | Rest] = State#state.index_search, State1 = State#state{index_search = Rest}, - put(state, State1), + ets:insert(telemetry_worker_test, {state, State1}), {ok, 0, length(Nodes), Nodes}. trigger_send_data() -> diff --git a/src/oc_erchef/habitat/hooks/run b/src/oc_erchef/habitat/hooks/run index d21333dd09..81caa2c413 100644 --- a/src/oc_erchef/habitat/hooks/run +++ b/src/oc_erchef/habitat/hooks/run @@ -6,9 +6,9 @@ export RELX_CONFIG_PATH="{{pkg.svc_config_path}}/sys.config" export VMARGS_PATH="{{pkg.svc_config_path}}/vm.args" export CHEF_SECRETS_DATA=$(cat {{pkg.svc_config_path}}/veil-secrets.json) # these are needed in order to make depselector start up -export PATH={{pkgPathFor "core/ruby30"}}/bin:${PATH} -export GEM_HOME={{pkgPathFor "core/ruby30"}}:{{pkg.path}}/vendor/bundle -export GEM_PATH={{pkgPathFor "core/ruby30"}}:{{pkg.path}}/vendor/bundle +export PATH={{pkgPathFor "core/ruby31"}}/bin:${PATH} +export GEM_HOME={{pkgPathFor "core/ruby31"}}:{{pkg.path}}/vendor/bundle +export GEM_PATH={{pkgPathFor "core/ruby31"}}:{{pkg.path}}/vendor/bundle {{#if cfg.fips_enabled ~}} export OPENSSL_FIPS=1 diff --git a/src/oc_erchef/habitat/plan.sh b/src/oc_erchef/habitat/plan.sh index 521ddc905f..2295a0ec90 100644 --- a/src/oc_erchef/habitat/plan.sh +++ b/src/oc_erchef/habitat/plan.sh @@ -9,8 +9,8 @@ pkg_deps=( core/curl core/openssl core/gcc-libs - core/ruby30 - core/sqitch_pg + core/ruby31/3.1.6/20240912144513 + core/sqitch core/gecode core/libffi core/glibc @@ -75,7 +75,7 @@ do_prepare() { do_build() { - _ruby_dir="$(pkg_path_for core/ruby30)" + _ruby_dir="$(pkg_path_for core/ruby31)" export REL_VERSION=$pkg_version export USE_SYSTEM_GECODE=1 export GEM_HOME="${pkg_path}/vendor/bundle" diff --git a/src/oc_erchef/rebar.config b/src/oc_erchef/rebar.config index ff9336f9a0..f542390b86 100644 --- a/src/oc_erchef/rebar.config +++ b/src/oc_erchef/rebar.config @@ -114,9 +114,10 @@ {profiles, [ {test, [ {deps, [ - meck, + {meck, + {git,"https://github.com/eproxus/meck", {ref,"e48641a20a605174e640ac91a528d443be11c9b9"}}}, {automeck, - {git, "https://github.com/chef/automeck", {branch, "master"}}}, + {git, "https://github.com/chef/automeck", {branch, "otp_24"}}}, %% NOTE: PROPER IS GPL V3, IT MUST REMAIN A TEST ONLY DEP. (Unpin once we're on R19, as proper now requires a recent erlang) {proper, {git, "https://github.com/manopapad/proper", {ref, "cb73e68ad5b46ec11b0accc5c724647556a276a0"}}} ]},