[virt-tools-list] [libosinfo PATCHv2 09/11] Add osinfo_install_config_new_for_script
Christophe Fergeau
cfergeau at redhat.com
Tue Dec 11 18:20:13 UTC 2012
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 9ff1523..c5ab005 100644
--- a/osinfo/libosinfo.syms
+++ b/osinfo/libosinfo.syms
@@ -387,6 +387,7 @@ LIBOSINFO_0.2.3 {
osinfo_db_get_datamap;
osinfo_db_get_datamap_list;
+ osinfo_install_config_new_for_script;
osinfo_install_config_get_valid_params;
osinfo_install_config_set_valid_params;
diff --git a/osinfo/osinfo_install_config.c b/osinfo/osinfo_install_config.c
index 6fdc61f..52eb062 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_params(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
More information about the virt-tools-list
mailing list