[yast-commit] r68050 - in /trunk/lxc: VERSION package/yast2-lxc.changes src/Lxc.ycp src/dialogs.ycp src/helps.ycp src/wizards.ycp
Author: jsuchome Date: Mon Apr 30 13:53:28 2012 New Revision: 68050 URL: http://svn.opensuse.org/viewcvs/yast?rev=68050&view=rev Log: - updated help texts - cleaned debugging code, added comments - 2.22.1 Modified: trunk/lxc/VERSION trunk/lxc/package/yast2-lxc.changes trunk/lxc/src/Lxc.ycp trunk/lxc/src/dialogs.ycp trunk/lxc/src/helps.ycp trunk/lxc/src/wizards.ycp Modified: trunk/lxc/VERSION URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/VERSION?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/VERSION (original) +++ trunk/lxc/VERSION Mon Apr 30 13:53:28 2012 @@ -1 +1 @@ -2.22.0 +2.22.1 Modified: trunk/lxc/package/yast2-lxc.changes URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/package/yast2-lxc.changes?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/package/yast2-lxc.changes (original) +++ trunk/lxc/package/yast2-lxc.changes Mon Apr 30 13:53:28 2012 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Apr 30 13:47:47 CEST 2012 - jsuchome@suse.cz + +- updated help texts +- cleaned debugging code, added comments +- 2.22.1 + +------------------------------------------------------------------- Fri Apr 27 14:48:38 CEST 2012 - jsuchome@suse.cz - openSUSE version Modified: trunk/lxc/src/Lxc.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/src/Lxc.ycp?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/src/Lxc.ycp (original) +++ trunk/lxc/src/Lxc.ycp Mon Apr 30 13:53:28 2012 @@ -36,6 +36,7 @@ textdomain "lxc"; import "Directory"; +import "FileUtils"; import "Progress"; import "Security"; @@ -65,7 +66,9 @@ return ret; } -// encrypt given password using current method +/** + * Encrypt given password using current method + */ global string CryptPassword (string pw) { if (method == "md5") @@ -79,34 +82,40 @@ return crypt (pw); } +/** + * Read list of available bridges + */ global list<string> ReadBridgesIds () { - map out = (map) SCR::Execute (.target.bash_output, "brctl show | tail -n +2 | cut -f 1"); list<string> ret = []; - - if (out["stdout"]:"" != "") + if (FileUtils::Exists ("/sbin/brctl")) { - ret = maplist (string line, splitstring (out["stdout"]:"", "\n"), ``(line)); + map out = (map) SCR::Execute (.target.bash_output, "/sbin/brctl show | tail -n +2 | cut -f 1"); + + if (out["stdout"]:"" != "") + { + ret = maplist (string line, splitstring (out["stdout"]:"", "\n"), ``(line)); + } } return ret; } -global list<term> GetContainers () { +/** + * Read list of containers and their states + */ +global map<string,boolean> GetContainers () { - list<term> ret = []; - map lxc_index = $[]; + map<string,boolean> ret = $[]; map out = (map) SCR::Execute (.target.bash_output, "lxc-ls -1"); foreach (string line, sort (splitstring (out["stdout"]:"", "\n")), { - if (line != "" && !haskey (lxc_index, line)) + if (line != "" && !haskey (ret, line)) { string cmd= sformat ("lxc-info -n %1 | grep state", line); out = (map) SCR::Execute (.target.bash_output, cmd, $[ "LANG" : "C" ]); list<string> state = splitstring (deletechars (out["stdout"]:"", " \t\n"), ":"); - ret = add (ret, `item (line, state[1]:"")); - // FIXME translate - lxc_index[line] = true; + ret[line] = state[1]:"" == "RUNNING"; } }); return ret; @@ -118,14 +127,13 @@ boolean CheckLXCConfiguration () { boolean problem = false; - // zgrep does not seem to work with .target.bash_output -> grep uncompressed config FIXME + // zgrep does not seem to work with .target.bash_output -> grep uncompressed config string tmpdir = Directory::tmpdir; SCR::Execute (.target.bash_output, sformat ( "cp /proc/config.gz %1/ && gunzip %1/config.gz", tmpdir)); map out = (map) SCR::Execute (.target.bash_output, sformat ( -// "GREP=grep CONFIG=%1/config /usr/bin/lxc-checkconfig", tmpdir)); - "GREP=grep /usr/bin/lxc-checkconfig")); + "GREP=grep CONFIG=%1/config /usr/bin/lxc-checkconfig", tmpdir)); list<string> rt = []; map<string,string> colors = $[ Modified: trunk/lxc/src/dialogs.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/src/dialogs.ycp?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/src/dialogs.ycp (original) +++ trunk/lxc/src/dialogs.ycp Mon Apr 30 13:53:28 2012 @@ -46,6 +46,10 @@ map<string,integer> console_pids = $[]; +/** + * Create configuration file for a container + * @return success + */ boolean CreateContainerConfig (string name, string ip, string subnet, string bridge, string template) { // busy message @@ -76,16 +80,15 @@ cmd = cmd + " -t " + template; } - y2internal ("cmd: %1", cmd); - map out = (map) SCR::Execute (.target.bash_output, cmd); - y2internal ("out: %1", out); - Popup::ClearFeedback (); if (out["exit"]:0 != 0) { + y2milestone ("cmd: %1", cmd); + y2milestone ("lxc-createconfig output: %1", out); + // error message Report::Error (sformat (_("Error occured during configuration: @@ -253,16 +256,16 @@ { cmd = cmd + " -t " + template; } - y2internal ("cmd: %1", cmd); map out = (map) SCR::Execute (.target.bash_output, cmd); - y2internal ("out: %1", out); - Popup::ClearFeedback (); if (out["exit"]:0 != 0) { + y2milestone ("cmd: %1", cmd); + y2milestone ("lxc-create output: %1", out); + Report::Error (sformat (_("Error occured during container creation: %1"), out["stdout"]:"")); @@ -295,6 +298,7 @@ /** * Start selected container + * @return success */ boolean StartContainer (string name) { @@ -324,7 +328,7 @@ */ void StopContainer (string name) { - y2internal ("lxc-stop: %1", + y2milestone ("result of lxc-stop: %1", SCR::Execute (.target.bash_output, "lxc-stop -n " + name) ); if (console_pids[name]:nil != nil) @@ -336,27 +340,28 @@ /** * Delete given container + * @return success */ -void DestroyContainer (string name) +boolean DestroyContainer (string name) { // busy message Popup::ShowFeedback ("", sformat ("Destroying Container '%1'...", name)); string cmd = "lxc-destroy -n " + name; -// string cmd = "lxc-destroy -f -n " + name; map out = (map) SCR::Execute (.target.bash_output, cmd); - y2internal ("out: %1", out); - Popup::ClearFeedback (); if (out["exit"]:0 != 0) { + y2milestone ("lxc-destroy output: %1", out); // error message Report::Error (sformat (_("Error while destroying: %1"), out["stdout"]:"")); + return false; } + return true; } /** @@ -384,6 +389,9 @@ // current container string selected = ""; + // mapping of containers to their state + map<string,boolean> lxc_map = $[]; + // update status of the buttons according to current item void update_buttons (string selected) { @@ -392,8 +400,7 @@ return; } - term line = (term) UI::QueryWidget (`id (`table), `Item (selected)); - boolean running = line[2]:"" == "RUNNING"; // TODO do some better test + boolean running = lxc_map[selected]:false; UI::ChangeWidget (`id (`start), `Enabled, !running); UI::ChangeWidget (`id (`stop), `Enabled, running); if (Lxc::textmode) @@ -420,7 +427,15 @@ // update table with fresh items void update_table () { - list<term> lxc_list = Lxc::GetContainers ();; + lxc_map = Lxc::GetContainers (); + list<term> lxc_list = maplist (string name, boolean status, lxc_map, { + return `item (name, status ? + // container status + _("Running") : + // container status + _("Stopped") + ); + }); UI::ChangeWidget (`id (`table), `Items, lxc_list); if (size (lxc_list) == 0) @@ -466,6 +481,7 @@ Wizard::SetContentsButtons(caption, contents, HELPS["overview"]:"", Label::BackButton(), Label::FinishButton()); + Wizard::HideBackButton (); update_table (); Modified: trunk/lxc/src/helps.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/src/helps.ycp?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/src/helps.ycp (original) +++ trunk/lxc/src/helps.ycp Mon Apr 30 13:53:28 2012 @@ -55,13 +55,13 @@ "create" : _("<p><b><big>Creating New Container</big></b></p>") + // Create dialog help, part 2 -_("<p>Choose a <b>Name</b>, <b>Template</b> and enter network settings for the new container.</p>") + +_("<p>Choose a <b>Name</b> for your container, select a base <b>Template</b>, and enter desired network settings.</p>") + // Create dialog help, part 3 -_("<p>Use the value <tt>0.0.0.0</tt> as <b>IP Address</b> to have dynamic address assigned by DHCP. If there's no bridge device configured yet, use <b>Configure Network</b> button and create one.</p>") + +_("<p>Use the value <tt>0.0.0.0</tt> as <b>IP Address</b> to have dynamic address assigned by DHCP. If there's no bridge device configured yet, use the <b>Configure Network</b> button and create one.</p>") + // Create dialog help, part 4 -_("<p>Select a root password to use in the container. If no password is entered, the default value <tt>root</tt> will be used.</p>") + +_("<p>Select a password to use for a system administrator ('root') in the container. If no password is entered, the default value <tt>root</tt> will be used.</p>") + // Create dialog help, part 5 _("<p>Use <b>Create</b> to start the creation process.</p>") Modified: trunk/lxc/src/wizards.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/lxc/src/wizards.ycp?rev=68050&r1=68049&r2=68050&view=diff ============================================================================== --- trunk/lxc/src/wizards.ycp (original) +++ trunk/lxc/src/wizards.ycp Mon Apr 30 13:53:28 2012 @@ -102,6 +102,7 @@ ]; Wizard::CreateDialog(); + Wizard::HideBackButton (); Wizard::HideAbortButton (); any ret = Sequencer::Run(aliases, sequence); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
jsuchome@svn2.opensuse.org