• Icon: Sub-task Sub-task
    • Resolution: Done
    • Icon: Blocker Blocker
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • subs-swatch-thunder
    • Swatch Thunder Sprint 2

      test_validate_tally_daily_on_rhel is failing due to not being able to find the automation.pem file. This test uses a live VM and uses the pem file to SSH into it. 

      VM Used for this test: - https://openstack.psi.redhat.com/dashboard

       

      application = <iqe.base.application.Application object at 0x7fed72153f80>
      @pytest.fixture()
      def provision_openstack_vm(application):
          currentdt = datetime.datetime.now()
          currentdt = str(currentdt).replace(" ", "-").split(".")[-2].replace(":", "-")
          vm_name = f"automation-rhsm-{currentdt}"
          provider = OpenStackProvider(
              os_username=application.rhsm_subscriptions.config.vm.openstack.username,
              os_password=application.rhsm_subscriptions.config.vm.openstack.password,
              os_project_domain_name=application.rhsm_subscriptions.config.vm.openstack.domain_name,
              os_project_name=application.rhsm_subscriptions.config.vm.openstack.project_name,
              os_user_domain_name=application.rhsm_subscriptions.config.vm.openstack.domain_name,
          )
      
          # label- name of the instance
          instance = provider.vm_factory.create(
              label=vm_name, key_pair=application.rhsm_subscriptions.config.vm.openstack.instance.key_pair
          )
          register_command = (
              f"sudo subscription-manager register --serverurl="
              f"{application.rhsm_subscriptions.config.vm.subscription.serverurl}"
              f" --username={application.user.auth.username} --password={application.user.auth.password}"
              f" --force"
          )
          update_fact_command = "sudo subscription-manager facts --update"
        with VMManager(provider).connect(
              instance=instance,
              user="cloud-user",
              ssh_key_path=f"{Path.home()}/"
              f"{application.rhsm_subscriptions.config.vm.openstack.instance.sshkey}",
          ) as vm_con:
      /iqe_venv/lib/python3.12/site-packages/iqe_rhsm_subscriptions/fixtures/e2e.py:136: 
      
      /iqe_venv/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/contextlib.py:137: in enter
          return next(self.gen)
                 ^^^^^^^^^^^^^^
      /iqe_venv/lib/python3.12/site-packages/iqe_vm_lib/vm_manager.py:137: in connect
          with ssh_conn(
      /iqe_venv/.local/share/uv/python/cpython-3.12.11-linux-x86_64-gnu/lib/python3.12/contextlib.py:137: in enter
          return next(self.gen)
                 ^^^^^^^^^^^^^^
      /iqe_venv/lib/python3.12/site-packages/iqe_vm_lib/utils.py:59: in ssh_conn
          conn.open()
      /iqe_venv/lib/python3.12/site-packages/fabric/connection.py:665: in open
          result = self.client.connect(**kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      /iqe_venv/lib/python3.12/site-packages/paramiko/client.py:485: in connect
          self.auth(
      /iqe_venv/lib/python3.12/site-packages/paramiko/client.py:730: in auth
          key = self._key_from_filepath(
      /iqe_venv/lib/python3.12/site-packages/paramiko/client.py:638: in _key_from_filepath
          key = klass.from_private_key_file(key_path, password)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      /iqe_venv/lib/python3.12/site-packages/paramiko/pkey.py:435: in from_private_key_file
          key = cls(filename=filename, password=password)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      /iqe_venv/lib/python3.12/site-packages/paramiko/rsakey.py:64: in __init
          self._from_private_key_file(filename, password)
      /iqe_venv/lib/python3.12/site-packages/paramiko/rsakey.py:196: in _from_private_key_file
          data = self._read_private_key_file("RSA", filename, password)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      
      self = <[AttributeError("'NoneType' object has no attribute 'key_size'") raised in repr()] RSAKey object at 0x7fed705087a0>
      tag = 'RSA', filename = '/iqe_venv/automation.pem', password = None
      def _read_private_key_file(self, tag, filename, password=None):
          """
          Read an SSH2-format private key file, looking for a string of the type
          ``"BEGIN xxx PRIVATE KEY"`` for some ``xxx``, base64-decode the text we
          find, and return it as a string.  If the private key is encrypted and
          ``password`` is not ``None``, the given password will be used to
          decrypt the key (otherwise `.PasswordRequiredException` is thrown).
      
          :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the
              data block.
          :param str filename: name of the file to read.
          :param str password:
              an optional password to use to decrypt the key file, if it's
              encrypted.
          :return: the `bytes` that make up the private key.
      
          :raises: ``IOError`` -- if there was an error reading the file.
          :raises: `.PasswordRequiredException` -- if the private key file is
              encrypted, and ``password`` is ``None``.
          :raises: `.SSHException` -- if the key file is invalid.
          """
        with open(filename, "r") as f:
               ^^^^^^^^^^^^^^^^^^^E       FileNotFoundError: [Errno 2] No such file or directory: '/iqe_venv/automation.pem'
      
      /iqe_venv/lib/python3.12/site-packages/paramiko/pkey.py:508: FileNotFoundError 

      Acceptance Criteria:

      • Automation.pem file is updated in Vault
      • Automation.pem file is updated in SWATCH-CI (will need git-crypt as it's located in secret folder)

              rhn-engineering-wpoteat William Poteat
              lburnett0 Lindsey Burnett
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: