Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1476053

Summary: network role produces fatal error when interface already configured
Product: Red Hat Enterprise Linux 7 Reporter: Terry Bowling <tbowling>
Component: rhel-system-rolesAssignee: Thomas Haller <thaller>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: aloughla, atragler, fedoraproject, ovasik, pcahyna, thaller
Target Milestone: rcKeywords: Extras, Rebase
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-19 15:21:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Terry Bowling 2017-07-28 00:26:06 UTC
Description of problem:

rhel-system-roles.network produces fatal error codes if network connection is already configured.

The ansible way is to be idempotent, meaning if already in that state, it simply reports that no change is needed.



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

rhel-system-roles-0.1-2.el7.noarch

actually, for this test I was using the upstream linux-system-roles.network version

ansible-galaxy info linux-system-roles.network
Role: linux-system-roles.network
        description: Configure networking
        active: True
        commit: efe4201f860bea282b9c61fa38f257e41904c509
        commit_message: library: drop unused "ip_is_present" variable

We don't care whether a 'ip' or 'bond' setting is
entirely omitted or whether some fields are set by
the user.

Omitting a setting should make use of some default
values, but that's it. No need to track wheth
        commit_url: https://github.com/linux-system-roles/network/commit/efe4201f860bea282b9c61fa38f257e41904c509
        company: Red Hat, Inc.
        created: 2017-04-28T16:13:00.425Z
        download_count: 24
        forks_count: 2
        galaxy_info:
                author: Thomas Haller <thaller>
                company: Red Hat, Inc.
                galaxy_tags: ['system', 'beta', 'network', 'networking']
                license: BSD-3-Clause
                min_ansible_version: 1.2
                platforms: [{'name': 'Fedora', 'versions': [24, 25]}, {'name': 'EL', 'versions': [6, 7]}]
        github_branch: 
        github_repo: network
        github_user: linux-system-roles
        id: 17498
        install_date: Tue Jul 18 18:42:27 2017
        intalled_version: 0.2
        is_valid: True
        issue_tracker_url: https://github.com/linux-system-roles/network/issues
        license: BSD-3-Clause
        min_ansible_version: 1.2
        modified: 2017-07-28T00:23:08.141Z
        namespace: linux-system-roles
        open_issues_count: 2
        path: [u'/etc/ansible/roles', u'/usr/share/ansible/roles']





How reproducible:

Run the following playbook twice:

---
# Template playbook for Linux System Roles
# https://linux-system-roles.github.io/
# https://galaxy.ansible.com/linux-system-roles/
# https://github.com/linux-system-roles/
 
- hosts: rhel7-latest, rhel7-beta
  become: yes
  become_method: sudo
  become_user: root
  vars:
    network_connections:
      - name: DBnic
        state: up
        type: ethernet
        interface_name: eth1
        #mac: "52:54:00:e1:c2:4c"
        autoconnect: yes
        ip:
          auto6: no
          route_metric6: -1
          gateway6: 2001:db8::1
 
          address:
            - 10.4.2.90/16
            - 192.168.99.99/24
            - 2001:db8::80/7



Actual results:

[tbowling@tbowling demo]$ ansible-playbook -l rhel7-latest example-network.yml 
[sudo] password for tbowling: 

PLAY [rhel7-latest, rhel7-beta] ************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************
ok: [rhel7-latest]

TASK [linux-system-roles.network : Set version specific variables] *************************************************************************************************************
ok: [rhel7-latest] => (item=/etc/ansible/roles/linux-system-roles.network/vars/default.yml)

TASK [linux-system-roles.network : Install packages] ***************************************************************************************************************************
ok: [rhel7-latest]

TASK [linux-system-roles.network : Enable network service] *********************************************************************************************************************
ok: [rhel7-latest]

TASK [linux-system-roles.network : Configure networking connection profiles] ***************************************************************************************************
 [WARNING]: <info>  #0, state:up, "DBnic": connection DBnic, e2e4408d-7811-4dc4-8f8d-5f9d60b28301 already up to date

 [WARNING]: <info>  #0, state:up, "DBnic": up connection DBnic, e2e4408d-7811-4dc4-8f8d-5f9d60b28301

 [WARNING]: <warn>  #0, state:up, "DBnic": failure: 'ActiveConnection' object has no attribute 'get_state_reason' [[Traceback (most recent call last):   File
"/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1776, in run     self.run_state_up(idx)   File "/tmp/ansible_uYl5lf/ansible_module_network_connections.py",
line 1942, in run_state_up     self.nmutil.connection_activate_wait(ac, wait_time)   File "/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1498, in
connection_activate_wait     complete, failure_reason = check_activated(ac, dev)   File "/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1468, in
check_activated     ac_reason = ac.get_state_reason() AttributeError: 'ActiveConnection' object has no attribute 'get_state_reason' ]]

 [WARNING]: exception: Traceback (most recent call last):   File "/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 2103, in <module>     Cmd.create().run()
File "/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1776, in run     self.run_state_up(idx)   File
"/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1942, in run_state_up     self.nmutil.connection_activate_wait(ac, wait_time)   File
"/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1498, in connection_activate_wait     complete, failure_reason = check_activated(ac, dev)   File
"/tmp/ansible_uYl5lf/ansible_module_network_connections.py", line 1468, in check_activated     ac_reason = ac.get_state_reason() AttributeError: 'ActiveConnection' object has
no attribute 'get_state_reason'

fatal: [rhel7-latest]: FAILED! => {"changed": false, "failed": true, "msg": "fatal error: 'ActiveConnection' object has no attribute 'get_state_reason'"}
	to retry, use: --limit @/home/tbowling/src/virt-demo/ansible/demo/example-network.retry

PLAY RECAP *********************************************************************************************************************************************************************
rhel7-latest               : ok=4    changed=0    unreachable=0    failed=1   




Expected results:

Less output noting that no change is needed, not a Fatal error.

Additional info:

Comment 5 errata-xmlrpc 2017-10-19 15:21:00 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2017:2970