# Run "knife acl" using Python or Java

**URL:** <https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673>\
**Category:** Chef Infra (archive)\
**Created:** [June 17, 2015, 1:21pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673 "2015-06-17T13:21:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tiago\_Cruz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tiago_cruz/32/49_2.png) [@Tiago\_Cruz](https://discourse.chef.io/u/Tiago_Cruz)\
**Post date:** [June 17, 2015, 1:21pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673/1 "2015-06-17T13:21:51Z")

</div>

Ohai!

I need to run some “knife acl …” commands, using Python or Java to fix  
one small bug that I have when I create machines using one internal app.  
This application used to work good on Chef 11, but now on Chef 12 the node  
is created without permission, so I need to set the acl after create the  
node.

Well, I’m looking here:

- [https://pychef.readthedocs.org/en/latest/](https://pychef.readthedocs.org/en/latest/)
- [http://jclouds.apache.org/guides/chef/](http://jclouds.apache.org/guides/chef/)

But I can’t find the “knife acl add …” parameters. I’m not a developer,  
and I have no experience using this tools, so there is a big chance that  
I’m not looking correctly and/or misunderstood something.

So, can you help me please?

Thanks!

–  
– Tiago Cruz

---

<div class="post-metadata">

**Author:** ![jdunn](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/jdunn/32/1800_2.png) [@jdunn](https://discourse.chef.io/u/jdunn)\
**Post date:** [June 17, 2015, 3:53pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673/2 "2015-06-17T15:53:05Z")

</div>

On Wed, Jun 17, 2015 at 9:21 AM, Tiago Cruz [tiago.tuxkiller@gmail.com](mailto:tiago.tuxkiller@gmail.com) wrote:

> I need to run some "knife acl ...." commands, using Python or Java to fix  
> one small bug that I have when I create machines using one internal app.  
> This application used to work good on Chef 11, but now on Chef 12 the node  
> is created without permission, so I need to set the acl after create the  
> node.
> 
> Well, I'm looking here:
> 
> - [PyChef — PyChef 0.3.0 documentation](https://pychef.readthedocs.org/en/latest/)
> - [Apache jclouds® :: Chef: Getting Started Guide](http://jclouds.apache.org/guides/chef/)
> 
> But I can't find the "knife acl add ..." parameters. I'm not a developer,  
> and I have no experience using this tools, so there is a big chance that I'm  
> not looking correctly and/or misunderstood something.

Does the README here help at all?

> **[GitHub - chef-boneyard/knife-acl: knife plugin for working with ACLs on Chef...](https://github.com/chef-boneyard/knife-acl)**
>
> knife plugin for working with ACLs on Chef Server. Contribute to chef-boneyard/knife-acl development by creating an account on GitHub.

- Julian

--  
[Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) \* Sorry, I'm ]  
[WWW: [Julian Dunn's Blog - Commentary on media, technology, and everything in between.](http://www.aquezada.com/staff/julian) \* only Web 1.0 ]  
[gopher://sdf.org/1/users/keymaker/ \* compliant!]  
[PGP: 91B3 7A9D 683C 7C16 715F 442C 6065 D533 FDC2 05B9]

---

<div class="post-metadata">

**Author:** ![Tiago\_Cruz](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/tiago_cruz/32/49_2.png) [@Tiago\_Cruz](https://discourse.chef.io/u/Tiago_Cruz)\
**Post date:** [June 17, 2015, 4:46pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673/3 "2015-06-17T16:46:01Z")

</div>

Hello Julian,

Yes, this README helps a lot to execute calls using command line.

But I would like to avoid system calls using Java/ Python... so I'm looking  
for a way to do this directly using the framework provided, if this is  
possible.

Thanks!

On Wed, Jun 17, 2015 at 12:53 PM, Julian C. Dunn [jdunn@aquezada.com](mailto:jdunn@aquezada.com) wrote:

> Does the README here help at all?
> 
> [GitHub - chef-boneyard/knife-acl: knife plugin for working with ACLs on Chef Server](https://github.com/chef/knife-acl)
> 
> - Julian

---

<div class="post-metadata">

**Author:** ![kallistec](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/kallistec/32/23_2.png) [@kallistec](https://discourse.chef.io/u/kallistec)\
**Post date:** [June 18, 2015, 4:51pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673/4 "2015-06-18T16:51:25Z")

</div>

Knife ACL is ruby code so you have to either run it from Ruby or shell out to it.

Noah maintains a Python library for interacting with the Chef Server HTTP API: [GitHub - coderanger/pychef: Python library to interact with the Chef server API](https://github.com/coderanger/pychef)

If you go the second route, you pretty much will end up rewriting knife-acl. Be forewarned that the authorization system has a fair number of edge cases, so you should probably make note of any comments and special cases in knife-acl.

--  
Daniel DeLeo

On Wednesday, June 17, 2015 at 9:46 AM, Tiago Cruz wrote:

> Hello Julian,
> 
> Yes, this README helps a lot to execute calls using command line.
> 
> But I would like to avoid system calls using Java/ Python... so I'm looking for a way to do this directly using the framework provided, if this is possible.
> 
> Thanks!
> 
> On Wed, Jun 17, 2015 at 12:53 PM, Julian C. Dunn \<[jdunn@aquezada.com](mailto:jdunn@aquezada.com) ([mailto:jdunn@aquezada.com](mailto:jdunn@aquezada.com))\> wrote:
> 
> > Does the README here help at all?
> > 
> > [GitHub - chef-boneyard/knife-acl: knife plugin for working with ACLs on Chef Server](https://github.com/chef/knife-acl)
> > 
> > - Julian

---

<div class="post-metadata">

**Author:** ![coderanger](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/coderanger/32/5_2.png) [@coderanger](https://discourse.chef.io/u/coderanger)\
**Post date:** [June 18, 2015, 4:57pm UTC](https://discourse.chef.io/t/run-knife-acl-using-python-or-java/6673/5 "2015-06-18T16:57:08Z")

</div>

Both PyChef and Jclouds do offer APIs to make raw HTTP requests to the Chef server which you could use, but the ACLs API is tricky as Dan mentioned so probably going to be an uphill battle if you aren't okay with diving in to the knife-acl source code.

--Noah

On Jun 18, 2015, at 9:51 AM, Daniel DeLeo [dan@kallistec.com](mailto:dan@kallistec.com) wrote:

> Knife ACL is ruby code so you have to either run it from Ruby or shell out to it.
> 
> Noah maintains a Python library for interacting with the Chef Server HTTP API: [GitHub - coderanger/pychef: Python library to interact with the Chef server API](https://github.com/coderanger/pychef)
> 
> If you go the second route, you pretty much will end up rewriting knife-acl. Be forewarned that the authorization system has a fair number of edge cases, so you should probably make note of any comments and special cases in knife-acl.
> 
> --  
> Daniel DeLeo
> 
> On Wednesday, June 17, 2015 at 9:46 AM, Tiago Cruz wrote:
> 
> > Hello Julian,
> > 
> > Yes, this README helps a lot to execute calls using command line.
> > 
> > But I would like to avoid system calls using Java/ Python... so I'm looking for a way to do this directly using the framework provided, if this is possible.
> > 
> > Thanks!
> > 
> > On Wed, Jun 17, 2015 at 12:53 PM, Julian C. Dunn \<[jdunn@aquezada.com](mailto:jdunn@aquezada.com) ([mailto:jdunn@aquezada.com](mailto:jdunn@aquezada.com))\> wrote:
> > 
> > > Does the README here help at all?
> > > 
> > > [GitHub - chef-boneyard/knife-acl: knife plugin for working with ACLs on Chef Server](https://github.com/chef/knife-acl)
> > > 
> > > - Julian
