| 2319 | |
| 2320 | @property |
| 2321 | def can_deploy_agent(self): |
| 2322 | if self._can_deploy_agent is None: |
| 2323 | if not self.standalone_python and Path(self.directory / ".noagent").exists(): |
| 2324 | self._can_deploy_agent = False |
| 2325 | else: |
| 2326 | _bin = self.bin['python3'] or self.bin['python'] |
| 2327 | if _bin: |
| 2328 | version = self.exec(f"{_bin} -V 2>&1 || {_bin} --version 2>&1", value=True) |
| 2329 | try: |
| 2330 | major, minor, micro = re.search(r"Python (\d+)\.(\d+)(?:\.(\d+))?", version).groups() |
| 2331 | except Exception: |
| 2332 | self._can_deploy_agent = False |
| 2333 | return self._can_deploy_agent |
| 2334 | self.remote_python_version = (int(major), int(minor), int(micro or 0)) |
| 2335 | if self.remote_python_version >= (2, 3): # Python 2.2 lacks: tarfile, os.walk, yield |
| 2336 | self._can_deploy_agent = True |
| 2337 | else: |
| 2338 | self._can_deploy_agent = False |
| 2339 | else: |
| 2340 | self._can_deploy_agent = False |
| 2341 | |
| 2342 | return self._can_deploy_agent |
| 2343 | |
| 2344 | def get_system_info(self): |
| 2345 | self.hostname = self.system = self.arch = '' |