-
Notifications
You must be signed in to change notification settings - Fork 34
/
routing_auto.ycp
90 lines (78 loc) · 2.07 KB
/
routing_auto.ycp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
/**
* File: clients/routing_auto.ycp
* Package: Network configuration
* Summary: Client for autoinstallation
* Authors: Michal Svec <msvec@suse.cz>
*
*
* This is a client for autoinstallation. It takes its arguments,
* goes through the configuration and return the setting.
* Does not do any changes to the configuration.
*/
/**
* @param function to execute
* @param map/list of routing settings
* @return map edited settings, Summary or boolean on success depending on called function
* @example map mm = $[ "FAIL_DELAY" : "77" ];
* @example map ret = WFM::CallFunction ("routing_auto", [ "Summary", mm ]);
*/
{
textdomain "network";
y2milestone("----------------------------------------");
y2milestone("Routing auto started");
import "Routing";
import "Wizard";
include "network/services/routing.ycp";
any ret = nil;
string func = "";
map 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), map))
param = (map) WFM::Args(1);
}
y2debug("func=%1", func);
y2debug("param=%1", param);
/* Create a summary*/
if(func == "Summary") {
ret = Routing::Summary();
}
/* Reset configuration */
else if (func == "Reset") {
Routing::Import($[]);
ret = $[];
}
/* Change configuration (run AutoSequence) */
else if (func == "Change") {
Wizard::CreateDialog();
Wizard::SetDesktopIcon("routing");
ret = RoutingMainDialog();
UI::CloseDialog();
}
/* Import configuration */
else if (func == "Import") {
ret = Routing::Import(param);
}
/* Return actual state */
else if (func == "Export") {
ret = Routing::Export();
}
/* Write givven settings */
else if (func == "Write") {
import "Progress";
boolean progress_orig = Progress::set (false);
ret = Routing::Write();
Progress::set (progress_orig);
}
/* Unknown function */
else {
y2error("Unknown function: %1", func);
ret = false;
}
y2debug("ret=%1", ret);
y2milestone("Routing auto finished");
y2milestone("----------------------------------------");
return ret;
/* EOF */
}