FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 05-19-2008, 03:58 PM
Chris Lumens
 
Default Remove the code to save exceptions over scp.

---
exception.py | 86 +-------------------------------------------------
gui.py | 4 +--
text.py | 16 +--------
ui/exnSave.glade | 93 +----------------------------------------------------
4 files changed, 6 insertions(+), 193 deletions(-)

diff --git a/exception.py b/exception.py
index 724b7b9..e9c5695 100644
--- a/exception.py
+++ b/exception.py
@@ -189,76 +189,6 @@ def dumpException(out, text, tb, anaconda):
out.write("
Exception occurred during %s file copy:
" % (file,))
traceback.print_exc(None, out)

-def scpAuthenticate(master, childpid, password):
- while 1:
- # Read up to password prompt. Propagate OSError exceptions, which
- # can occur for anything that causes scp to immediately die (bad
- # hostname, host down, etc.)
- buf = os.read(master, 4096)
- if buf.lower().find("password: ") != -1:
- os.write(master, password+"
")
- # read the space and newline that get echoed back
- os.read(master, 2)
- break
-
- while 1:
- buf = ""
- try:
- buf = os.read(master, 4096)
- except (OSError, EOFError):
- break
-
- (pid, childstatus) = os.waitpid (childpid, 0)
- return childstatus
-
-# Save the traceback to a remote system via SCP. Returns success or not.
-def copyExceptionToRemote(intf, scpInfo):
- import pty
-
- (host, path, user, password) = scpInfo
-
- if host.find(":") != -1:
- (host, port) = host.split(":")
-
- # Try to convert the port to an integer just as a check to see
- # if it's a valid port number. If not, they'll get a chance to
- # correct the information when scp fails.
- try:
- int(port)
- portArgs = ["-P", port]
- except ValueError:
- portArgs = []
- else:
- portArgs = []
-
- # Thanks to Will Woods <wwoods@redhat.com> for the scp control
- # here and in scpAuthenticate.
-
- # Fork ssh into its own pty
- (childpid, master) = pty.fork()
- if childpid < 0:
- log.critical("Could not fork process to run scp")
- return False
- elif childpid == 0:
- # child process - run scp
- args = ["scp", "-oNumberOfPasswordPrompts=1",
- "-oStrictHostKeyChecking=no"] + portArgs +
- ["/tmp/anacdump.txt", "%s@%s:%s" % (user, host, path)]
- os.execvp("scp", args)
-
- # parent process
- try:
- childstatus = scpAuthenticate(master, childpid, password)
- except OSError:
- return False
-
- os.close(master)
-
- if os.WIFEXITED(childstatus) and os.WEXITSTATUS(childstatus) == 0:
- return True
- else:
- return False
-
# Save the traceback to a removable storage device, such as a floppy disk
# or a usb/firewire drive. If there's no filesystem on the disk/partition,
# write a vfat one.
@@ -368,21 +298,7 @@ def runSaveDialog(anaconda, longTracebackFile):
"disk."))
continue
else:
- scpInfo = saveWin.getDest()
- scpSucceeded = copyExceptionToRemote(anaconda.intf, scpInfo)
-
- if scpSucceeded:
- anaconda.intf.messageWindow(_("Dump Written"),
- _("Your system's state has been successfully written to "
- "the remote host. The installer will now exit."),
- type="custom", custom_icon="info",
- custom_buttons=[_("_Exit installer")])
- sys.exit(0)
- else:
- anaconda.intf.messageWindow(_("Dump Not Written"),
- _("There was a problem writing the system state to the "
- "remote host."))
- continue
+ continue
elif rc == EXN_CANCEL:
break

diff --git a/gui.py b/gui.py
index 73a4233..cfa0960 100755
--- a/gui.py
+++ b/gui.py
@@ -732,8 +732,6 @@ class SaveExceptionWindow:
def __init__(self, anaconda, longTracebackFile=None, screen=None):
exnxml = gtk.glade.XML(findGladeFile("exnSave.glade"), domain="anaconda")

- self.hostEntry = exnxml.get_widget("hostEntry")
- self.destEntry = exnxml.get_widget("destEntry")
self.usernameEntry = exnxml.get_widget("usernameEntry")
self.passwordEntry = exnxml.get_widget("passwordEntry")

@@ -799,7 +797,7 @@ class SaveExceptionWindow:
elif self.saveToLocal():
return self.localChooser.get_filename()
else:
- return map(lambda e: e.get_text(), [self.hostEntry, self.destEntry, self.usernameEntry, self.passwordEntry])
+ return map(lambda e: e.get_text(), [self.usernameEntry, self.passwordEntry])

def pop(self):
self.window.destroy()
diff --git a/text.py b/text.py
index 35f491a..14ef53b 100644
--- a/text.py
+++ b/text.py
@@ -155,13 +155,9 @@ class SaveExceptionWindow:

