AngeloMileto
07/08/2022, 3:42 PMArgon Wade
07/08/2022, 3:50 PMSlackbot
07/08/2022, 4:04 PMLumiere
07/08/2022, 4:04 PMHugh Esco
07/08/2022, 5:30 PMuser::function::add_system_user
defined type which depends on an ensure_resource ( user, ... )
. It sets the gid to the $uid. Recent upgrades have created a conflict for the uid I set for my mysql user. As a work-around I have added to my hiera data a new key, user::application::mysql::fix_uid
, with a boolean value. I had hoped that passing an undef to the uid =>
attribute of the user
resource would communicate to puppet that I want the underlying OS to sort out the uid for this user. Although this behavior is not documented, I hoped it would be worth a try. But now I am getting Parameter gid failed on Group[mysql]: Invalid GID
.
Any thoughts on how I might resolve this?Hugh Esco
07/08/2022, 5:32 PMuser::function::add_system_user
defined type which depends on an ensure_resource ( user, ... )
. It sets the gid to the $uid. Recent upgrades have created a conflict for the uid I set for my mysql user. As a work-around I have added to my hiera data a new key, user::application::mysql::fix_uid
, with a boolean value. I had hoped that passing an undef to the uid =>
attribute of the user
resource would communicate to puppet that I want the underlying OS to sort out the uid for this user. But now I am getting Parameter gid failed on Group[mysql]: Invalid GID
.
Any thoughts on how I might resolve this?Hugh Esco
07/08/2022, 5:34 PMuser::function::add_system_user
defined type which depends on an ensure_resource ( user, ... )
. It sets the gid to the $uid. Recent upgrades have created a conflict for the uid I set for my mysql user. As a work-around I have added to my hiera data a new key, user::application::mysql::fix_uid
, with a boolean value. I had hoped that passing an undef to the uid =>
attribute of the user
resource would communicate to puppet that I want the underlying OS to sort out the uid for this user (although this behavior is not documented, but I thought it would be worth a try). But now I am getting Parameter gid failed on Group[mysql]: Invalid GID
.
Any thoughts on how I might resolve this?Hugh Esco
07/08/2022, 5:34 PMuser::function::add_system_user
defined type which depends on an ensure_resource ( user, ... )
. It sets the gid to the $uid. Recent upgrades have created a conflict for the uid I set for my mysql user. As a work-around I have added to my hiera data a new key, user::application::mysql::fix_uid
, with a boolean value. I had hoped that passing an undef to the uid =>
attribute of the user
resource would communicate to puppet that I want the underlying OS to sort out the uid for this user. Although this behavior is not documented, I hoped it would be worth a try. But now I am getting Parameter gid failed on Group[mysql]: Invalid GID
.
Any thoughts on how I might resolve this?Slackbot
07/08/2022, 5:36 PMHugh Esco
07/08/2022, 5:40 PMlookup
. And yes, it uses an explicit call to that lookup
function.Slackbot
07/08/2022, 6:55 PMLumiere
07/08/2022, 7:08 PMSlackbot
07/10/2022, 8:24 PMYehuda Katz
07/10/2022, 8:24 PMdefine fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
case $provider {
'iptables': {
if ($ipv4) {
$networks_v4.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} (${ruleset}-${_order}) ${comment} from ${src['name']}":
source => $src['network'],
* => $rule,
}
}
}
if ($ipv6) {
$networks_v6.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} IPv6 (${ruleset}-${_order}) ${comment} from ${src['name']}":
provider => 'ip6tables',
source => $src['network'],
* => $rule,
}
}
}
}
'firewalld': {
...
}
'firewall_cmd': {
...
}
'csf': {
...
}
default: {
fail("Unsupported fw provider '${provider}'")
}
}
}
To keep this file maintainable, I would love to do something like this:
define fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
include "fw::${provider}::rules"
}
Is there a way to have the included class automatically have access to all the current variables?Yehuda Katz
07/10/2022, 8:41 PMdefine fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
case $provider {
'iptables': {
if ($ipv4) {
$networks_v4.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} (${ruleset}-${_order}) ${comment} from ${src['name']}":
source => $src['network'],
* => $rule,
}
}
}
if ($ipv6) {
$networks_v6.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} IPv6 (${ruleset}-${_order}) ${comment} from ${src['name']}":
provider => 'ip6tables',
source => $src['network'],
* => $rule,
}
}
}
}
'firewalld': {
...
}
'firewall_cmd': {
...
}
'csf': {
...
}
default: {
fail("Unsupported fw provider '${provider}'")
}
}
}
To keep this file maintainable, I would love to do something like this:
define fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
include "fw::${provider}::rules"
}
Is there a way to have the included class automatically have access to all the current variables? I tried this exact code and it didn't seem to actually do anything.Yehuda Katz
07/10/2022, 8:49 PMdefine fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
case $provider {
'iptables': {
if ($ipv4) {
$networks_v4.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} (${ruleset}-${_order}) ${comment} from ${src['name']}":
source => $src['network'],
* => $rule,
}
}
}
if ($ipv6) {
$networks_v6.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} IPv6 (${ruleset}-${_order}) ${comment} from ${src['name']}":
provider => 'ip6tables',
source => $src['network'],
* => $rule,
}
}
}
}
'firewalld': {
...
}
'firewall_cmd': {
...
}
'csf': {
...
}
default: {
fail("Unsupported fw provider '${provider}'")
}
}
}
To keep this file maintainable, I would love to do something like this:
define fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
include "fw::${provider}::rules"
}
Is there a way to have the included class automatically have access to all the current variables? I tried this exact code and it didn't seem to actually do anything.
The example in the documentation (https://puppet.com/docs/puppet/7/lang_scope.html#lang_scope-local-scopes) makes it seem like it should work, but adding debug statements shows the variables are undefined.Yehuda Katz
07/10/2022, 9:10 PMdefine fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
case $provider {
'iptables': {
if ($ipv4) {
$networks_v4.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} (${ruleset}-${_order}) ${comment} from ${src['name']}":
source => $src['network'],
* => $rule,
}
}
}
if ($ipv6) {
$networks_v6.each |Integer $index, Hash[String, Optional[String]] $src| {
$_order = String.new($index, '%02d')
firewall{"${_priority} IPv6 (${ruleset}-${_order}) ${comment} from ${src['name']}":
provider => 'ip6tables',
source => $src['network'],
* => $rule,
}
}
}
}
'firewalld': {
...
}
'firewall_cmd': {
...
}
'csf': {
...
}
default: {
fail("Unsupported fw provider '${provider}'")
}
}
}
To keep this file maintainable, I would love to do something like this:
define fw::rules (
String $ruleset,
Hash $rule,
String[1] $comment = $title,
Optional[Integer] $priority = undef,
Boolean $ipv4 = true,
Boolean $ipv6 = false,
String[1] $provider = lookup('fw::provider'),
Array[Hash] $networks_v4 = lookup("fw::rules::${ruleset}::networks_v4"),
Array[Hash] $networks_v6 = lookup("fw::rules::${ruleset}::networks_v6"),
) {
if (! $priority ) {
case $rule['action'] {
'accept': {
$_priority = 400
}
'reject': {
$_priority = 300
}
default: {
$_priority = 900
}
}
} else {
$_priority = $priority
}
include "fw::${provider}::rules"
}
Is there a way to have the included class automatically have access to all the current variables? I tried this exact code and it didn't seem to actually do anything.
The example in the documentation (https://puppet.com/docs/puppet/7/lang_scope.html#lang_scope-local-scopes) makes it seem like it should work, but adding debug statements shows the variables are undefined.
I really don't want to end up doing something like this:
case $provider {
'iptables': {
fw::iptables::rules { $title:
ruleset => $ruleset,
rule => $rule,
comment => $comment,
priority => $priority,
ipv4 => $ipv4,
ipv6 => $ipv6,
provider => $provider,
networks_v4 => $networks_v4,
networks_v6 => $networks_v6,
}
}
'firewall_cmd': {
...
Yehuda Katz
07/10/2022, 10:43 PMSlackbot
07/11/2022, 1:55 AMn3snah
07/11/2022, 2:35 AMpuppet config print |grep report
Specifically you should have
report = true
report_server = <fqdn of puppet server>
Slackbot
07/11/2022, 4:01 AMn3snah
07/11/2022, 4:18 AMsshkey
because its a defined type in module. So my question is, in Onceover should I be mocking/stubbing them or is there a way I can include the defined types from the module in question?Serin Abraham
07/11/2022, 4:47 AMSlackbot
07/11/2022, 11:57 AMSlackbot
07/11/2022, 1:38 PMYorokobi
07/11/2022, 1:43 PMSlackbot
07/11/2022, 4:50 PMAngeloMileto
07/11/2022, 5:07 PMSlackbot
07/11/2022, 5:39 PMSlackbot
07/11/2022, 6:37 PM