Bug 973402 - using rpm consumer errata install run causes an unexpected error
using rpm consumer errata install run causes an unexpected error
Status: CLOSED CURRENTRELEASE
Product: Pulp
Classification: Community
Component: rpm-support (Show other bugs)
2.2 Beta
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 2.2.0
Assigned To: Michael Hrivnak
Preethi Thomas
: Triaged
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-11 17:04 EDT by Jeremy Cline
Modified: 2013-09-10 11:45 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-09-10 11:45:34 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jeremy Cline 2013-06-11 17:04:43 EDT
Description of problem: 
Attempting to install errata with 'pulp-admin rpm consumer errata install run' using the required options causes an unexpected error to occur.


Version-Release number of selected component (if applicable): 
pulp-rpm-admin-extensions-2.2.0-0.3.beta.fc18.noarch


How reproducible: Occurs every time


Steps to Reproduce:
Create a repo, sync it, then bind a consumer to it and attempt to install an erratum

1. pulp-admin rpm repo create --repo-id=zoo --feed=http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/zoo/
2. pulp-admin rpm repo sync run --repo-id=zoo
3. pulp-admin rpm consumer bind --consumer-id=jeremy --repo-id=zoo
4. pulp-admin rpm consumer errata install run --consumer-id=jeremy --errata-id=RHEA-2012:0004

Actual results:
[jcline@jcline ~]$ pulp-admin rpm consumer errata install run --consumer-id=jeremy --errata-id=RHEA-2012:0004
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...

An unexpected error has occurred. More information can be found in the client
log file ~/.pulp/admin.log.


Expected results:
The errata is successfully installed