def _destCb(self, *args):
if self.rg.getSelection() == "disk":
- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
else:
- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)

@@ -175,7 +171,7 @@ class SaveExceptionWindow:
if self.saveToDisk():
return self.diskList.current()
else:
- return map(lambda e: e.value(), [self.hostEntry, self.destEntry, self.usernameEntry, self.passwordEntry])
+ return map(lambda e: e.value(), [self.usernameEntry, self.passwordEntry])

def pop(self):
self.screen.popWindow()
@@ -192,18 +188,12 @@ class SaveExceptionWindow:
self.remoteButton.setCallback(self._destCb, None)

buttons = ButtonBar(self.screen, [TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON])
- self.hostEntry = Entry(24)
- self.destEntry = Entry(24)
self.usernameEntry = Entry(24)
self.passwordEntry = Entry(24, password=1)

self.diskList = Listbox(height=3, scroll=1)

- remoteGrid = Grid(2, 4)
- remoteGrid.setField(Label(_("Host")), 0, 0, anchorLeft=1)
- remoteGrid.setField(self.hostEntry, 1, 0)
- remoteGrid.setField(Label(_("Remote path")), 0, 1, anchorLeft=1)
- remoteGrid.setField(self.destEntry, 1, 1)
+ remoteGrid = Grid(2, 2)
remoteGrid.setField(Label(_("User name")), 0, 2, anchorLeft=1)
remoteGrid.setField(self.usernameEntry, 1, 2)
remoteGrid.setField(Label(_("Password")), 0, 3, anchorLeft=1)
@@ -223,8 +213,6 @@ class SaveExceptionWindow:

# self.diskList.setCurrent("sda")

- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
else:
diff --git a/ui/exnSave.glade b/ui/exnSave.glade
index b7ba57a..0bab909 100644
--- a/ui/exnSave.glade
+++ b/ui/exnSave.glade
@@ -74,7 +74,7 @@
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="label" translatable="yes">Select a destination for the exception information.</property>
+ <property name="label" translatable="yes">Your traceback can either be saved to a local disk or to a bug tracking system.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -228,7 +228,7 @@
<widget class="GtkRadioButton" id="remoteButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Remote (scp)</property>
+ <property name="label" translatable="yes">_Remote (%s)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -271,56 +271,6 @@
<property name="spacing">5</property>

<child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label">Host (hostort)</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label">Destination file</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label">User name</property>
@@ -385,45 +335,6 @@
<property name="spacing">5</property>

<child>
- <widget class="GtkEntry" id="hostEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">?</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="destEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">?</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkEntry" id="usernameEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
--
1.5.4.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 07-22-2008, 05:23 PM
Chris Lumens
 
Default Remove the code to save exceptions over scp.

---
exception.py | 70 ----------------------------------------
gui.py | 4 +--
text.py | 16 +--------
ui/exnSave.glade | 93 +----------------------------------------------------
4 files changed, 5 insertions(+), 178 deletions(-)

