Giter Site home page Giter Site logo

Comments (6)

BackSlasher avatar BackSlasher commented on August 18, 2024

The first part I agree with - I merged this when I wasn't that familiar with Ruby, and I will seperate to a different module.
I don't think I should leave the mixins to the cookbook users - I'll play around with using extend at the instance level, like this:

action :add do
  escaped_file_spec = Regexp.escape(new_resource.file_spec)
  execute "selinux-fcontext-#{new_resource.secontext}-add" do
    extend SELinuxPolicy::Helpers
    command lazy { "/usr/sbin/semanage fcontext -a -t #{new_resource.secontext} '#{new_resource.file_spec}' && #{restorecon(new_resource.file_spec)}" }
    not_if "/usr/sbin/semanage fcontext -l | grep -P '#{escaped_file_spec}\s.*\ssystem_u:object_r:#{new_resource.secontext}:s0'>/dev/null"
    only_if {use_selinux}
  end
end

from selinux_policy.

chewi avatar chewi commented on August 18, 2024

That doesn't help the situation with the install recipe though. Calling include in your recipe isn't an unusual thing to do but I did get it slightly wrong above.

::Chef::Recipe.send(:include, SELinuxPolicy::Helpers)
include_recipe 'selinux_policy::install' if use_selinux

Not quite as nice but you can see this technique referenced here. Using extend instead does work though as explained here.

extend SELinuxPolicy::Helpers
include_recipe 'selinux_policy::install' if use_selinux

from selinux_policy.

BackSlasher avatar BackSlasher commented on August 18, 2024

I thought you were talking about how I'm using it in my own recipe. I now think you're referring to how you're utilizing it in your own recipes.
Are you suggesting creating a recipe that does the mixin, so consumers can easily mixin for their own use, and avoid the mixin automatically (in case it breaks something elsewhere)?

from selinux_policy.

chewi avatar chewi commented on August 18, 2024

I was referring to how you are using it in your providers but also how it could be used in recipes for other cookbooks. I'll submit a pull request later to ensure we're on the same page.

from selinux_policy.

BackSlasher avatar BackSlasher commented on August 18, 2024

Great :)
I'm onboard for making the cookbook cleaner. Not sure about the mixin
recipe though.
On May 15, 2015 6:36 PM, "James Le Cuirot" [email protected] wrote:

I was referring to how you are using it in your providers but also how
it could be used in recipes for other cookbooks. I'll submit a pull request
later to ensure we're on the same page.


Reply to this email directly or view it on GitHub
#22 (comment)
.

from selinux_policy.

lock avatar lock commented on August 18, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

from selinux_policy.

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.