Uploaded image for project: 'Satellite'
  1. Satellite
  2. SAT-23481

`capsule-certs-generate` cannot be run concurrently for different capsules

XMLWordPrintable

    • Low
    • No

      Description of problem:

      When trying to use `capsule-certs-generate` concurrently (using Ansible, for example) to install several capsules at the same time, it fails with this error:

      ```
      Traceback (most recent call last):
      File "/bin/katello-ssl-tool", line 11, in <module>
      load_entry_point('Katello-Certs-Tools==2.9.0', 'console_scripts', 'katello-ssl-tool')()
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 955, in main
      _main()
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 924, in _main
      genServerRpm(DEFS, options.verbose)
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 828, in genServerRpm
      os.unlink(postun_scriptlet)
      FileNotFoundError: [Errno 2] No such file or directory: '/root/ssl-build/postun.scriptlet'
      ```

      The reason for it is that every execution of the command "shares" the `postun.scriptlet` making it impossible to manage it atomically.

      Version-Release number of selected component (if applicable):

      • 6.15
      • Stream

      I'm currently investigating in which other releases this is an issue (I have memories of this since at least 6.13, but I'll double check and create clones if needed).

      How reproducible:

      Always

      Steps to Reproduce:
      1. Run the following code in parallel for two of more capsules:

      capsule-certs-generate --certs-tar /var/www/html/pub/capsule-1.example.com-certs.tar --foreman-proxy-fqdn capsule-1.example.com

      capsule-certs-generate --certs-tar /var/www/html/pub/capsule-2.example.com-certs.tar --foreman-proxy-fqdn capsule-2.example.com

      . . .

      2.
      3.

      Actual results:

      ```
      . . .
      Generating web server's SSL key pair/set RPM:
      /root/ssl-build/capsule-X.example.redhat.com/capsule-X.example.com-puppet-client-1.0-1.src.rpm
      /root/ssl-build/capsule-X.example.com/capsule-X.example.com-puppet-client-1.0-1.noarch.rpm
      Traceback (most recent call last):
      File "/bin/katello-ssl-tool", line 11, in <module>
      load_entry_point('Katello-Certs-Tools==2.9.0', 'console_scripts', 'katello-ssl-tool')()
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 955, in main
      _main()
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 924, in _main
      genServerRpm(DEFS, options.verbose)
      File "/usr/lib/python3.6/site-packages/katello_certs_tools/katello_ssl_tool.py", line 828, in genServerRpm
      os.unlink(postun_scriptlet)
      FileNotFoundError: [Errno 2] No such file or directory: '/root/ssl-build/postun.scriptlet'
      . . .
      ```

      Expected results:

      Certs are generated.

      Additional info:

      I've implemented a fix:

      https://github.com/Katello/katello-certs-tools/pull/46

      which will create the `postun.scriptlet` file inside each capsule directory created on top of `/root/ssl-build/`.

              jira-bugzilla-migration RH Bugzilla Integration
              rhn-support-pmendezh_jira Pablo Mendez Hernandez (Inactive)
              RH Bugzilla Integration RH Bugzilla Integration
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: