{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt/issues/23694","labels_url":"https://api.github.com/repos/saltstack/salt/issues/23694/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt/issues/23694/comments","events_url":"https://api.github.com/repos/saltstack/salt/issues/23694/events","html_url":"https://github.com/saltstack/salt/issues/23694","id":76221413,"number":23694,"title":"mdadm.py module","user":{"login":"gmolight","id":7482854,"avatar_url":"https://avatars.githubusercontent.com/u/7482854?v=3","gravatar_id":"","url":"https://api.github.com/users/gmolight","html_url":"https://github.com/gmolight","followers_url":"https://api.github.com/users/gmolight/followers","following_url":"https://api.github.com/users/gmolight/following{/other_user}","gists_url":"https://api.github.com/users/gmolight/gists{/gist_id}","starred_url":"https://api.github.com/users/gmolight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmolight/subscriptions","organizations_url":"https://api.github.com/users/gmolight/orgs","repos_url":"https://api.github.com/users/gmolight/repos","events_url":"https://api.github.com/users/gmolight/events{/privacy}","received_events_url":"https://api.github.com/users/gmolight/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/saltstack/salt/labels/Info%20Needed","name":"Info Needed","color":"c7def8"}],"state":"open","locked":false,"assignee":{"login":"jfindlay","id":702905,"avatar_url":"https://avatars.githubusercontent.com/u/702905?v=3","gravatar_id":"","url":"https://api.github.com/users/jfindlay","html_url":"https://github.com/jfindlay","followers_url":"https://api.github.com/users/jfindlay/followers","following_url":"https://api.github.com/users/jfindlay/following{/other_user}","gists_url":"https://api.github.com/users/jfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/jfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfindlay/subscriptions","organizations_url":"https://api.github.com/users/jfindlay/orgs","repos_url":"https://api.github.com/users/jfindlay/repos","events_url":"https://api.github.com/users/jfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/jfindlay/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/saltstack/salt/milestones/37","html_url":"https://github.com/saltstack/salt/milestones/Blocked","labels_url":"https://api.github.com/repos/saltstack/salt/milestones/37/labels","id":343741,"number":37,"title":"Blocked","description":"Issues which are blocked in some way, whether they need further discussion, clarification, justification, or are blocked for some other reason.","creator":{"login":"basepi","id":702318,"avatar_url":"https://avatars.githubusercontent.com/u/702318?v=3","gravatar_id":"","url":"https://api.github.com/users/basepi","html_url":"https://github.com/basepi","followers_url":"https://api.github.com/users/basepi/followers","following_url":"https://api.github.com/users/basepi/following{/other_user}","gists_url":"https://api.github.com/users/basepi/gists{/gist_id}","starred_url":"https://api.github.com/users/basepi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/basepi/subscriptions","organizations_url":"https://api.github.com/users/basepi/orgs","repos_url":"https://api.github.com/users/basepi/repos","events_url":"https://api.github.com/users/basepi/events{/privacy}","received_events_url":"https://api.github.com/users/basepi/received_events","type":"User","site_admin":false},"open_issues":234,"closed_issues":550,"state":"open","created_at":"2013-05-28T22:24:12Z","updated_at":"2015-05-14T19:24:58Z","due_on":null,"closed_at":null},"comments":2,"created_at":"2015-05-14T04:04:04Z","updated_at":"2015-05-14T19:51:15Z","closed_at":null,"body":"running the mdadm state against minion in order to create a RAID device. While the device is successfully created the state returns the message below when trying to call the saved_config() method from mdadm module. \r\n```python\r\nThe minion function caused an exception: Traceback (most recent call last):\r\n      File \"/usr/lib/python2.7/dist-packages/salt/minion.py\", line 1142, in _thread_return\r\n        return_data = func(*args, **kwargs)\r\n      File \"/usr/lib/python2.7/dist-packages/salt/modules/mdadm.py\", line 291, in save_config\r\n        vol_d = dict([(line.split()[1], line) for line in scan])\r\n    IndexError: list index out of range\r\n```\r\nI also tried the module directly and once again it works fine when creating a RAID device but fails when trying to save the config. Please advice "},"comment":{"url":"https://api.github.com/repos/saltstack/salt/issues/comments/102149215","html_url":"https://github.com/saltstack/salt/issues/23694#issuecomment-102149215","issue_url":"https://api.github.com/repos/saltstack/salt/issues/23694","id":102149215,"user":{"login":"gmolight","id":7482854,"avatar_url":"https://avatars.githubusercontent.com/u/7482854?v=3","gravatar_id":"","url":"https://api.github.com/users/gmolight","html_url":"https://github.com/gmolight","followers_url":"https://api.github.com/users/gmolight/followers","following_url":"https://api.github.com/users/gmolight/following{/other_user}","gists_url":"https://api.github.com/users/gmolight/gists{/gist_id}","starred_url":"https://api.github.com/users/gmolight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gmolight/subscriptions","organizations_url":"https://api.github.com/users/gmolight/orgs","repos_url":"https://api.github.com/users/gmolight/repos","events_url":"https://api.github.com/users/gmolight/events{/privacy}","received_events_url":"https://api.github.com/users/gmolight/received_events","type":"User","site_admin":false},"created_at":"2015-05-14T19:51:15Z","updated_at":"2015-05-14T19:51:15Z","body":"Sorry about not posting wiki the report.\r\nOS: Ubuntu 14.04\r\nmaster: \r\n                  Salt: 2015.5.0\r\n                Python: 2.7.6 (default, Mar 22 2014, 22:59:56)\r\n                Jinja2: 2.7.2\r\n              M2Crypto: 0.21.1\r\n        msgpack-python: 0.3.0\r\n          msgpack-pure: Not Installed\r\n              pycrypto: 2.6.1\r\n               libnacl: Not Installed\r\n                PyYAML: 3.10\r\n                 ioflo: Not Installed\r\n                 PyZMQ: 14.0.1\r\n                  RAET: Not Installed\r\n                   ZMQ: 4.0.4\r\n                  Mako: 0.9.1\r\n Debian source package: 2015.5.0+ds-1trusty1\r\nminion:\r\n                  Salt: 2015.5.0\r\n                Python: 2.7.6 (default, Mar 22 2014, 22:59:56)\r\n                Jinja2: 2.7.2\r\n              M2Crypto: 0.21.1\r\n        msgpack-python: 0.3.0\r\n          msgpack-pure: Not Installed\r\n              pycrypto: 2.6.1\r\n               libnacl: Not Installed\r\n                PyYAML: 3.10\r\n                 ioflo: Not Installed\r\n                 PyZMQ: 14.0.1\r\n                  RAET: Not Installed\r\n                   ZMQ: 4.0.4\r\n                  Mako: 0.9.1\r\n\r\nBTW, I did my own hack on it to get it working it seems that the regex that handles the return of the mdadm --list-scan is faulty when trying to parse the output. My solution is currently based on one record returned, however I was able to successfully removed the \"buggy_ubuntu_tags\" from the returned record, and successfully appended the record to the cfg_file. Please note that I did this mainly because I had to get these RAID objects deploy. I did not cleaned it up, did not know if it was good approach before I do a pull request. \r\n\r\n274     scan = __salt__['cmd.run']('mdadm --detail --scan', python_shell=False).split()\r\n275     # Issue with mdadm and ubuntu\r\n276     # REF: http://askubuntu.com/questions/209702/why-is-my-raid-dev-md1-showing-up-as-dev-md126-is-mdadm-conf-being-ignored\r\n277     if __grains__['os'] == 'Ubuntu':\r\n278         buggy_ubuntu_tags = ['name', 'metadata']\r\n279         for attribute in scan[:]:\r\n280             if attribute.startswith('name'):\r\n281                 scan.remove(attribute)\r\n282             elif attribute.startswith('metadata'):\r\n283                 scan.remove(attribute)\r\n284 \r\n285         #for i, elem in enumerate(scan):\r\n286         #    for bad_tag in buggy_ubuntu_tags:\r\n287         #        pattern = r'\\s{0}=\\S+'.format(re.escape(bad_tag))\r\n288         #        pattern = re.compile(pattern, flags=re.I)\r\n289         #        scan[i] = re.sub(pattern, '', scan[i])\r\n290 \r\n291     if __grains__.get('os_family') == 'Debian':\r\n292         cfg_file = '/etc/mdadm/mdadm.conf'\r\n293     else:\r\n294         cfg_file = '/etc/mdadm.conf'\r\n295 \r\n296     try:\r\n297         __salt__['file.append'](cfg_file, '{entry}'.format(entry=' '.join(scan)))"}}