sync-images action shows as failed because yaml.load deprecation

Bug #1979260 reported by Gustavo Sanchez
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Glance-Simplestreams-Sync Charm
Fix Committed
Undecided
Unassigned

Bug Description

juju run-action glance-simplestreams-sync/1 sync-images --wait
unit-glance-simplestreams-sync-1:
  UnitId: glance-simplestreams-sync/1
  id: "23"
  message: exit status 1
  results:
    ReturnCode: 1
    Stderr: |
      /usr/share/glance-simplestreams-sync/glance_simplestreams_sync.py:119: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
        confobj = yaml.load(f)
  status: failed
  timing:
    completed: 2022-06-21 02:37:39 +0000 UTC
    enqueued: 2022-06-21 02:37:35 +0000 UTC
    started: 2022-06-21 02:37:37 +0000 UTC

There is information at https://msg.pyyaml.org/load on how to fix it

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to charm-glance-simplestreams-sync (master)
Changed in charm-glance-simplestreams-sync:
status: New → In Progress
Revision history for this message
Nobuto Murata (nobuto) wrote (last edit ):

This warning is nice to be fixed but I'm not inclined to believe that's the root cause of `ReturnCode: 1`. The real error is something else I suppose. I would check /var/log/glance-simplestreams-sync.log to see what's going on.

$ python3 --version
Python 3.10.4

$ python3 -c 'import yaml; foo = yaml.load("bar")'; echo ret=$?
<string>:1: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
ret=0

Just for reference, the deprecation warning was there for some time and it wasn't blocking the action.
https://bugs.launchpad.net/charm-glance-simplestreams-sync/+bug/1939839

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to charm-glance-simplestreams-sync (master)

Reviewed: https://review.opendev.org/c/openstack/charm-glance-simplestreams-sync/+/848646
Committed: https://opendev.org/openstack/charm-glance-simplestreams-sync/commit/5687d74d61a04b4d76a6774858e226ef1aef21ab
Submitter: "Zuul (22348)"
Branch: master

commit 5687d74d61a04b4d76a6774858e226ef1aef21ab
Author: Felipe Reyes <email address hidden>
Date: Mon Jul 4 10:58:47 2022 -0400

    Use yaml.safe_load()

    Use safe_load() instead of load() when loading a yaml content, more
    details at https://msg.pyyaml.org/load

    Closes-Bug: #1979260
    Change-Id: I5f96a102be8753eea240cf05e2ca304057101530

Changed in charm-glance-simplestreams-sync:
status: In Progress → Fix Committed
Revision history for this message
Felipe Reyes (freyes) wrote :

@Nobuto, I believe you are right.

@Gustavo, could you check the logs available at /var/snap/simplestreams/common ?, there should be a log file produced by simplestreams and it may contain information on what failed with the syncing process.

Revision history for this message
Gustavo Sanchez (gustavosr98) wrote :

Yeah, what @Nobuto says makes total sense.

I couldn't find any file logs.
So I ran the action again to take a look and now it seemed to have worked

juju run-action glance-simplestreams-sync/1 sync-images --wait
unit-glance-simplestreams-sync-1:
  UnitId: glance-simplestreams-sync/1
  id: "29"
  results:
    Stderr: |
      /usr/lib/python3/dist-packages/keystoneauth1/adapter.py:235: UserWarning: Using keystoneclient sessions has been deprecated. Please update your software to use keystoneauth1.
        warnings.warn('Using keystoneclient sessions has been deprecated. '
    Stdout: |
      created 6ae08d08-e37b-46f0-a2c3-bdda7c5029bf: auto-sync/ubuntu-trusty-14.04-amd64-server-20191107-disk1.img
      created 0a177fe7-64e6-4ec0-b4a4-549ff05a73ad: auto-sync/ubuntu-xenial-16.04-amd64-server-20211001-disk1.img
      created 28356da6-173a-46ac-87db-8a4ced8fa470: auto-sync/ubuntu-bionic-18.04-amd64-server-20220615-disk1.img
      created 64936802-654d-40da-bc69-191dd573f638: auto-sync/ubuntu-focal-20.04-amd64-server-20220615-disk1.img
  status: completed
  timing:
    completed: 2022-07-05 17:35:24 +0000 UTC
    enqueued: 2022-07-05 17:33:04 +0000 UTC
    started: 2022-07-05 17:33:05 +0000 UTC

Could have just been a connectivity issue during the first time I run the action

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.