Giter VIP home page Giter VIP logo

Comments (11)

nanliu avatar nanliu commented on September 22, 2024

Not sure the best way to implement this. Originally was going to add this in the provider code but it felt like feature creep since it overlaps with the file resource. For now, the owner/group management can be specified in a define resource similar to https://github.com/nanliu/puppet-archive/blob/master/manifests/go.pp.

Writing a generic define resource wrapper is pretty straightforward, I'm not sure what's a good name (archive::file ???).

from puppet-archive.

petehayes avatar petehayes commented on September 22, 2024

The owner/group management in go.pp and artifactory.pp sets the owner and group of the archive file but I was more interested in the extracted files themselves. In nanliu-staging, you executed the tar command as the specified user - would that work as well here? The archive resource could take a user / group and pass that to the the Puppet::Util::Execution call?

Tar files also support the -o option for extraction which would ignore the owner specified within the tar file and use the process owner executing the tar command. That could help as well.

from puppet-archive.

nanliu avatar nanliu commented on September 22, 2024

You can pass custom flags to via extraction_flags. I'll take a look and see what it takes to specify user/group option to the extraction command.

from puppet-archive.

mkrakowitzer avatar mkrakowitzer commented on September 22, 2024

I don't believe for tar that you can specify a user or a group. The only way is to run the tar command as the user you would prefer. puppet-staging does this by running an exec as the user/group.

I would very much like this feature.

from puppet-archive.

elyscape avatar elyscape commented on September 22, 2024

GNU tar supports --owner and --group flags.

from puppet-archive.

elyscape avatar elyscape commented on September 22, 2024

It looks like BSD tar does not, though, so the best option is probably to run the tar command as the desired user/group.

from puppet-archive.

mkrakowitzer avatar mkrakowitzer commented on September 22, 2024

yeah i am pretty sure --owner and --group does not work as you would expect it too.

from puppet-archive.

mkrakowitzer avatar mkrakowitzer commented on September 22, 2024
 --group=NAME
           force NAME as group for added files

  --owner=NAME
           force NAME as owner for added files

Having had some experience with this, its only when adding files to an archive and not extracting the files.

from puppet-archive.

elyscape avatar elyscape commented on September 22, 2024

Ah, whoops. Well, either way, it makes more sense to just run the command as the desired user/group, as that'll work on all platforms and is a pretty simple change to make.

from puppet-archive.

nanliu avatar nanliu commented on September 22, 2024

The changes require puppet::util::execution to pass in the option uid, gid:
https://github.com/nanliu/puppet-archive/blob/master/lib/puppet_x/bodeco/archive.rb#L41

The changes will be fairly similar to the following:
https://github.com/boxen/puppet-vagrant/blob/master/lib/puppet/provider/vagrant.rb#L19-L30

I'll try to tackle this as time permits, in the mean time if someone needs it sooner, hopefully this provides enough pointers.

from puppet-archive.

nanliu avatar nanliu commented on September 22, 2024

I've added support for this. Please test and provide feedback.

from puppet-archive.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.