Skip to content

Commit

Permalink
Rebuilt nfs section structure
Browse files Browse the repository at this point in the history
enable_nfs4 and idmapd_domain are new global
(optional) elements. Hope it works

svn path=/trunk/nfs-client/; revision=60683
  • Loading branch information
Katarína Machálková committed Feb 3, 2010
1 parent b269908 commit 29e91e5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 17 deletions.
38 changes: 32 additions & 6 deletions src/Nfs.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,33 @@
// list of created directories
list<string> created_dirs = [];

boolean ReadNfs4 () {
return (SCR::Read(.sysconfig.nfs.NFS4_SUPPORT)=="yes");
}

string ReadIdmapd() {
return (string) SCR::Read(.etc.idmapd_conf, "Domain");
}

/**
* Set module data
* @param settings module settings
* @return void
*/
global define void Set(list<map> settings) ``{
nfs_entries = maplist(map entry, settings, ``{
global define void Set(map <string, any> settings) ``{
if ( haskey(settings, "enable_nfs4") ) {
nfs4_enabled = settings["enable_nfs4"]:false;
}
else
nfs4_enabled = ReadNfs4();

if ( haskey(settings, "idmapd_domain") ) {
idmapd_domain = settings["idmapd_domain"]:"localdomain";
}
else
idmapd_domain = ReadIdmapd();

nfs_entries = maplist(map entry, settings["nfs_entries"]:[], ``{
return($[
"spec":entry["server_path"]:"",
"file":entry["mount_point"]:"",
Expand All @@ -104,10 +124,10 @@
* @param settings a map with a single key: nfs_entries
* @return success
*/
global define boolean Import (list<map> settings) ``{
global define boolean Import (map <string, any> settings) ``{

boolean missing = false;
settings = maplist(map s,settings,``{
settings["nfs_entries"] = maplist(map s,settings["nfs_entries"]:[],``{
foreach (string k, ["server_path", "mount_point", "nfs_options"], ``{
if (! haskey (s, k))
{
Expand Down Expand Up @@ -140,7 +160,12 @@
* Dump the NFS settings to a map, for autoinstallation use.
* @return a list of nfs entries.
*/
global define list Export () ``{
global define map Export () ``{
map <string, any> settings = $[];

settings["enable_nfs4"] = nfs4_enabled;
settings["idmapd_domain"] = idmapd_domain;

list entries = maplist(map entry, nfs_entries, ``{
return($[
"server_path":entry["spec"]:"",
Expand All @@ -149,7 +174,8 @@
"nfs_options":entry["mntops"]:""
]);
});
return entries;
settings["nfs_entries"]= entries;
return settings;
}

/* ------------------------------------------------------------ */
Expand Down
18 changes: 11 additions & 7 deletions src/nfs.rnc
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
nfs =
element nfs {
LIST,
element nfs_entry {
element server_path { text }
& element mount_point { text }
& element vfstype {text}?
& element nfs_options { text }
}*
element enable_nfs4 { BOOLEAN }? &
element idmapd_domain { text }? &
element nfs_entries {
LIST,
element nfs_entry {
element server_path { text }
& element mount_point { text }
& element vfstype {text}?
& element nfs_options { text }
}*
}
}
8 changes: 4 additions & 4 deletions src/nfs_auto.ycp
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ include "nfs/ui.ycp";

any ret = nil;
string func = "";
list<map> param = [];
map <string, any> param = [];

/* Check arguments */
if(size(WFM::Args()) > 0 && is(WFM::Args(0), string)) {
func = (string) WFM::Args(0);
if(size(WFM::Args()) > 1 && is(WFM::Args(1), list))
param = (list<map>) WFM::Args(1);
if(size(WFM::Args()) > 1 && is(WFM::Args(1), map))
param = ( map <string, any> ) WFM::Args(1);
}
y2debug("func=%1", func);
y2debug("param=%1", param);
Expand Down Expand Up @@ -80,7 +80,7 @@ else if (func == "Packages") {
}
/* Return actual state */
else if (func == "Export") {
ret = (list) Nfs::Export();
ret = (map) Nfs::Export();
}
else if (func == "Read") {
ret = (boolean) Nfs::Read();
Expand Down

0 comments on commit 29e91e5

Please sign in to comment.