Code Monkey home page Code Monkey logo

Comments (11)

raphink avatar raphink commented on July 17, 2024

I can confirm this bug, as the code reads:

  $_cache = $cache ? {                                                          
    true    => 'yes',                                                           
    false   => 'no',                                                            
  }                                                                             
                                                                                
  if $cache {                                                                   
    ini_setting{ 'cache':                                                       
      ensure  => 'present',                                                     
      value   => $_cache,                                                       
      setting => 'Cache',                                                       
      section => 'Resolve',                                                     
      path    => '/etc/systemd/resolved.conf',                                  
      notify  => Service['systemd-resolved'],                                   
    }                                                                           
  }   

so $_cache gets set to the right value, but never applied.

from puppet-systemd.

Schamane187 avatar Schamane187 commented on July 17, 2024

Hi,

just ran into an issue as well, I want to use the parameter no-negative in section cache.
I had to change manifest to enable caching with
"no-negative"

so in
resolved.pp

Boolean $cache = $systemd::cache,
has been changed to
Optional[Variant[Array[String],String]] $cache = $systemd::cache,

and in section

$_cache = $cache ? {
   true          => 'yes',
   false         => 'no',
   'no-negative' => 'no-negative',
 }

no-negative was added

Could u update or built in using the Feature no-negative in a future release?
Thx in advance

from puppet-systemd.

bastelfreak avatar bastelfreak commented on July 17, 2024

@Schamane187 can you provide a patch for this?

from puppet-systemd.

Schamane187 avatar Schamane187 commented on July 17, 2024

Hi,

was moving away for the moment from systemd for that task, cause CentOS 7 Systemd is to outdated for those features. But with CentOS 8 I will be back to this.

A Patch for 2 lines? but ok, here we go

diff -upr puppet-systemd-master_org/manifests/resolved.pp puppet-systemd-master/manifests/resolved.pp
--- puppet-systemd-master_org/manifests/resolved.pp	2019-07-15 11:48:00.000000000 +0200
+++ puppet-systemd-master/manifests/resolved.pp	2019-09-23 09:55:40.000000000 +0200
@@ -53,8 +53,8 @@ class systemd::resolved (
   Optional[Variant[Boolean,Enum['resolve']]] $multicast_dns          = $systemd::multicast_dns,
   Optional[Variant[Boolean,Enum['allow-downgrade']]] $dnssec         = $systemd::dnssec,
   Optional[Variant[Boolean,Enum['opportunistic', 'no']]] $dnsovertls = $systemd::dnsovertls,
-  Boolean $cache                                                     = $systemd::cache,
   Optional[Variant[Boolean,Enum['udp', 'tcp']]] $dns_stub_listener   = $systemd::dns_stub_listener,
+  Optional[Variant[Array[String],String]] $cache 		     = $systemd::cache,
   Boolean $use_stub_resolver                                         = $systemd::use_stub_resolver,
 ){

@@ -200,6 +200,7 @@ class systemd::resolved (
   $_cache = $cache ? {
     true    => 'yes',
     false   => 'no',
+   'no-negative' => 'no-negative',
   }

   if $cache {

Cheers

from puppet-systemd.

schlitzered avatar schlitzered commented on July 17, 2024

this pull request solves the issue:

#140

from puppet-systemd.

bastelfreak avatar bastelfreak commented on July 17, 2024

PR got merged

from puppet-systemd.

robertvargason avatar robertvargason commented on July 17, 2024

This issue should not be closed as the original issue is still not resolved. One cannot set Cache=no

from puppet-systemd.

schlitzered avatar schlitzered commented on July 17, 2024

@robertvargason: you are right. there was an "if $cache" block, which prevent setting this to false.

i created a new merge request for this.

from puppet-systemd.

robertvargason avatar robertvargason commented on July 17, 2024

@schlitzered: thanks for that. the commited version is working for us.

if you want to be very clever with your implementation you might want to consider one of the two extra solutions:

a) to introduce a setting which leaves the setting Cache unrendered. So that Cache=yes, Cache=no, Cache=no-negative as well as no Cache setting at all (should be the module default) is possible. which leaves the option to not render the value and let the default value for Cache from systemd rule supreme (which is at the moment 'yes'). meaning also that the new puppet module version does not touch the /etc/systemd/resolved.conf (which is nice in my opinion).

b) use 'yes' as the option to not render the setting at all, because it is the systemd default. Meaning only 'no' or 'no-negative' is rendered. There is no benefit to explicit set Cache=yes, because it is the systemd default. This would (if you make 'yes' the module default value) also leave resolved.conf files untouched (except when module users already used to set 'yes' [which was unnecessary]).

thanks a lot

from puppet-systemd.

schlitzered avatar schlitzered commented on July 17, 2024

i leave this up to the original maintainer to decide.

but IMHO, I would set the default in the puppet module, to whatever the default is for the $OS_NAME and $OS_MAJOR. and always put this config into the on the system.

from puppet-systemd.

raphink avatar raphink commented on July 17, 2024

FIxed in #140

from puppet-systemd.

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.