[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[virt-tools-list] [libosinfo 09/11] Add osinfo_install_config_new_for_script



In order to be able to automatically transform configuration parameters set
on OsinfoInstallConfig instances (ie translate from generic value to
OS-specific value), we need to have access to the
OsinfoInstallConfigParamList for the current OsinfoInstallScript as
this is where the OsinfoDatamaps needed to do the remapping are stored.

After the previous commits we can now associate an
OsinfoInstallConfigParamList with an OsinfoInstallConfig instance,
and we can get the OsinfoInstallConfigParamList corresponding to
an OsinfoInstallScript instance, so this commit just adds a new
osinfo_install_config_new_for_script which will create a new
OsinfoInstallConfig instance associated with the
OsinfoInstallConfigParamList for a given installation script.
---
 osinfo/libosinfo.syms          |  1 +
 osinfo/osinfo_install_config.c | 22 +++++++++++++++++++---
 osinfo/osinfo_install_config.h |  3 +++
 3 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/osinfo/libosinfo.syms b/osinfo/libosinfo.syms
index a0a5891..2e8963a 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -351,6 +351,7 @@ LIBOSINFO_0.2.2 {
 	osinfo_entity_get_param_value_enum;
 	osinfo_entity_set_param_enum;
 
+	osinfo_install_config_new_for_script;
 	osinfo_install_config_get_avatar_disk;
 	osinfo_install_config_set_avatar_disk;
 	osinfo_install_config_get_avatar_location;
diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c
index 6fdc61f..d1a0dd5 100644
--- a/osinfo/osinfo_install_config.c
+++ b/osinfo/osinfo_install_config.c
@@ -182,9 +182,25 @@ osinfo_install_config_init (OsinfoInstallConfig *config)
  */
 OsinfoInstallConfig *osinfo_install_config_new(const gchar *id)
 {
-    return g_object_new(OSINFO_TYPE_INSTALL_CONFIG,
-                        "id", id,
-                        NULL);
+    return osinfo_install_config_new_for_script(id, NULL);
+}
+
+
+OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id,
+                                                          OsinfoInstallScript *script)
+{
+    OsinfoInstallConfigParamList *params = NULL;
+    OsinfoInstallConfig *config;
+
+    if (script != NULL)
+        params = osinfo_install_script_get_config_paramlist(script);
+
+    config = g_object_new(OSINFO_TYPE_INSTALL_CONFIG,
+                          "id", id,
+                          "valid-params", params,
+                          NULL);
+
+    return config;
 }
 
 void osinfo_install_config_set_hardware_arch(OsinfoInstallConfig *config,
diff --git a/osinfo/osinfo_install_config.h b/osinfo/osinfo_install_config.h
index e0f7e65..25c9462 100644
--- a/osinfo/osinfo_install_config.h
+++ b/osinfo/osinfo_install_config.h
@@ -72,6 +72,8 @@ typedef struct _OsinfoInstallConfig        OsinfoInstallConfig;
 typedef struct _OsinfoInstallConfigClass   OsinfoInstallConfigClass;
 typedef struct _OsinfoInstallConfigPrivate OsinfoInstallConfigPrivate;
 
+#include <osinfo/osinfo_install_script.h>
+
 /* object */
 struct _OsinfoInstallConfig
 {
@@ -95,6 +97,7 @@ struct _OsinfoInstallConfigClass
 GType osinfo_install_config_get_type(void);
 
 OsinfoInstallConfig *osinfo_install_config_new(const gchar *id);
+OsinfoInstallConfig *osinfo_install_config_new_for_script(const gchar *id, OsinfoInstallScript *script);
 
 void osinfo_install_config_set_hardware_arch(OsinfoInstallConfig *config,
                                              const gchar *arch);
-- 
1.8.0.1


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]