Additional info:
2013-06-11 16:49:29,883 - ERROR - Client-side exception occurred
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/core.py", line 478, in run
    exit_code = Cli.run(self, args)
  File "/usr/lib/python2.7/site-packages/okaara/cli.py", line 974, in run
    exit_code = command_or_section.execute(self.prompt, remaining_args)
  File "/usr/lib/python2.7/site-packages/pulp/client/extensions/extensions.py", line 224, in execute
    return self.method(*arg_list, **clean_kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/client/commands/consumer/content.py", line 115, in run
    self.poll([task], kwargs)
  File "/usr/lib/python2.7/site-packages/pulp/client/commands/polling.py", line 137, in poll
    task = self._poll_task(task)
  File "/usr/lib/python2.7/site-packages/pulp/client/commands/polling.py", line 202, in _poll_task
    self.progress(task, running_spinner)
  File "/usr/lib/python2.7/site-packages/pulp/client/commands/consumer/content.py", line 138, in progress
    self.progress_tracker.display(task.progress)
  File "/usr/lib/python2.7/site-packages/pulp/client/commands/consumer/content.py", line 385, in display
    self.display_steps(report['steps'])
KeyError: 'steps'
Comment 1 Jeremy Cline 2013-06-12 16:33:25 EDT
Set up a test repo:
1. pulp-admin rpm repo create --repo-id=errata_install --feed=http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/test_errata_install/
2. pulp-admin rpm repo sync run --repo-id=errata_install
3. pulp-admin rpm consumer bind --consumer-id=jeremy --repo-id=errata_install
4. pulp-admin rpm consumer package install run --consumer-id=jeremy --name=grinder_test_package-2.0

[jcline@jcline ~]$ rpm -q grinder_test_package
grinder_test_package-2.0-1.fc14.noarch

Attempt to install an errata:
pulp-admin rpm consumer errata install run --consumer-id=jeremy --errata-id=ginder_test_4

agent.log:
2013-06-12 16:25:14,932 [INFO][worker-0] bind() @ repolib.py:108 - Binding repo [errata_install]
2013-06-12 16:25:14,932 [INFO][worker-0] _handle_host_urls() @ repolib.py:342 - Configuring repo [errata_install] to use baseurl [https://jcline.vm.redhat.com/pulp/repos/errata_install]
2013-06-12 16:25:14,932 [INFO][worker-0] bind() @ repolib.py:134 - Adding new repo [errata_install]
2013-06-12 16:25:14,933 [INFO][worker-0] sendreply() @ rmi.py:172 - 26b18e65-8946-43e8-82bc-aa58f1d881bb processed in: 45 (ms)
2013-06-12 16:26:48,456 [INFO][worker-0] dispatch() @ dispatcher.py:631 - request: {'classname': 'Content', 'kws': {}, 'args': [[{'unit_key': {'name': 'grinder_test_package-2.0'}, 'type_id': 'rpm'}], {'apply': True, 'reboot': False, 'importkeys': False}], 'method': 'install', 'cntr': None}
2013-06-12 16:26:51,198 [INFO][worker-0] sendreply() @ rmi.py:172 - 3a791654-751c-4bdc-a06c-709a4cc431bc processed in: 2.785 (seconds)
2013-06-12 16:27:55,141 [INFO][worker-0] dispatch() @ dispatcher.py:631 - request: {'classname': 'Content', 'kws': {}, 'args': [[], {'apply': True, 'reboot': False, 'importkeys': False}], 'method': 'install', 'cntr': None}
2013-06-12 16:27:55,142 [INFO][worker-0] sendreply() @ rmi.py:172 - d0b8a873-c723-4592-97a0-9f5c5ec18bfa processed in: 34 (ms)
Comment 2 Jeremy Cline 2013-06-14 11:27:12 EDT
OK. I don't know what I'm doing different today, but I can get an erratum to successfully install. If I don't use yum clean all first, I do get DownloadCallback instance has no attribute 'fsize'.

1. pulp-admin rpm repo create --repo-id=errata_test --feed=http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/test_errata_install/
2. pulp-admin rpm repo sync run --repo-id=errata_test
3. sudo pulp-consumer -u admin register --consumer-id=jeremy
4. pulp-admin rpm consumer bind --consumer-id=jeremy --repo-id=errata_test
5. pulp-admin rpm consumer package install run --consumer-id=jeremy --name=grinder_test_package-2.0

[jcline@jcline ~]$ rpm -qa | grep grinder
grinder-0.1.16-1.fc18.noarch
grinder_test_package-2.0-1.fc14.noarch

[jcline@jcline ~]$ pulp-admin rpm consumer errata install run --consumer-id=jeremy --errata-id=grinder_test_3
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...
Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ FAILED ]

Install Failed

DownloadCallback instance has no attribute 'fsize'

[jcline@jcline ~]$ sudo yum clean all
Loaded plugins: langpacks, presto, pulp-profile-update, refresh-packagekit
Cleaning repos: errata_test fedora pulp-v2-testing updates
Cleaning up Everything
No delta-package files removed by presto

[jcline@jcline ~]$ pulp-admin rpm consumer errata install run --consumer-id=jeremy --errata-id=grinder_test_3
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...
Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ OK ]
Check Package Signatures                [ OK ]
Running Test Transaction                [ OK ]
Running Transaction                     [ OK ]

Install Succeeded
...

[jcline@jcline ~]$ rpm -qa | grep grinder
grinder-0.1.16-1.fc18.noarch
grinder_test_package-3.0-1.fc14.noarch


The KeyError in the original bug report occurs if I specify a non-existent consumer and/or non-existent errata-id, or if the consumer is not bound to the repo containing the erratum.
Comment 3 Jeremy Cline 2013-06-17 11:13:47 EDT
The same KeyError occurs on puppet install/uninstall/update commands as well. 

To reproduce:
1. pulp-admin puppet repo create --repo-id=puppet-repo --feed=http://forge.puppetlabs.com/ --queries=puppetlabs
2. Sync the repo and bind a consumer to it.
3. pulp-admin puppet consumer install run --consumer-id=puppet-install --content-unit=puppetlabs/stdlib
Comment 4 Jeff Ortel 2013-06-17 14:48:43 EDT
https://github.com/pulp/pulp/pull/517

