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

fix for nfs mounts in _active_mounts_openbsd() #29883

Merged
merged 2 commits into from
Dec 21, 2015

Conversation

serge-p
Copy link
Contributor

@serge-p serge-p commented Dec 21, 2015

attempting to run following state

/backup:
mount.mounted:
- device: joule:/backup
- fstype: nfs
- mkmnt: True
- opts: rw,nodev,nosuid

getting unexpected behavior:

        ID: /backup
    Function: mount.mounted
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1591, in call
                  **cdata['kwargs'])
                File "/usr/local/lib/python2.7/site-packages/salt/states/mount.py", line 120, in mounted
                  active = __salt__['mount.active'](extended=True)
                File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 184, in active
                  _active_mounts_openbsd(ret)
                File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 148, in _active_mounts_openbsd
                  'opts': parens[1].split(", "),
              IndexError: list index out of range
     Started: 21:51:47.764708
    Duration: 38.882 ms

issue clarification:

function _active_mounts_openbsd()
expecting all mount points to have DUID
but NFS mounts do not have DUIDs generated, so line need to be parsed separately

proposal:

  1. check length of parens array
  2. and have a different parsing for lines with no DUIDs in them

testing same state after change:

  Name: /etc/fstab - Function: file.blockreplace - Result: Clean
  Name: /d01 - Function: mount.mounted - Result: Clean
  Name: /stage - Function: mount.mounted - Result: Clean
  Name: /backup - Function: mount.mounted - Result: Changed

Thanks,
Sergey.

attempting to run following state
---

/backup:
  mount.mounted:
    - device: joule:/backup
    - fstype: nfs
    - mkmnt: True
    - opts: rw,nodev,nosuid

getting unexpected behavior: 
----------
 
``` 
        ID: /backup
    Function: mount.mounted
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/usr/local/lib/python2.7/site-packages/salt/state.py", line 1591, in call
                  **cdata['kwargs'])
                File "/usr/local/lib/python2.7/site-packages/salt/states/mount.py", line 120, in mounted
                  active = __salt__['mount.active'](extended=True)
                File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 184, in active
                  _active_mounts_openbsd(ret)
                File "/usr/local/lib/python2.7/site-packages/salt/modules/mount.py", line 148, in _active_mounts_openbsd
                  'opts': parens[1].split(", "),
              IndexError: list index out of range
     Started: 21:51:47.764708
    Duration: 38.882 ms
```

issue clarification: 
---
function _active_mounts_openbsd() 
expecting all mount points to have DUID   
but NFS mounts do not have DUIDs generated, so line need to be parsed separately  

proposal: 
---
1. check length of parens array 
2. and have a different parsing for lines with no DUIDs  in them

testing same state after change: 
---

```
  Name: /etc/fstab - Function: file.blockreplace - Result: Clean
  Name: /d01 - Function: mount.mounted - Result: Clean
  Name: /stage - Function: mount.mounted - Result: Clean
  Name: /backup - Function: mount.mounted - Result: Changed
```

---
Thanks, 
Sergey.
@cachedout
Copy link
Contributor

Hi Sergey,

Same white-space issue here as the other one. When you've updated the PR, please let me know and I'll get it in. Thanks!

@cachedout cachedout added the pending-changes The pull request needs additional changes before it can be merged label Dec 21, 2015
added a line
cachedout pushed a commit that referenced this pull request Dec 21, 2015
fix for nfs mounts in _active_mounts_openbsd()
@cachedout cachedout merged commit 5e44639 into saltstack:2015.8 Dec 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-changes The pull request needs additional changes before it can be merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants