-
Notifications
You must be signed in to change notification settings - Fork 34
/
dsl_proposal.ycp
99 lines (88 loc) · 2.29 KB
/
dsl_proposal.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
91
92
93
94
95
96
97
98
99
/**
* File: clients/dsl_proposal.ycp
* Package: Network configuration
* Summary: DSL configuration proposal
* Authors: Michal Svec <msvec@suse.cz>
*
*/
{
textdomain "network";
/* The main () */
y2milestone("----------------------------------------");
y2milestone("DSL proposal started");
y2milestone("Arguments: %1", WFM::Args());
import "DSL";
import "Popup";
import "Progress";
import "GetInstArgs";
include "network/routines.ycp";
string func = (string) WFM::Args(0);
map param = (map) WFM::Args(1);
map ret = $[];
/* create a textual proposal */
if(func == "MakeProposal") {
string proposal = "";
string warning = nil;
symbol warning_level = nil;
boolean force_reset = param["force_reset"]:false;
if(force_reset || !DSL::proposal_valid) {
DSL::proposal_valid = true;
if (! GetInstArgs::automatic_configuration())
/* Popup text */
BusyPopup(_("Detecting DSL devices..."));
boolean progress_orig = Progress::set (false);
DSL::Read();
DSL::Propose();
Progress::set (progress_orig);
if (! GetInstArgs::automatic_configuration())
BusyPopupClose();
}
list sum = DSL::Summary(false);
proposal = sum[0]:"";
ret = $[
"preformatted_proposal" : proposal,
"warning_level" : warning_level,
"warning" : warning,
];
}
/* run the module */
else if(func == "AskUser") {
map stored = DSL::Export();
symbol result = (symbol) WFM::CallFunction("dsl", [.propose]);
if(result != `next) DSL::Import(stored);
y2debug("stored=%1", stored);
y2debug("result=%1", result);
ret = $[ "workflow_sequence" : result ];
}
/* create titles */
else if(func == "Description") {
ret = $[
/* RichText label */
"rich_text_title" : _("DSL Connections"),
/* Menu label */
"menu_title" : _("&DSL Connections"),
"id" : "dsl",
];
}
/* write the proposal */
else if(func == "Write") {
if(PackagesInstall(DSL::Packages()) != `next) {
/* Popup text */
Popup::Error("Required packages installation failed.
DSL configuration cannot be saved.");
y2error("Packages installation failure, not saving");
}
else
DSL::Write();
}
/* unknown function */
else {
y2error("unknown function: %1", func);
}
/* Finish */
y2debug("ret=%1",ret);
y2milestone("DSL proposal finished");
y2milestone("----------------------------------------");
return ret;
/* EOF */
}