/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/transport/ssh.py

  • Committer: Jelmer Vernooij
  • Date: 2019-07-07 20:43:57 UTC
  • mfrom: (7370 work)
  • mto: This revision was merged to the branch mainline in revision 7378.
  • Revision ID: jelmer@jelmer.uk-20190707204357-82bayabtwikhoi0i
merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        """Clear previously cached lookup result."""
81
81
        self._cached_ssh_vendor = None
82
82
 
83
 
    def _get_vendor_by_environment(self, environment=None):
84
 
        """Return the vendor or None based on BRZ_SSH environment variable.
85
 
 
86
 
        :raises UnknownSSH: if the BRZ_SSH environment variable contains
87
 
                            unknown vendor name
88
 
        """
89
 
        if environment is None:
90
 
            environment = os.environ
91
 
        if 'BRZ_SSH' in environment:
92
 
            vendor_name = environment['BRZ_SSH']
 
83
    def _get_vendor_by_config(self):
 
84
        vendor_name = config.GlobalStack().get('ssh')
 
85
        if vendor_name is not None:
93
86
            try:
94
87
                vendor = self._ssh_vendors[vendor_name]
95
88
            except KeyError:
151
144
        return self._get_vendor_by_version_string(version,
152
145
                                                  os.path.splitext(os.path.basename(path))[0])
153
146
 
154
 
    def get_vendor(self, environment=None):
 
147
    def get_vendor(self):
155
148
        """Find out what version of SSH is on the system.
156
149
 
157
150
        :raises SSHVendorNotFound: if no any SSH vendor is found
159
152
                            unknown vendor name
160
153
        """
161
154
        if self._cached_ssh_vendor is None:
162
 
            vendor = self._get_vendor_by_environment(environment)
 
155
            vendor = self._get_vendor_by_config()
163
156
            if vendor is None:
164
157
                vendor = self._get_vendor_by_inspection()
165
158
                if vendor is None: