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 options parameter processing in postgres_tablespace.present #36464

Merged
merged 1 commit into from
Sep 22, 2016
Merged

Fix options parameter processing in postgres_tablespace.present #36464

merged 1 commit into from
Sep 22, 2016

Conversation

vutny
Copy link
Contributor

@vutny vutny commented Sep 21, 2016

What does this PR do?

It makes the options parameter of the postgres_tablespace.present work and report changes if any option was changed. Updated the docsting with meaningful example.

Previous Behavior

The postgres_tablespace.present fails with correctly provided options dictionary.

For example, following state

my_space:
  postgres_tablespace.present:
    - directory: /srv/my_tablespace
    - options:
        seq_page_cost: 1.0
        random_page_cost: 4.0

gives something like this:

[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/state.py", line 1733, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1652, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/states/postgres_tablespace.py", line 124, in present
    for k, v in options:
ValueError: too many values to unpack

And after fixing that issue it leads to this:

[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/salt/state.py", line 1733, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/site-packages/salt/loader.py", line 1652, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/salt/states/postgres_tablespace.py", line 142, in present
    set_options={k: v}):
TypeError: tablespace_alter() got an unexpected keyword argument 'set_options'

New Behavior

The postgres_tablespace.present state works with options parameter and reports changes.

----------
          ID: my_space
    Function: postgres_tablespace.present
        Name: my_space
      Result: True
     Comment: Tablespace my_space opts changed
     Started: 11:00:02.593824
    Duration: 1389.75 ms
     Changes:   
              ----------
              my_space:
                  ----------
                  options:
                      ----------
                      random_page_cost:
                          4.0
                      seq_page_cost:
                          1.0

Tests written?

No

@cachedout cachedout merged commit b021ea5 into saltstack:2015.8 Sep 22, 2016
@vutny vutny deleted the postgres-tablespace-options branch September 22, 2016 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants