Bug 1412582 - [WALA] Cannot run waagent command inside any folder under /var/lib/waagent
Summary: [WALA] Cannot run waagent command inside any folder under /var/lib/waagent
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: WALinuxAgent
Version: 7.3
Hardware: Unspecified
OS: Linux
Target Milestone: rc
: ---
Assignee: Miroslav Rezanina
QA Contact: Virtualization Bugs
Depends On:
Blocks: 1429317
TreeView+ depends on / blocked
Reported: 2017-01-12 11:03 UTC by Yuxin Sun
Modified: 2019-02-26 20:57 UTC (History)
11 users (show)

Fixed In Version: WALinuxAgent-2.2.4
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1429317 (view as bug list)
Last Closed: 2017-03-07 08:51:40 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Github Azure WALinuxAgent issues 546 0 None None None 2017-01-12 11:03:37 UTC

Description Yuxin Sun 2017-01-12 11:03:38 UTC
Description of problem:
Cannot run any waagent command (such as: waagent -version, waagent -deprovision...) inside the any folder under /var/lib/waagent (such as: /var/lib/waagent/events)
It seems that if create a folder inside /var/lib/waagent, go into this folder, any waagent command cannot be run.

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

RHEL Version: 

How reproducible:

Steps to Reproduce:
1. Prepare a RHEL-7.3 VM with WALA-2.2.0+ installed. 
2. Access to the /var/lib/waagent/events folder.
~]# cd /var/lib/waagent/events
4. Run waagent command
events]# waagent -version

Actual Result:
Raise exception. Cannot run this command.

events]# waagent -version
Traceback (most recent call last):
  File "/sbin/waagent", line 31, in <module>
    import azurelinuxagent.agent as agent
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/agent.py", line 29, in <module>
    import azurelinuxagent.common.event as event
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/event.py", line 30, in <module>
    from azurelinuxagent.common.protocol.restapi import TelemetryEventParam, \
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/__init__.py", line 18, in <module>
    from azurelinuxagent.common.protocol.util import get_protocol_util, \
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/protocol/util.py", line 30, in <module>
    from azurelinuxagent.common.osutil import get_osutil
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/__init__.py", line 18, in <module>
    from azurelinuxagent.common.osutil.factory import get_osutil
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/osutil/factory.py", line 20, in <module>
    from azurelinuxagent.common.version import DISTRO_NAME, DISTRO_VERSION, \
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/version.py", line 87, in <module>
    CURRENT_AGENT, CURRENT_VERSION = set_current_agent()
  File "/usr/lib/python2.7/site-packages/azurelinuxagent/common/version.py", line 85, in set_current_agent
    version = AGENT_NAME_PATTERN.match(agent).group(1)
AttributeError: 'NoneType' object has no attribute 'group'

Expect Result:
Can run waagent command.

Additional Info:

Comment 2 Yuhui Jiang 2017-02-21 16:32:10 UTC
Verified on WALinuxAgent-2.2.4-1 RHEL-6.9-20170202.0.
Result is pass.

Comment 3 Yuxin Sun 2017-02-24 11:45:54 UTC
Verified on WALinuxAgent-2.2.4-1 RHEL-7.3 ondemand image.
Result is Pass.

Comment 4 Yuxin Sun 2017-03-06 03:16:03 UTC
Change the status to "POST" for developers to add it into ERRATA.

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