From a0ebb8d35e41bae075a0762b7002bc4e6a2b6269 Mon Sep 17 00:00:00 2001
From: MostafaTarek124eru
 <48182100+MostafaTarek124eru@users.noreply.github.com>
Date: Mon, 3 Feb 2025 22:03:51 +0200
Subject: [PATCH] fix: correct the path for Chef's cache (#5994)
 
Corrected the path for chef cache in cc_chef, schema-cloud-config-v1,
and test_cc_chef.
 
Reference:https://github.com/canonical/cloud-init/commit/a0ebb8d35e41bae075a0762b7002bc4e6a2b6269
Conflict:(1)not change schema-cloud-config-v1.json and .github-cla-signers
(2)change test_handler_chef.py not test_cc_chef.py for test
 
Fixes GH-5090
---
 cloudinit/config/cc_chef.py                       | 4 ++--
 tests/unittests/test_handler/test_handler_chef.py | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
 
diff --git a/cloudinit/config/cc_chef.py b/cloudinit/config/cc_chef.py
index cb9fe12..21c87e9 100644
--- a/cloudinit/config/cc_chef.py
+++ b/cloudinit/config/cc_chef.py
@@ -29,7 +29,7 @@ CHEF_DIRS = tuple([
     '/etc/chef',
     '/var/log/chef',
     '/var/lib/chef',
-    '/var/cache/chef',
+    '/var/chef/cache',
     '/var/backups/chef',
     '/var/run/chef',
 ])
@@ -55,7 +55,7 @@ CHEF_RB_TPL_DEFAULTS = {
     'validation_cert': None,
     'client_key': '/etc/chef/client.pem',
     'json_attribs': CHEF_FB_PATH,
-    'file_cache_path': '/var/cache/chef',
+    'file_cache_path': '/var/chef/cache',
     'file_backup_path': '/var/backups/chef',
     'pid_file': '/var/run/chef/client.pid',
     'show_time': True,
diff --git a/tests/unittests/test_handler/test_handler_chef.py b/tests/unittests/test_handler/test_handler_chef.py
index 0672ceb..b1d7ff9 100644
--- a/tests/unittests/test_handler/test_handler_chef.py
+++ b/tests/unittests/test_handler/test_handler_chef.py
@@ -132,7 +132,7 @@ class TestChef(FilesystemMockingTestCase):
         environment            "_default"
         node_name              "iid-datasource-none"
         json_attribs           "/etc/chef/firstboot.json"
-        file_cache_path        "/var/cache/chef"
+        file_cache_path        "/var/chef/cache"
         file_backup_path       "/var/backups/chef"
         pid_file               "/var/run/chef/client.pid"
         Chef::Log::Formatter.show_time = true
-- 
2.33.0

