connect: Drop non-ssh remote transport UI

These URIs take non-trivial external config to make work. Explicitly
putting them in the UI is a distraction now that we have the custom
URI option
This commit is contained in:
Cole Robinson
2018-05-02 17:42:32 -04:00
parent d99e31cbc4
commit 04398945e1
2 changed files with 20 additions and 99 deletions
+15 -47
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.20.2 -->
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.14"/>
<object class="GtkImage" id="image1">
@@ -14,6 +14,9 @@
<property name="resizable">False</property>
<property name="type_hint">dialog</property>
<signal name="delete-event" handler="on_vmm_open_connection_delete_event" swapped="no"/>
<child>
<placeholder/>
</child>
<child internal-child="vbox">
<object class="GtkBox" id="dialog-vbox2">
<property name="visible">True</property>
@@ -71,7 +74,6 @@
<object class="GtkGrid" id="table1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">6</property>
<property name="row_spacing">6</property>
<property name="column_spacing">6</property>
<child>
@@ -104,22 +106,6 @@
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="transport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<signal name="changed" handler="on_transport_changed" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="transport-atkobject">
<property name="AtkObject::accessible-name">Method</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkSeparator" id="hseparator1">
<property name="visible">True</property>
@@ -127,13 +113,13 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="top_attach">5</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="connect-remote">
<property name="label" translatable="yes">Connect to _remote host</property>
<property name="label" translatable="yes">Connect to _remote host over SSH</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -158,7 +144,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">7</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
@@ -176,7 +162,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">7</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
@@ -193,7 +179,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">4</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
@@ -216,7 +202,7 @@
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -231,7 +217,7 @@
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
@@ -247,21 +233,6 @@
<property name="use_underline">True</property>
<property name="mnemonic_widget">username-entry</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label88">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="margin_left">24</property>
<property name="label" translatable="yes">Me_thod:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">transport</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
@@ -322,7 +293,7 @@ are very limited. &lt;/small&gt;</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">9</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
@@ -338,7 +309,7 @@ are very limited. &lt;/small&gt;</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">9</property>
<property name="top_attach">8</property>
</packing>
</child>
<child>
@@ -357,7 +328,7 @@ are very limited. &lt;/small&gt;</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">8</property>
<property name="top_attach">7</property>
</packing>
</child>
<child>
@@ -369,7 +340,7 @@ are very limited. &lt;/small&gt;</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">8</property>
<property name="top_attach">7</property>
</packing>
</child>
</object>
@@ -385,8 +356,5 @@ are very limited. &lt;/small&gt;</property>
<action-widget response="0">cancel</action-widget>
<action-widget response="0">connect</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
+5 -52
View File
@@ -25,24 +25,6 @@ HV_BHYVE,
HV_VZ,
HV_CUSTOM) = range(7)
(CONN_SSH,
CONN_TCP,
CONN_TLS) = range(3)
def current_user():
try:
import getpass
return getpass.getuser()
except Exception:
return ""
def default_conn_user(conn):
if conn == CONN_SSH:
return "root"
return current_user()
class vmmConnect(vmmGObjectUI):
@classmethod
@@ -65,7 +47,6 @@ class vmmConnect(vmmGObjectUI):
self.builder.connect_signals({
"on_hypervisor_changed": self.hypervisor_changed,
"on_transport_changed": self.transport_changed,
"on_hostname_combo_changed": self.hostname_combo_changed,
"on_connect_remote_toggled": self.connect_remote_toggled,
"on_username_entry_changed": self.username_changed,
@@ -180,14 +161,6 @@ class vmmConnect(vmmGObjectUI):
return model[it][0] == -1
combo.set_row_separator_func(sepfunc)
combo = self.widget("transport")
model = Gtk.ListStore(str)
model.append(["SSH"])
model.append(["TCP (SASL, Kerberos)"])
model.append(["SSL/TLS " + _("with certificates")])
combo.set_model(model)
uiutil.init_combo_text_column(combo, 0)
# Hostname combo box entry
hostListModel = Gtk.ListStore(str, str, str)
host = self.widget("hostname")
@@ -197,7 +170,6 @@ class vmmConnect(vmmGObjectUI):
def reset_state(self):
self.set_default_hypervisor()
self.widget("transport").set_active(0)
self.widget("autoconnect").set_sensitive(True)
self.widget("autoconnect").set_active(True)
self.widget("hostname").get_model().clear()
@@ -349,8 +321,6 @@ class vmmConnect(vmmGObjectUI):
self.widget("username-entry"), show_remote)
uiutil.set_grid_row_visible(
self.widget("hostname"), show_remote)
uiutil.set_grid_row_visible(
self.widget("transport"), show_remote)
if not show_remote:
self.widget("connect-remote").set_active(False)
@@ -366,29 +336,19 @@ class vmmConnect(vmmGObjectUI):
def connect_remote_toggled(self, src_ignore):
is_remote = self.is_remote()
self.widget("hostname").set_sensitive(is_remote)
self.widget("transport").set_sensitive(is_remote)
self.widget("autoconnect").set_active(not is_remote)
self.widget("username-entry").set_sensitive(is_remote)
self.populate_default_user()
self.populate_uri()
def transport_changed(self, src_ignore):
self.populate_default_user()
if is_remote and not self.widget("username-entry").get_text():
self.widget("username-entry").set_text("root")
self.populate_uri()
def populate_uri(self):
uri = self.generate_uri()
self.widget("uri-label").set_text(uri)
def populate_default_user(self):
conn = self.widget("transport").get_active()
default_user = default_conn_user(conn)
self.widget("username-entry").set_text(default_user)
def generate_uri(self):
hv = uiutil.get_list_selection(self.widget("hypervisor"))
conn = self.widget("transport").get_active()
host = self.widget("hostname").get_child().get_text().strip()
user = self.widget("username-entry").get_text()
is_remote = self.is_remote()
@@ -413,17 +373,10 @@ class vmmConnect(vmmGObjectUI):
host = "[%s]" % host
addrstr += host
hoststr = ""
if not is_remote:
hoststr = ":///"
if is_remote:
hoststr = "+ssh://" + addrstr + "/"
else:
if conn == CONN_TLS:
hoststr = "+tls://"
if conn == CONN_SSH:
hoststr = "+ssh://"
if conn == CONN_TCP:
hoststr = "+tcp://"
hoststr += addrstr + "/"
hoststr = ":///"
uri = hvstr + hoststr
if hv in (HV_QEMU, HV_BHYVE, HV_VZ):