diff --git a/exception.py b/exception.py
index 5a41e9e..8651355 100644
--- a/exception.py
+++ b/exception.py
@@ -197,76 +197,6 @@ def dumpException(out, text, tb, anaconda):
out.write("
Exception occurred during %s file copy:
" % (file,))
traceback.print_exc(None, out)

-def scpAuthenticate(master, childpid, password):
- while 1:
- # Read up to password prompt. Propagate OSError exceptions, which
- # can occur for anything that causes scp to immediately die (bad
- # hostname, host down, etc.)
- buf = os.read(master, 4096)
- if buf.lower().find("password: ") != -1:
- os.write(master, password+"
")
- # read the space and newline that get echoed back
- os.read(master, 2)
- break
-
- while 1:
- buf = ""
- try:
- buf = os.read(master, 4096)
- except (OSError, EOFError):
- break
-
- (pid, childstatus) = os.waitpid (childpid, 0)
- return childstatus
-
-# Save the traceback to a remote system via SCP. Returns success or not.
-def copyExceptionToRemote(intf, scpInfo):
- import pty
-
- (host, path, user, password) = scpInfo
-
- if host.find(":") != -1:
- (host, port) = host.split(":")
-
- # Try to convert the port to an integer just as a check to see
- # if it's a valid port number. If not, they'll get a chance to
- # correct the information when scp fails.
- try:
- int(port)
- portArgs = ["-P", port]
- except ValueError:
- portArgs = []
- else:
- portArgs = []
-
- # Thanks to Will Woods <wwoods@redhat.com> for the scp control
- # here and in scpAuthenticate.
-
- # Fork ssh into its own pty
- (childpid, master) = pty.fork()
- if childpid < 0:
- log.critical("Could not fork process to run scp")
- return False
- elif childpid == 0:
- # child process - run scp
- args = ["scp", "-oNumberOfPasswordPrompts=1",
- "-oStrictHostKeyChecking=no"] + portArgs +
- ["/tmp/anacdump.txt", "%s@%s:%s" % (user, host, path)]
- os.execvp("scp", args)
-
- # parent process
- try:
- childstatus = scpAuthenticate(master, childpid, password)
- except OSError:
- return False
-
- os.close(master)
-
- if os.WIFEXITED(childstatus) and os.WEXITSTATUS(childstatus) == 0:
- return True
- else:
- return False
-
# Save the traceback to a removable storage device, such as a floppy disk
# or a usb/firewire drive. If there's no filesystem on the disk/partition,
# write a vfat one.
diff --git a/gui.py b/gui.py
index 123f287..2a85722 100755
--- a/gui.py
+++ b/gui.py
@@ -730,8 +730,6 @@ class SaveExceptionWindow:
def __init__(self, anaconda, longTracebackFile=None, screen=None):
exnxml = gtk.glade.XML(findGladeFile("exnSave.glade"), domain="anaconda")

- self.hostEntry = exnxml.get_widget("hostEntry")
- self.destEntry = exnxml.get_widget("destEntry")
self.usernameEntry = exnxml.get_widget("usernameEntry")
self.passwordEntry = exnxml.get_widget("passwordEntry")

@@ -797,7 +795,7 @@ class SaveExceptionWindow:
elif self.saveToLocal():
return self.localChooser.get_filename()
else:
- return map(lambda e: e.get_text(), [self.hostEntry, self.destEntry, self.usernameEntry, self.passwordEntry])
+ return map(lambda e: e.get_text(), [self.usernameEntry, self.passwordEntry])

def pop(self):
self.window.destroy()
diff --git a/text.py b/text.py
index 71ec6d7..41ca1c7 100644
--- a/text.py
+++ b/text.py
@@ -155,13 +155,9 @@ class SaveExceptionWindow:

def _destCb(self, *args):
if self.rg.getSelection() == "disk":
- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
else:
- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_RESET)

@@ -175,7 +171,7 @@ class SaveExceptionWindow:
if self.saveToDisk():
return self.diskList.current()
else:
- return map(lambda e: e.value(), [self.hostEntry, self.destEntry, self.usernameEntry, self.passwordEntry])
+ return map(lambda e: e.value(), [self.usernameEntry, self.passwordEntry])

def pop(self):
self.screen.popWindow()
@@ -192,18 +188,12 @@ class SaveExceptionWindow:
self.remoteButton.setCallback(self._destCb, None)

buttons = ButtonBar(self.screen, [TEXT_OK_BUTTON, TEXT_CANCEL_BUTTON])
- self.hostEntry = Entry(24)
- self.destEntry = Entry(24)
self.usernameEntry = Entry(24)
self.passwordEntry = Entry(24, password=1)

self.diskList = Listbox(height=3, scroll=1)

- remoteGrid = Grid(2, 4)
- remoteGrid.setField(Label(_("Host")), 0, 0, anchorLeft=1)
- remoteGrid.setField(self.hostEntry, 1, 0)
- remoteGrid.setField(Label(_("Remote path")), 0, 1, anchorLeft=1)
- remoteGrid.setField(self.destEntry, 1, 1)
+ remoteGrid = Grid(2, 2)
remoteGrid.setField(Label(_("User name")), 0, 2, anchorLeft=1)
remoteGrid.setField(self.usernameEntry, 1, 2)
remoteGrid.setField(Label(_("Password")), 0, 3, anchorLeft=1)
@@ -223,8 +213,6 @@ class SaveExceptionWindow:

# self.diskList.setCurrent("sda")

- self.hostEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
- self.destEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.usernameEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
self.passwordEntry.setFlags(FLAG_DISABLED, FLAGS_SET)
else:
diff --git a/ui/exnSave.glade b/ui/exnSave.glade
index b7ba57a..0bab909 100644
--- a/ui/exnSave.glade
+++ b/ui/exnSave.glade
@@ -74,7 +74,7 @@
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
- <property name="label" translatable="yes">Select a destination for the exception information.</property>
+ <property name="label" translatable="yes">Your traceback can either be saved to a local disk or to a bug tracking system.</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
@@ -228,7 +228,7 @@
<widget class="GtkRadioButton" id="remoteButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="label" translatable="yes">_Remote (scp)</property>
+ <property name="label" translatable="yes">_Remote (%s)</property>
<property name="use_underline">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="focus_on_click">True</property>
@@ -271,56 +271,6 @@
<property name="spacing">5</property>

<child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label">Host (hostort)</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label">Destination file</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkLabel" id="label4">
<property name="visible">True</property>
<property name="label">User name</property>
@@ -385,45 +335,6 @@
<property name="spacing">5</property>

<child>
- <widget class="GtkEntry" id="hostEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">?</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="destEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char">?</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
<widget class="GtkEntry" id="usernameEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
--
1.5.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 09:54 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org