omniosorg / pkg5

Image Packaging System
https://omnios.org/
Other
12 stars 56 forks source link

Provide exclude-policy to control what happens when actions match image exclusions. #402

Closed citrus-it closed 2 years ago

citrus-it commented 2 years ago

This is a work in progress for #401.

In this state, a new warning is presented whenever some actions are elided from the plan due to exclusions configured on the image. A sparse zone is just one type of image which has exclusions, and the exclusion functionality of pkg is a generic one, so this is what I've come up with so far:

% pkg property
PROPERTY                       VALUE
exclude-patterns               ['usr/share/isc-dhcp']

% pfexec python3 =pkg install -nv isc-dhcp

******************************************************************************
WARNING: The following actions will not be installed as this is a partial
         image (there are configured exclusions).

        /usr/share/isc-dhcp
        /usr/share/isc-dhcp/examples
        /usr/share/isc-dhcp/examples/dhcpd.conf.example
******************************************************************************

           Packages to install:        1
            Services to change:        7
     Estimated space available: 69.51 GB
Estimated space to be consumed: 36.67 MB
...

The original bug reporter suggested that this could also be an error, with a flag to override.

Comments and suggestions welcome.

jclulow commented 2 years ago

In my experience pkg output is already a large wall of text that people don't really read that closely. I have known folks to even miss the text right at the bottom about boot environments and needing to reboot, etc. If possible it would be good if this could be a hard error by default in the situations where it is unintentional.

A sparse zone is just one type of image which has exclusions, and the exclusion functionality of pkg is a generic one

This is certainly a wrinkle, and I agree there are contexts other than sparse zones where people might legitimately use exclusions for other purposes and we should not break that.

What about a new image property that is off by default, and which would enable strictness of this variety as a hard error? During the creation of the image in sparse zone installation, the property could be enabled. Users could disable it themselves later if they wish, and it would not impact other users of exclusions?

citrus-it commented 2 years ago

What about a new image property that is off by default, and which would enable strictness of this variety as a hard error? During the creation of the image in sparse zone installation, the property could be enabled. Users could disable it themselves later if they wish, and it would not impact other users of exclusions?

I like that idea. I've updated this change to add a new image property as per this updated man page extract (exclude-patterns shown for context)

image
jclulow commented 2 years ago

Neat! I like the new image property.

Toasterson commented 2 years ago

I like it too. makes packaging easier. And you can skim down images with policies after packaging