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

file.serialize merge_if_exists fails: 'function' object has no attribute 'deserialize' #34329

Closed
clinta opened this issue Jun 28, 2016 · 1 comment
Labels
Bug broken, incorrect, or confusing behavior Core relates to code central or existential to Salt P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Milestone

Comments

@clinta
Copy link
Contributor

clinta commented Jun 28, 2016

Description of Issue/Question

Setup

test.sls

/test.yaml:
  file.serialize:
    - dataset:
        test: 1
    - merge_if_exists: true

Steps to Reproduce Issue

Run the above state twice. Succeeds the first time, the second time it gives this error:

[PROFILE ] Time (in seconds) to render 'test.sls' using 'jinja' renderer: 0.00346684455872
[DEBUG   ] Rendered data from file: test.sls:
/test.yaml:
  file.serialize:
    - dataset:
        test: 1
    - merge_if_exists: true

[DEBUG   ] LazyLoaded config.get
[DEBUG   ] Results of YAML rendering: 
OrderedDict([('/test.yaml', OrderedDict([('file.serialize', [OrderedDict([('dataset', OrderedDict([('test', 1)]))]), OrderedDict([('merge_if_exists', True)])])]))])
[PROFILE ] Time (in seconds) to render 'test.sls' using 'yaml' renderer: 0.00530600547791
[DEBUG   ] LazyLoaded file.serialize
[INFO    ] Running state [/test.yaml] at time 08:43:31.375152
[INFO    ] Executing state file.serialize for /test.yaml
[DEBUG   ] LazyLoaded yaml.serialize
[ERROR   ] An exception occurred in this state: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1723, in call
    **cdata['kwargs'])
  File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 1650, in wrapper
    return f(*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/states/file.py", line 4596, in serialize
    existing_data = serializer.deserialize(fhr)
AttributeError: 'function' object has no attribute 'deserialize'

Versions Report

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: 2.4.2
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.8
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: 0.21.1
           Mako: 1.0.3
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.11+ (default, Apr 17 2016, 14:00:29)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 15.2.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.1.4

System Versions:
           dist: Ubuntu 16.04 xenial
        machine: x86_64
        release: 4.4.0-24-generic
         system: Linux
        version: Ubuntu 16.04 xenial
clinta added a commit to clinta/salt that referenced this issue Jun 28, 2016
@clinta clinta mentioned this issue Jun 28, 2016
rallytime pushed a commit that referenced this issue Jun 28, 2016
@rallytime rallytime added State-Module Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around Core relates to code central or existential to Salt P3 Priority 3 labels Jun 28, 2016
@rallytime rallytime added this to the Approved milestone Jun 28, 2016
@rallytime
Copy link
Contributor

@clinta Thank you for filing this report and thanks for fixing it! Love it when that happens. :)

I just merged your fix, so I'll go ahead and close this.

gitebra pushed a commit to gitebra/salt that referenced this issue Jun 29, 2016
* upstream/develop: (44 commits)
  Send traps to Zabbix when there is a comment and name in result.
  Fix invalid syntax error in system.py module exception handling
  Don't forget the pylint disables for range
  Back-port saltstack#34256 to 2016.3 (saltstack#34343)
  Pylint fixes
  Revert py3modernize lint changes (saltstack#34339)
  Add listen/listen_in support to stateconf.py
  Change merge-if-exists logic to properly report changes
  Doc clarifications to file modules, addition of new `profile` log level to docs, fixed example in dnsmasq (saltstack#34323)
  version checking had a logical error (saltstack#34333)
  fix saltstack#34329 (saltstack#34330)
  Remove unnecessarily-disabled sanity check (saltstack#34325)
  Do not force 'filter' table when flushing
  add osmajorrelease to ubuntu and fix pylint
  Fix psutil.cpu_times unpack error (saltstack#34318)
  Typo in dockerio doc (saltstack#34319)
  add osmajorrelease grain for raspbian
  [2016.3] Update to latest bootstrap script v2016.06.27
  [2015.8] Update to latest bootstrap script v2016.06.27
  [2015.5] Update to latest bootstrap script v2016.06.27
  ...
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 Core relates to code central or existential to Salt P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around State-Module
Projects
None yet
Development

No branches or pull requests

2 participants