The CallReport.progress is initialized as "progress or {}".  So, {} is a valid value for the progress.  After reproducing, I was able to verify that the agent is not passing an invalid progress report.  Instead, we see this error when the CLI polls the tasks and attempts to render the progress before it is ever updated by the agent.  In light of this, I believe it's safe to only render the progress report when it's not None or {}.

Note: We're only fixing the KeyError on 'steps' here.
Comment 5 Jeff Ortel 2013-06-17 16:18:54 EDT
build: 2.2.0-0.4.beta
Comment 6 Preethi Thomas 2013-06-20 15:38:17 EDT
failing this as well. Not sure what the issue is here

I cant seem to get the errata to install

so according to my errata applicability I should be able to install the package grinder_test_4. 

but  

{'erratum': {'filters': {'id': {'$in': ['grinder_test_package',
                                        'grinder_test_4']}}}}

Request Body
{
  "consumer_criteria": {
    "sort": [
      [
        "id", 
        "ascending"
      ]
    ], 
    "filters": {
      "id": {
        "$in": [
          "test.consumer"
        ]
      }
    }
  }, 
  "repo_criteria": {}, 
  "unit_criteria": {
    "erratum": {
      "filters": {
        "id": {
          "$in": [
            "grinder_test_package", 
            "grinder_test_4"
          ]
        }
      }
    }
  }
}
Response Body
{
  "erratum": {
    "test.consumer": [
      {
        "details": {
          "status": "final", 
          "from": "pulp-list@redhat.com", 
          "description": null, 
          "title": "Test Errata referring to grinder_test_package-4.0", 
          "issued": "2010-11-7 00:00:00", 
          "pkglist": [
            {
              "packages": [
                {
                  "src": "grinder_test_package-4.0-1.fc14.src.rpm", 
                  "name": "grinder_test_package", 
                  "sum": [
                    "md5", 
                    "d89e83ed183fa55dfb0bd2eec14db93c"
                  ], 
                  "filename": "grinder_test_package-4.0-1.fc14.noarch.rpm", 
                  "epoch": "0", 
                  "version": "4.0", 
                  "release": "1.fc14", 
                  "arch": "noarch"
                }
              ], 
              "name": "F14 Pulp Test Packages", 
              "short": "F14PTP"
            }
          ], 
          "version": "1", 
          "references": [], 
          "_content_type_id": "erratum", 
          "_ns": "units_erratum", 
          "_id": "39345ebb-d8e4-4a45-add5-daade8cbc3af", 
          "type": "enhancements", 
          "id": "grinder_test_4"
        }, 
        "summary": {
          "unit_key": "grinder_test_4"
        }
      }
    ]
  }
}

But from agent.log


[root@qe-blade-03 ~]# rpm -q grinder_test_package
grinder_test_package-2.0-1.fc14.noarch
[root@qe-blade-03 ~]# 
[root@qe-blade-03 ~]# 

2013-06-20 15:35:01,094 [INFO][worker-0] dispatch() @ dispatcher.py:631 - request: {'classname': 'Content', 'kws': {}, 'args': [[], {'apply': True, 'reboot': False, 'importkeys': False}], 'method': 'install', 'cntr': None}
2013-06-20 15:35:01,095 [INFO][worker-0] sendreply() @ rmi.py:172 - d8c586b7-c168-4cb9-96fc-4c6b378f1a9c processed in: 547 (ms)
Comment 7 Michael Hrivnak 2013-07-03 11:11:47 EDT
https://github.com/pulp/pulp_rpm/pull/270
Comment 8 Michael Hrivnak 2013-08-02 10:23:44 EDT
build: 2.2.0-0.23.beta
Comment 9 Preethi Thomas 2013-08-07 14:39:05 EDT
verified

