Logo Search packages:      
Sourcecode: mago version File versions  Download package

def mago::application::gnome::Seahorse::new_ssh_key (   self,
  description,
  passphrase,
  set_up = False,
  computer = '',
  login = '' 
)

It creates a new SSH key with the default settings.

TODO: Setting up the key is not working yet

@type description: string 
@param description: Description to type in the SSH key

@type passphrase: string 
@param passphrase: Passphrase to type for the SSH key

@type set_up: boolean 
@param passphrase: True, to set up the SSH key

@type computer: string 
@param computer: URL or IP of the computer to set up the key

@type login: string
@param login: Login to use in the remote computer

Definition at line 195 of file gnome.py.

00195                                                                                              :
        """
        It creates a new SSH key with the default settings.

        TODO: Setting up the key is not working yet

        @type description: string 
        @param description: Description to type in the SSH key

        @type passphrase: string 
        @param passphrase: Passphrase to type for the SSH key

        @type set_up: boolean 
        @param passphrase: True, to set up the SSH key

        @type computer: string 
        @param computer: URL or IP of the computer to set up the key
        
        @type login: string
        @param login: Login to use in the remote computer
        """
        
        self.new_key(self.TYPE_SSH)

        try:
            ldtp.waittillguiexist(self.NEWSSH_DLG)
            dlg_new_ssh = ooldtp.context(self.NEWSSH_DLG)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "The new key dialog was not found."

        try:
            txt_field = dlg_new_ssh.getchild(self.DLG_NEWSSH_DESC)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "The " + self.DLG_NEWSSH_DESC + " text field was not found."
        try:
            txt_field.settextvalue(description)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "There was an error when writing the text."

        if set_up == True:
            try:
                btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE_AND_SETUP)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found."

        else:
            try:
                btn_create = dlg_new_ssh.getchild(self.BTN_NEWSSH_CREATE)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The create button at the new PGP key dialog was not found."

        try:
            btn_create.click() 
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "There was a problem when clicking the create button."
      
 
        try:
            ldtp.waittillguiexist(self.DLG_NEWKEY_PASS)
            dlg_new_key_pass = ooldtp.context(self.DLG_NEWKEY_PASS)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "The new key passphrase dialog was not found."

        try:
            ldtp.enterstring(passphrase)
            ldtp.enterstring("<tab>")
            ldtp.enterstring(passphrase)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "Error entering passphrase."
 
        try:
            btn_pass_ok = dlg_new_key_pass.getchild(self.BTN_PASS_OK)
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "The OK button at the new key passphrase dialog was not found."

        try:
            btn_pass_ok.click() 
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "There was a problem when clicking the OK button."
 
        if set_up == True and login is not None:

            try:
                ldtp.waittillguiexist(self.DLG_SET_UP)
                dlg_set_up_computer = ooldtp.context(self.DLG_SET_UP)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The set up computer dialog was not found."

            try:
                txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_LOGIN)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The " + self.TXT_SET_UP_LOGIN + " text field was not found."
            try:
                txt_field.settextvalue(login)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "There was an error when writing the text."

        if set_up == True:
            try:
                txt_field = dlg_set_up_computer.getchild(self.TXT_SET_UP_COMPUTER)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The " + self.TXT_SET_UP_COMPUTER + " text field was not found."
            try:
                txt_field.settextvalue(computer)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "There was an error when writing the text."

            try:
                btn_set_up = dlg_set_up_computer.getchild(self.BTN_SET_UP)
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "The set up button was not found."

            try:
                btn_set_up.click() 
            except ldtp.LdtpExecutionError:
                raise ldtp.LdtpExecutionError, "There was a problem when clicking the set up button."
            
        try:
            while ldtp.guiexist(self.DLG_CREATING_SSH) == 1:
                ldtp.wait(1)
            
        except ldtp.LdtpExecutionError:
            raise ldtp.LdtpExecutionError, "The creating key dialog was not found."
        # Add key name to generated key list, so we know to delete it later.
        self.generated_keys.append(description)

        # It is too fast to grab the main window afterwards
        ldtp.wait(3)

    def go_to_tab(self, tab_name):


Generated by  Doxygen 1.6.0   Back to index