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

ini_manage.options_absent: only works in test mode (TypeError: unhashable type: 'list') #33590

Closed
morganwillcock opened this issue May 27, 2016 · 5 comments
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@morganwillcock
Copy link
Contributor

cleanup_usbdlm_configuration:
  ini.options_absent:
    - name: {{ program_files }}\USBDLM\USBDLM.ini
    - sections:
        DriveLetters:
          - Letters

Everything still looks okay when testing state:
salt salt-test state.apply test=True

----------
          ID: cleanup_usbdlm_configuration
    Function: ini.options_absent
        Name: C:\Program Files\USBDLM\USBDLM.ini
      Result: True
     Comment: Key Letters in section DriveLetters does not exist.
     Started: 17:21:01.656000
    Duration: 0.0 ms
     Changes:   
----------

...but actually applying it no longer works:
salt salt-test state.apply

----------
          ID: cleanup_usbdlm_configuration
    Function: ini.options_absent
        Name: C:\Program Files\USBDLM\USBDLM.ini
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "C:\salt\bin\lib\site-packages\salt\state.py", line 1703, in call
                  **cdata['kwargs'])
                File "C:\salt\bin\lib\site-packages\salt\loader.py", line 1649, in wrapper
                  return f(*args, **kwargs)
                File "C:\salt\bin\lib\site-packages\salt\states\ini_manage.py", line 113, in options_absent
                  current_value = __salt__['ini.remove_option'](name, section, key)
                File "C:\salt\bin\lib\site-packages\salt\modules\ini_manage.py", line 124, in remove_option
                  value = inifile.get(section, {}).pop(option, None)
                File "C:\salt\bin\lib\collections.py", line 143, in pop
                  if key in self:
              TypeError: unhashable type: 'list'
     Started: 17:22:59.435000
    Duration: 16.0 ms
     Changes:   
----------

This was working fine on 2015.8.8-2 and 2015.8.10, but seems to be broken after upgrade to 2016.3.0

@Ch3LL
Copy link
Contributor

Ch3LL commented May 27, 2016

@morganwillcock i'm also seeing the same thing on centos7:

local:
----------
          ID: /tmp/test.ini
    Function: ini.options_absent
      Result: False
     Comment: An exception occurred in this state: Traceback (most recent call last):
                File "/home/ch3ll/git/salt/salt/state.py", line 1703, in call
                  **cdata['kwargs'])
                File "/home/ch3ll/git/salt/salt/loader.py", line 1649, in wrapper
                  return f(*args, **kwargs)
                File "/home/ch3ll/git/salt/salt/states/ini_manage.py", line 113, in options_absent
                  current_value = __salt__['ini.remove_option'](name, section, key)
                File "/home/ch3ll/git/salt/salt/modules/ini_manage.py", line 125, in remove_option
                  inifile = _Ini.get_ini_file(file_name)
                File "/usr/lib64/python2.7/collections.py", line 138, in pop
                  if key in self:
              TypeError: unhashable type: 'list'
     Started: 17:08:07.909619
    Duration: 10673.034 ms
     Changes:   

Summary for local
------------
Succeeded: 0
Failed:    1
------------
Total states run:     1

test=True:

local:
----------
          ID: /tmp/test.ini
    Function: ini.options_absent
      Result: True
     Comment: Key OrderedDict([('ConfirmFileOp', 0)]) in section .ShellClassInfo does not exist.
     Started: 17:08:34.215833
    Duration: 1.794 ms
     Changes:   

Summary for local
------------
Succeeded: 1
Failed:    0
------------
Total states run:     1

Looks like this needs to get fixed. Thanks

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Execution-Module labels May 27, 2016
@Ch3LL Ch3LL added this to the Approved milestone May 27, 2016
@Ch3LL Ch3LL added the Platform Relates to OS, containers, platform-based utilities like FS, system based apps label May 27, 2016
@danslimmon
Copy link
Contributor

danslimmon commented May 29, 2016

This was broken in 7ac43c7. Working on a fix.

danslimmon added a commit to danslimmon/salt that referenced this issue May 29, 2016
cachedout pushed a commit that referenced this issue May 31, 2016
@rallytime
Copy link
Contributor

@morganwillcock This should be fixed by #33606. Do you have a moment to give that a try and confirm this is fixed?

@rallytime rallytime added the fixed-pls-verify fix is linked, bug author to confirm fix label Jun 2, 2016
@morganwillcock
Copy link
Contributor Author

@rallytime That fixes it for me, thank you.

----------
          ID: cleanup_usbdlm_configuration
    Function: ini.options_absent
        Name: C:\Program Files\USBDLM\USBDLM.ini
      Result: True
     Comment: No anomaly detected
     Started: 17:28:47.266000
    Duration: 11.0 ms
     Changes:
----------

@rallytime
Copy link
Contributor

@morganwillcock Great! Thanks for confirming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Execution-Module fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 Platform Relates to OS, containers, platform-based utilities like FS, system based apps severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

4 participants