How do you check the availability of the file resource?



  • How would it be better to check the availability of a file resource on several hosts available for SSH on Python 2.7 and, if necessary, to create a directory there?



  • I'd use some sort of finished products. https://www.ansible.com/ or http://www.fabfile.org/ Which is also written on Python.

    I have experience with Ansible, a very powerful and flexible instrument.

    But if it's necessary to be implemented in Python, I'd advise you to use the module. http://docs.paramiko.org/en/2.0/api/sftp.html which is specifically designed for this purpose. By the way, Ansible and Fabric use Paramiko.

    http://jessenoller.com/blog/2009/02/05/ssh-programming-with-paramiko-completely-different and https://stackoverflow.com/questions/12295551/how-to-list-all-the-folders-and-files-in-the-directory-after-connecting-through examples of use




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2