[root@cloud-qe-14 ~]# pulp-admin rpm repo create --repo-id=errata_install --feed=http://repos.fedorapeople.org/repos/pulp/pulp/demo_repos/test_errata_install/
Successfully created repository [errata_install]

[root@cloud-qe-14 ~]# pulp-admin rpm repo sync run --repo-id=errata_install
+----------------------------------------------------------------------+
               Synchronizing Repository [errata_install]
+----------------------------------------------------------------------+

This command may be exited by pressing ctrl+c without affecting the actual
operation on the server.

Downloading metadata...
[\]
... completed

Downloading repository content...
[==================================================] 100%
RPMs:       11/11 items
Delta RPMs: 0/0 items

... completed

Downloading distribution files...
[==================================================] 100%
Distributions: 0/0 items
... completed

Importing errata...
[-]
... completed

Importing package groups/categories...
[-]
... completed

Publishing packages...
[==================================================] 100%
Packages: 11/11 items
... completed

Publishing distributions...
[==================================================] 100%
Distributions: 0/0 items
... completed

Generating metadata
[\]
... completed

Publishing repository over HTTPS
[-]
... completed

[root@cloud-qe-14 ~]# pulp-admin rpm consumer bind --consumer-id=consumer1 --repo-id=errata_install
This command may be exited via ctrl+c without affecting the request.

-- Updating Pulp Server --
[-]
Waiting to begin...

[-]
Running...

Task Succeeded


-- Notifying the Consumer --
[-]
Waiting to begin...

[|]
Running...

Task Succeeded


[root@cloud-qe-14 ~]# pulp-admin rpm consumer package install run --consumer-id=consumer1 --name=grinder_test_package-2.0
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...
Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ OK ]
Check Package Signatures                [ OK ]
Running Test Transaction                [ OK ]
Running Transaction                     [ OK ]

Install Succeeded

+----------------------------------------------------------------------+
                               Installed
+----------------------------------------------------------------------+

Name:    grinder_test_package
Version: 2.0
Arch:    noarch
Repoid:  errata_install



[root@cloud-qe-14 ~]#  pulp-admin rpm consumer errata install run --consumer-id=consumer1 --errata-id=grinder_test_3
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...
Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ OK ]
Check Package Signatures                [ OK ]
Running Test Transaction                [ OK ]
Running Transaction                     [ OK ]

Install Succeeded

+----------------------------------------------------------------------+
                               Installed
+----------------------------------------------------------------------+

Name:    grinder_test_package
Version: 3.0
Arch:    noarch
Repoid:  errata_install



[root@cloud-qe-14 ~]# 

[root@cloud-qe-14 ~]#  pulp-admin rpm consumer errata install run --consumer-id=consumer1 --errata-id=grinder_test_4
This command may be exited via ctrl+c without affecting the request.

[-]
Waiting to begin...
Refresh Repository Metadata             [ OK ]
Downloading Packages                    [ OK ]
Check Package Signatures                [ OK ]
Running Test Transaction                [ OK ]
Running Transaction                     [ OK ]

Install Succeeded

+----------------------------------------------------------------------+
                               Installed
+----------------------------------------------------------------------+

Name:    grinder_test_package
Version: 4.0
Arch:    noarch
Repoid:  errata_install



[root@cloud-qe-14 ~]# 



[root@ibm-x3550m3-09 ~]#  rpm -q grinder_test_package
grinder_test_package-3.0-1.fc14.noarch
[root@ibm-x3550m3-09 ~]#  rpm -q grinder_test_package
grinder_test_package-4.0-1.fc14.noarch
[root@ibm-x3550m3-09 ~]#
Comment 11 Preethi Thomas 2013-09-10 11:45:34 EDT
2.2 released
http://repos.fedorapeople.org/repos/pulp/pulp/stable/2.2/

Note You need to log in before you can comment on or make changes to this bug.