Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

server_url not honored in subscription_manager #20390

Open
jarovo opened this issue Jul 27, 2020 · 4 comments
Open

server_url not honored in subscription_manager #20390

jarovo opened this issue Jul 27, 2020 · 4 comments

Comments

@jarovo
Copy link

jarovo commented Jul 27, 2020

CFME Version 5.11.7.2.20200724203717_1cdf0a2

When server_url is set, it is not propagated to the subscribtion_mangaer command and I am getting:

[----] E, [2020-07-27T12:06:13.733233 #6665:2ab1640fa5c4] ERROR -- : AwesomeSpawn: subscription-manager orgs exit code: 70
[----] E, [2020-07-27T12:06:13.733419 #6665:2ab1640fa5c4] ERROR -- : AwesomeSpawn: Service not available, please try again later

[----] E, [2020-07-27T12:06:13.733760 #6665:2ab1640fa5c4] ERROR -- : MIQ(MiqQueue#deliver) Message id: [245], Error: [subscription-manager orgs exit code: 70 error was: Service not available, please try again later
 error was: Service not available, please try again later
]
[----] E, [2020-07-27T12:06:13.734097 #6665:2ab1640fa5c4] ERROR -- : [LinuxAdmin::SubscriptionManagerError]: subscription-manager orgs exit code: 70 error was: Service not available, please try again later
 error was: Service not available, please try again later
  Method:[block (2 levels) in <class:LogProxy>]
[----] E, [2020-07-27T12:06:13.734302 #6665:2ab1640fa5c4] ERROR -- : /opt/rh/cfme-gemset/gems/linux_admin-2.0.1/lib/linux_admin/registration_system/subscription_manager.rb:9:in `rescue in run!'
/opt/rh/cfme-gemset/gems/linux_admin-2.0.1/lib/linux_admin/registration_system/subscription_manager.rb:5:in `run!'
/opt/rh/cfme-gemset/gems/linux_admin-2.0.1/lib/linux_admin/registration_system/subscription_manager.rb:38:in `organizations'
/var/www/miq/vmdb/app/models/registration_system.rb:71:in `available_organizations'
/var/www/miq/vmdb/app/models/miq_queue.rb:479:in `block in dispatch_method'

This code is fixing the behaviour for the case where the server_url was present

    def organizations(options)
      raise ArgumentError, "username and password are required" unless options[:username] && options[:password]

      install_server_certificate(options[:server_url], SATELLITE6_SERVER_CERT_PATH) if options[:server_url]

      cmd = "subscription-manager orgs"

      params = {"--username=" => options[:username], "--password=" => options[:password],
                "--serverurl=" => options[:server_url]}      ### ADDED   !!!!!!!!!!
      params.merge!(proxy_params(options))

      result = run!(cmd, :params => params)
      parse_output(result.output).each_with_object({}) { |i, h| h[i[:name]] = i }
    end

    def register(options)
      raise ArgumentError, "username and password are required" unless options[:username] && options[:password]

      install_server_certificate(options[:server_url], SATELLITE6_SERVER_CERT_PATH) if options[:server_url]

      cmd = "subscription-manager register"

      params = {"--username=" => options[:username], "--password=" => options[:password],
                "--serverurl=" => options[:server_url]}    ### ADDED   !!!!!!!!!!
      params.merge!(proxy_params(options))
      params["--environment="] = options[:environment] if options[:environment]
      params["--org="]         = options[:org]         if options[:server_url] && options[:org]

      run!(cmd, :params => params)
    end

@gtanzillo
Copy link
Member

@dmetzger57 Fyi, not sure if we need to fix this in Ivanchuk

@dmetzger57
Copy link
Contributor

@JaryN where does the broken code (for which you show a fix above) live?

@jarovo
Copy link
Author

jarovo commented Jul 31, 2020

@JaryN where does the broken code (for which you show a fix above) live?

https://github.com/ManageIQ/integration_tests/pull/10272/files

I can prepare manual test steps if it helps as I guess it may not be obvious what is getting filled with what value from the code.

We are using RedHat's staging RHN server. The url gets filled on line 203 (old) / 206 (new) in that PR.

@jarovo
Copy link
Author

jarovo commented Aug 18, 2020

I replied to @dmetzger57 privately on Gitter about how to reporoduce this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants