This file is indexed.

/usr/lib/python2.7/dist-packages/chef/client.py is in python-chef 0.2.3-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from chef.api import ChefAPI
from chef.base import ChefObject

class Client(ChefObject):
    """A Chef client object."""

    url = '/clients'

    def _populate(self, data):
        self.platform = self.api and self.api.platform
        self.private_key = None
        if self.platform:
            self.orgname = data.get('orgname')
            self.validator = bool(data.get('validator', False))
            self.public_key = data.get('certificate')
            self.admin = False
        else:
            self.admin = bool(data.get('admin', False))
            self.public_key = data.get('public_key')
            self.orgname = None
            self.validator = False

    @property
    def certificate(self):
        return self.public_key

    def to_dict(self):
        d = super(Client, self).to_dict()
        d['json_class'] = 'Chef::ApiClient'
        if self.platform:
            d.update({
                'orgname': self.orgname,
                'validator': self.validator,
                'certificate': self.certificate,
                'clientname': self.name,
            })
        else:
            d.update({
                'admin': self.admin,
                'public_key': self.public_key,
            })
        return d

    @classmethod
    def create(cls, name, api=None, admin=False):
        api = api or ChefAPI.get_global()
        obj = cls(name, api, skip_load=True)
        obj.admin = admin
        d = api.api_request('POST', cls.url, data=obj)
        obj.private_key = d['private_key']
        return obj

    def rekey(self, api=None):
        api = api or self.api
        d_in = {'name': self.name, 'private_key': True}
        d_out = api.api_request('PUT', self.url, data=d_in)
        self.private_key = d_out['private_key']