config: Drop support for the `socket-id` configuration key

9a8f30ec5b58 ("obmc-console: Introduce console-id, deprecate socket-id")
replaces the `socket-id` configuration key with a better name. Now that
we've fixed up all in-tree users in OpenBMC with 7a612d4fa70f
("obmc-console: Convert configs from socket-id to console-id"), drop
support for `socket-id`.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ied35025a98db426e27891f32ed4bd661d0edb14c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ae1ecb1..c0a0419 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,6 +20,7 @@
 ### Removed
 
 1. Deprecated D-Bus interface `xyz.openbmc_project.console` is no longer used.
+2. config: Drop support for the `socket-id` configuration key
 
 ## [1.1.0] - 2023-06-07
 
diff --git a/config.c b/config.c
index 3d7bd20..cac872d 100644
--- a/config.c
+++ b/config.c
@@ -348,10 +348,6 @@
 		return configured;
 	}
 
-	if ((configured = config_get_value(config, "socket-id"))) {
-		return configured;
-	}
-
 	return DEFAULT_CONSOLE_ID;
 }
 
diff --git a/test/test-config-resolve-console-id.c b/test/test-config-resolve-console-id.c
index 319f342..84bc5b3 100644
--- a/test/test-config-resolve-console-id.c
+++ b/test/test-config-resolve-console-id.c
@@ -46,7 +46,11 @@
 	free(buf);
 	console_id = config_resolve_console_id(ctx, NULL);
 
-	assert(!strcmp(console_id, TEST_CONSOLE_ID));
+	/*
+	 * socket-id is no-longer an alias for console-id, therefore we should observe
+	 * DEFAULT_CONSOLE_ID and not TEST_CONSOLE_ID
+	 */
+	assert(!strcmp(console_id, DEFAULT_CONSOLE_ID));
 
 	config_fini(ctx);
 }
@@ -66,8 +70,7 @@
 
 static void test_precedence_cmdline_optarg(void)
 {
-	static const char *const config = "console-id = console\n"
-					  "socket-id = socket\n";
+	static const char *const config = "console-id = console\n";
 	const char *console_id;
 	struct config *ctx;
 	char *buf;
@@ -79,7 +82,6 @@
 	console_id = config_resolve_console_id(ctx, TEST_CONSOLE_ID);
 
 	assert(config_get_value(ctx, "console-id"));
-	assert(config_get_value(ctx, "socket-id"));
 	assert(!strcmp(console_id, TEST_CONSOLE_ID));
 
 	config_fini(ctx);
@@ -87,8 +89,7 @@
 
 static void test_precedence_config_console_id(void)
 {
-	static const char *const config = "console-id = console\n"
-					  "socket-id = socket\n";
+	static const char *const config = "console-id = console\n";
 	const char *console_id;
 	struct config *ctx;
 	char *buf;
@@ -100,32 +101,11 @@
 	console_id = config_resolve_console_id(ctx, NULL);
 
 	assert(config_get_value(ctx, "console-id"));
-	assert(config_get_value(ctx, "socket-id"));
 	assert(!strcmp(console_id, "console"));
 
 	config_fini(ctx);
 }
 
-static void test_precedence_config_socket_id(void)
-{
-	static const char *const config = "socket-id = socket\n";
-	const char *console_id;
-	struct config *ctx;
-	char *buf;
-
-	ctx = calloc(1, sizeof(*ctx));
-	buf = strdup(config);
-	config_parse(ctx, buf);
-	free(buf);
-	console_id = config_resolve_console_id(ctx, NULL);
-
-	assert(!config_get_value(ctx, "console-id"));
-	assert(config_get_value(ctx, "socket-id"));
-	assert(!strcmp(console_id, "socket"));
-
-	config_fini(ctx);
-}
-
 int main(void)
 {
 	test_independence_cmdline_optarg();
@@ -134,7 +114,6 @@
 	test_independence_default();
 	test_precedence_cmdline_optarg();
 	test_precedence_config_console_id();
-	test_precedence_config_socket_id();
 
 	return EXIT_SUCCESS;
 }