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

AmazonLinux GitFS PyGit2 AttributeError: '_pygit2.Reference' object has no attribute 'get_object' #51270

Closed
mushroomwithegg opened this issue Jan 22, 2019 · 9 comments
Assignees
Labels
Bug broken, incorrect, or confusing behavior fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@mushroomwithegg
Copy link

Description of Issue/Question

I am using amazonlinux:2018.03 docker image and trying to setup salt-master with gitfs. I already installed all necessary libraries and no error found after restart salt-master service. But when I run salt-run fileserver.file_list I encountered this error:

Exception occurred in runner fileserver.file_list: Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/client/mixins.py", line 387, in _low
    data['return'] = self.functions[fun](*args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/runners/fileserver.py", line 193, in file_list
    return fileserver.file_list(load=load)
  File "/usr/lib/python2.7/dist-packages/salt/utils/decorators/__init__.py", line 594, in wrapped
    **salt.utils.data.decode_dict(kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/fileserver/__init__.py", line 752, in file_list
    ret.update(self.servers[fstr](load))
  File "/usr/lib/python2.7/dist-packages/salt/fileserver/gitfs.py", line 185, in file_list
    return _gitfs().file_list(load)
  File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 2934, in file_list
    return self._file_lists(load, 'files')
  File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 2911, in _file_lists
    repo_files, repo_symlinks = repo.file_list(load['saltenv'])
  File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 1777, in file_list
    tree = self.get_tree(tgt_env)
  File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 1016, in get_tree
    candidate = func(tgt_ref)
  File "/usr/lib/python2.7/dist-packages/salt/utils/gitfs.py", line 1852, in get_tree_from_branch
    'refs/remotes/origin/{0}'.format(ref)).get_object().tree
AttributeError: '_pygit2.Reference' object has no attribute 'get_object'

Setup

/etc/salt/master

interface: 0.0.0.0

ipv6: False

user: root

file_ignore_glob : ''

auto_accept: True

default_include: master.d/*.conf

file_roots:
  base:
    - /saltstack/salt/base

pillar_roots:
  base:
    - /saltstack/pillar/base

/etc/salt/master.d/gitfs.conf

fileserver_backend:
  - roots
  - git

gitfs_remotes:
  - https://github.com/saltstack-formulas/users-formula.git

Steps to Reproduce Issue

  1. Install required libraries and follow this instruction: https://www.pygit2.org/install.html
  2. Setup salt configuration same as above
  3. Run salt-run fileserver.file_list

Versions Report

Salt Version:
           Salt: 2018.3.3

Dependency Versions:
           cffi: 1.11.5
       cherrypy: 3.2.2
       dateutil: Not Installed
      docker-py: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: 0.27.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: 2.17
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: 0.27.4
         Python: 2.7.15 (default, Nov 28 2018, 22:38:08)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist:
         locale: ANSI_X3.4-1968
        machine: x86_64
        release: 4.15.0-43-generic
         system: Linux
        version: Not Installed
@mushroomwithegg mushroomwithegg changed the title AmazonLinux GitFS PyGit2 Error AmazonLinux GitFS PyGit2 AttributeError: '_pygit2.Reference' object has no attribute 'get_object' Jan 22, 2019
@Ch3LL
Copy link
Contributor

Ch3LL commented Jan 23, 2019

looks like in pygit version 0.27.4 (2019-01-19) they removed get_object. From the changelog:

https://github.com/libgit2/pygit2/blob/master/CHANGELOG.rst

Breaking changes:

Remove deprecated Reference.get_object(), use Reference.peel() instead

ping @terminalmage

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P3 Priority 3 labels Jan 23, 2019
@Ch3LL Ch3LL added this to the Approved milestone Jan 23, 2019
@terminalmage
Copy link
Contributor

Fixed in #51304

@terminalmage
Copy link
Contributor

@iwillflytothemoon Did you manually install all libraries? If so, using pygit2 0.27.3 instead of 0.27.4 will allow pygit2 to work in the meantime.

@mushroomwithegg
Copy link
Author

mushroomwithegg commented Jan 25, 2019

@terminalmage Yes, I manually installed all the libraries. I will try it now and will give an update later. Thanks.

@mushroomwithegg
Copy link
Author

Downgrading pygit2 version fixed the issue. I updated my formula and it worked.

linux_salt_master_gitfs_pip_packages:
  module.run:
    - name: pip.install
    - pkgs:
        - pygit2==0.27.3

thanks @terminalmage @Ch3LL

@terminalmage terminalmage self-assigned this Jan 25, 2019
@terminalmage terminalmage added the fixed-pls-verify fix is linked, bug author to confirm fix label Jan 25, 2019
@FinalProjectGit
Copy link

looks like in pygit version 0.27.4 (2019-01-19) they removed get_object. From the changelog:

https://github.com/libgit2/pygit2/blob/master/CHANGELOG.rst

Breaking changes:

Remove deprecated Reference.get_object(), use Reference.peel() instead

ping @terminalmage

Thanks a lottt!!

@stale
Copy link

stale bot commented Jan 8, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.

@stale stale bot added the stale label Jan 8, 2020
@terminalmage
Copy link
Contributor

The fix for this was merged almost a year ago. This issue should be closed immediately and not because of a bot.

@stale
Copy link

stale bot commented Jan 8, 2020

Thank you for updating this issue. It is no longer marked as stale.

@stale stale bot removed the stale label Jan 8, 2020
@Ch3LL Ch3LL closed this as completed Jan 21, 2020
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 fixed-pls-verify fix is linked, bug author to confirm fix P3 Priority 3 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