Feuerfest

Just the private blog of a Linux sysadmin

The problem with social networks - and why I still miss Google+

Photo by Kaique Rocha: https://www.pexels.com/photo/people-walking-on-pedestrian-lane-during-daytime-109919/

Nowadays, it feels like everyone of us uses at least five different social networks. Mastodon, Twitter/X, Facebook, Instagram, TikTok, LinkedIn, etc. Even messaging apps like Whatsapp and Telegram try more and more to become social networks of their own. Allowing you to follow channels of your favorite brand, celebrity, topic, etc. And even technical sites like GitHub are slowly getting new social features. Following the age-old mantra, "User retention and engagement are key."

Unfortunately, I have a basic problem with all these social networks. See, a human being is not a single-interest individual. Each one of us has multiple interests. And those can vary widely. Additionally, they overlap in different parts of our lives. Sure, your kids are your most valued and precious interest, and you love sharing your experiences with them. What about professional or job-related experiences? Or your leisure time crafts like gardening or cooking? Do you fancy some videogaming to relax? Are you politically active? Help out in your community? All of these are good examples.

Unfortunately, I have a basic problem with all these social networks.

But.. What, and forgive me my ignorance, what if I'm only interested in your job-related experiences? Or your experiences as a developer of some open-source software I use, and I simply wish to be a little ahead on the information flow. And not rely on some IT news site but instead get it directly from the developer?

I don't know your kids. So why should I care? Surely some stories are nice and sweet. Alas I have the same limited time each day as everyone else. Therefore, for me, information reduction is key. I don't want to be constantly bombarded with bits of knowledge I don't want and don't need to know. Each single social network out there forces me to swallow every single drop that comes out of the "digital information water tap".

Each single social network out there forces me to swallow every single drop that comes out of the "digital information water tap".

Yes, you can unfollow. Or block people entirely. Maybe blacklist some channels. Click the "show me less of this" button. But again, these are partially incomplete features. What if I am interested in only some aspects of a person's life? Not their garden, not their kids, not their political views. How do I filter that? Or those "lovely contacts" that set up automatic content generation and spill 3-5 posts into your feed every single day. Do these features help in such a situation? No, they don't. And that is the problem I have with social networks in general.

Currently, I feel the only option offered to me is a rather ultimate one. Block, unfollow, unfriend, or mute. And while the unfollow feature is somewhat usable, it still doesn't solve my problem.

The solution, or: What Google+ did right

The main feature of Google+ was that the content creator was able to group his contacts into circles, for example, a circle called "family" for family members and a circle called "coworkers" for work-related postings. And then he or she could share content only with that circle (or both). Or decide to share publicly for everyone. The follower or friend, of course, was able to group his or her friend into different circles. But the key point was: It was possible to choose which content stream to display by clicking on the button for each circle on the left of Google+.

Yes, that leaves room for improvement. I can't control with which circle(s) the creator associated me. But for me, it was a step in the right direction. One, which sadly was shut down by Google.

One step further

How about a social network where each profile of a person has several feeds (or streams)? Several. Not just one. And of course, we are allowed to define, create, and delete as many feeds (or streams) as we like. And every follower can choose to just follow one stream (or none at all) or the whole profile with all feeds. Sounds a bit like (Hash-)Tags? Yes! Exactly! As hashtags in themselves are nothing different than key words. Each post can be linked to any number of feeds. Like a post about budgeting your new hobby can be shared in your streams labeled "Finance Tips" and "Gardening".

Then the burden of information sorting and reduction is shifted from the followers to the creators. Giving them the burden of choosing what to post where. But in return they should get users who are more engaged, as they are actually only consuming content they are interested in. Well, in theory. The whole psychology and market behavior regarding social networks is not my strong point. And I fear that most people just don't care. They just scroll past that content that is not interesting to them and never think about whether they should be forced to scroll that much, let alone how to fix that problem.

Google+ was social media for me. Forget every other network.

But I remember that Google+ was social media for me. Forget every other network. There, I engaged the most. I posted the most. I commented the most. And I actually learned more than in any other social network I've been or am still active in.

Yes, Twitter has lists, Mastodon too, and so on. But these networks weren't designed around that feature! It wasn't displayed prominently on the start page. Always hidden 2-3 layers deep in some sub-section of some rarely used menu.

I still miss Google+.
(Does this count as an "Old man yells at cloud"-post? 😅 )

Comments

How an ITIL mindset saved 2 of my wisdom teeth

Photo by Piet Bakker: https://www.pexels.com/photo/white-long-coat-lion-68421/

No productive change on Friday!

This expression was my first encounter with ITIL at all. Having just started fresh as Junior Linux sysadmin at a major German telecommunications provider. Strictly speaking, the rule was the following: "No standard changes to a production system if the next day isn't a normal workday." This was put in place to ensure that problems in production can be fixed in a timely manner, that all required resources and people are available. A plain, simple logical rule—and a very effective one.

But how do my wisdom teeth come into play? Well, as I am currently learning for my ITIL4 certification, I remembered a story from that time. I was visiting my dentist, and the whole appointment just felt strange. I knew I had some minor pain in one or two teeth a few weeks ago. Which was when I first visited them. But the dentist—a big clinic with several doctors—did not have enough time at that point and gave me a new appointment.

Naive as I was, I didn't note down what would be done at that appointment. Trusting that the doctor will document everything, right? Well.. He didn't. This time I got another doctor, and he did the one thing I remembered and then just left the room. I wasn't told the appointment was over. It didn't feel like it was over. So I just kept sitting in the chair, waiting.

Some 10 minutes later, a doctor's assistant comes into the room to prepare it and is surprised I am still there. I am told that I am free to go, and, well, I do. I had just put my jacket on when another assistant approached me. "Oh, good that I managed to catch you. You need to make an appointment for the removal of two of your wisdom teeth. The doctor spotted caries in them."

I was surprised. He didn't say anything about that. But, ah, well. Doctors can have a bad day too. So off to the reception I went to make an appointment for the removal. Only to learn that these removals are done by an external doctor who solely does wisdom teeth removal. Additionally, all of his appointments for the next 3 months are fully booked. The reason? He is only present on Fridays.

Immediately, the beloved ITIL phrase comes to mind. Realizing full well that if I should have any pain or bigger problems, I will be in minor trouble. Having to go to the emergency on-call dentist in my town for that weekend—or directly to the hospital. I wasn't really keen on that. So the receptionist and I agreed that I would call some days later to schedule an appointment when I had sufficient time to organize my calendars.

Only that.. Well, I never called back. I grew more and more suspicious over the days and said to myself, "Let's wait until I start to feel something in my teeth." The doctor's strange behavior didn't contribute to my inner well-being either.

I waited. And waited. And waited. And when it was time for my next regular dentist visit, I decided to get a second opinion. I asked some colleagues, checked a few "Rate your doctor" websites, and went to another dentist.

There, they did an X-ray of my whole jaw to get a complete overview. The doctor was nice. Explained what he was looking for. What he can and can't see, and I asked fairly simply if there is any caries in some of my wisdom teeth. He looked a bit stunned for a second and said, "No, not from what I see. If there is caries, usually black spots are visible. But there are none, as far as I can see. Do you feel any pain? Especially when they come into contact with something hot or cold?"

So, I explained the whole situation to him, and then he told me a few details (which I won't write down here for legal reasons), which made it obvious to me that changing my dentist was indeed a good decision.

And all of that, just because I followed ITIL procedures from my employer. Ha!

Comments

Understanding the structure of Email addresses

Photo by Miguel Á. Padriñån: https://www.pexels.com/photo/email-blocks-on-gray-surface-1591062/

Some rather fun stories revolve around my usage of mail addresses. Like many IT people, I like to use identifiable email addresses. In my case, it means I always use companyname-DDMMYYYY@my-domain.tld or website-domain-DDMMYYYY@my-domain.tld when I need to specify a mail address.

This has the advantage that I can verify if the sender matches the recipient address. Obviously, Paypal won't send mail to some-webshop05072024@my-domain.tld. And it is a good pointer when some customer database was leaked or if sites are selling customer data. I experienced it like 10 times already: the mail associated with a certain website or shop got spam right after I deleted my account there. Truly unsuspicious...

And in the few cases where a company's customer database was leaked several times, I can easily change the mail address and still track if the new address is being spammed or not.

The unexpected benefit of unique mail addresses

The first real surprise came to me some years ago when I bought new furniture for my new flat. When the furniture was being delivered and built up one of the people setting them up said to me: "Ah, I see we work at the same company."

I was confused and replied: "Uh, no. I'm not working for (that furniture company's name). Why do you think I do?"
"Well, according to the receipt you got the employee discount.", the man replied. I was dumbfounded. I definitely didn't lie, and when I was in the store and purchased the furniture the employee also said nothing regarding this topic.

Then it dawned on me: My mailaddress! It was companyname@my-domain.tld! But.. I thought in disbelief, "It's only in the local-part!" Well.. Looks like the employee doesn't understand the structure of mail addresses and that everyone is free to choose the part before the @-sign (the so-called local-part or username). And thought I do work for the company, and gave me the discount without saying a single word. Wow.

Basic IT-Security in the banking industry?

And today? The same happened. With my bank. I needed an appointment and called them. As I didn't provide a mail address to them in all these years they asked for one to set up the online calendar entry. I told the customer rep to use bankname2024@my-domain.tld. The representative immediately asked in surprise: "Oh! You work for one of our branches?"

Well.. I was a bit shocked as, until that point, I thought that bank employees were at least minimally trained to properly read mail. In order to detect at least the most obvious phishing attempts. It seems I was wrong.

I gave the rep a quick run-down on the structure of mail addresses and said that basically everything in front of the @ is irrelevant (or at least should be treated as such). And that was it. On to the next adventure with mail addresses!

Comments

I'm not owing you my hyperfocus!

Photo by Tara Winstead https://www.pexels.com/photo/motivational-phrases-for-mental-health-8378735/

Recently, I had a conversation with a recruiter on LinkedIn. It started pretty normal, but for some reason I mentioned I have ADD (Attention Deficit Disorder (Wikipedia)). The recruiter replied that this could be used as an advantage. "How so?" I asked.
And immediately after stating my question, the recruiter said something that made me angry in a rather rapid way.

The recruiter elaborated that I can be presented as way more productive due to my hyperfocus (Wikipedia), and that this has the potential to give my future employer a huge benefit.

I was speechless. I didn't reply for 2 minutes. Only thinking: "WHAT!?"
It certainly didn't help that the way in which my hyperfocus was portrayed reminded me of how slaves were marketed in human history. Pointing out the benefits of their bodily features for the profit of their future masters. Nope. Definitely not helping.
But the main reason for my anger stirred from the fact that my hyperfocus is not some kind of fancy addon. Not some kind of trait I voluntarily learned.
My brain works differently. The chemicals that my brain produces are produced in different amounts than in people without ADD. Science has proved this again and again. This is directly tied to causing different behavioral patterns. Which can cause problems with people who are not on the neurodiversity spectrum of brains.
Many of us ADD'ers only learn of this in our late 30s or even later. After decades of struggling. Trying to find out, "What is wrong with me? Why am I so different than anybody else?" After all, diagnosis was bad in the previous decades. Going even so far as: "ADD is only present in children. It will go away with time." That those children simply learned to hide their ADD and suffered silently as adults? That many adults with undiagnosed ADD develop a depression because of this? Yeah.. This is only understood since a mere decade or two.
I would happily trade my hyperfocus for a normal brain. Don't get me wrong. I don't hate myself for having ADD. It's just the way that I am. And since I got my diagnosis, I have learned more and more about myself and how to deal with all that accompanies ADD.
Fortunately, diagnosis, help, and treatment get better and better, especially for children. Well, at least here in Europe.
But if you are already an adult? It kind of sucks.

(TL;DR: Money. Here in Germany, doctors can send bills to healthcare providers if the ADD patient is a child. But NOT if the patient is already an adult. Yes, a flaw in the law. But an annoying one. This effectively means: Trainings, Coaches, behavioral therapy, medicaments.. All paid for if you are a child. As an adult? Here, take your pills with Methylphenidate (Wikipedia) (like: Elvanse, Medikinet, Ritalin, Concerta, etc.) and that's it. If you want more, search and pay for it yourself.)

But utilizing my hyperfocus in a way to improve my chances of getting hired?
That's NOT the way it's going to work. That's not the way it should be E-V-E-R. That's just a twisted and perverted way of exploiting oneself.
Personally, I have the following approach: If it kicks, it kicks. Sometimes I enjoy it. Using it to deep-dive fast into the topic and learn so much in so little time. Sometimes it's annoying as hell, as I know I can't give in to the hyperfocus as there are other pressing matters more relevant to me or the lives of others.
Most importantly: My hyperfocus is not something I can control.
Yes, there are situations/techniques, etc. that can help. And I've read my fair share of ADD'ers saying they are able to control it.
I always immediately question myself: "Can they, though? And, if they can, should they?"
While being hyperfocused, I feel great. Time feels stopped, yet I can see how rapidly I advance. Which is an awesome feeling for someone with ADD who, more often than not, feels things are too slow to be enjoyable.
But right after the rush of hyperfocus ends? Yeah, better spend some quality leisure time to recharge those internal batteries of yours. If not. Or you simply can't? Things tend to get messy. Missed appointments, forgotten tasks, household chores being left undone, and so on.
And now I imagine ADD'ers who constantly push themselves into that rush just to "prove their worth to their employer." After all, they were sold with that advantage, right?
Why not just hand out free cocaine to non-ADD employees then? Sounds stupid? Dangerous? Yep, now you understand my point.

Back to the recruiter. I told the person all this. That my hyperfocus is a part of me. And it's not a reliable one. Or rather: One on which I wouldn't rely on to get the job done. That I just want to be treated normally. And not be "our newest hyperfocus hire".
The answer I got was: Well, sadly, not much at all. The recruiter got that I wasn't interested in a job. Well, I said so before. It's just that our conversation switched to this topic then. And therefore, the recruiter seemed to not bother answering any of the ethical questions I imposed.
I mean, I get it. What the recruiter said was, most likely, only meant to uplift me. To make me feel good. To give me the impression that I have good chances of being hired.

But still: I'm not owing you my hyperfocus!

Addendum

Some days have passed since I published this post and there is something which I want to add. It's about the whole topic: "Due to your hyperfocus you are more productive!"

Personally I think this is not true. All imponderabilities aside: You need to recover after a hyperfocus. You cannot be constantly in hyperfocus. Like you can't constantly be in a state of flow, something which everyone of us has experienced at one time or another. But hyperfocus, in my personal experience, is way more intense. And I can't say how long it will last.

Likewise I can't tell how long I need to properly recover, but here the logic comes in. Do I need longer to recover (and are maybe less productive during this period) and therefore eliminate the benefits of the time spent in hyperfocus? Or not?

Do hyperfocus and recovery-time always cancel themselves out? Or not? Or like in 70% of all cases? What is the right number here? Is there any at all?

I don't really want answers to these questions. They are simply not needed.

And is there a guarantee that someone in hyperfocus won't make mistakes? Of course not! My advise to employeers would be: "Be happy and thankful when an employee does way more work in a considerable short amount of time. But don't make it the new standard or take it for granted. That won't neither last nor help."

Comments

Linkdump January 2024

Photo by Element5 Digital: https://www.pexels.com/photo/person-holding-book-from-shelf-1370298/

As some links accumulated over the last weeks it's time for another Linkdump.

https://cubecoders.com/AMP: I searched for a self-hostable game server manager. Previously I used LGSM (Linux Game Server Managers) which is a framework/compilation of bash-scripts utilizing SteamCMD to download the necessary files. But for my LAN I wanted something with a nice WebUI. Just quick and easy setup of a game server. Cubecoders AMP (Application Management Panel) is exactly this. I also liked their installer as I literally had to configure nothing. (Granted, I installed it in a separate VM on my Proxmox host. So there was nothing which whom AMP could have interfered..) As I also tried Pterodactyl (https://pterodactyl.io/) but didn't even make it through the installation process as, at that point, I simply didn't want to invest so much time into getting a game server manager running.
Yes, you need to buy a license. But for just 9,50€ you get a lifetime license which allows 5 app instances (simultaneously running game servers) and 3 panel users.

https://github.com/awesome-selfhosted/awesome-selfhosted: A list of software which is installable on a server for self-hosting. Sorted into categories.

https://github.com/awesome-foss/awesome-sysadmin: Same as above, but specifically for sysadmins.

https://www.reddit.com/r/gamedev/comments/qeqn3b/despite_having_just_58_sales_over_38_of_bug/: A reddit thread from a game developer who wrote that Linux only counted for 5,8% of sold game copies but yet those 5,8% are responsible for 38% of all bug reports. He then elaborates a bit further. Interesting read, the comments also hold some interesting bits from other people.

https://steamdb.info/calendar/: I didn't know a "Steam Release Calendar" existed but found it useful during the christmas holidays.

https://www.vidarholen.net/contents/blog/?p=1035: "What exactly was the point of [ “x$var” = “xval” ]?" - When fixing shellcheck errors on some bash scripts I forked from GitHub I repeatedly encountered this idiom and grew curious why it was used "back then". This blog post explains that.

https://stackoverflow.com/questions/76425351/how-to-replace-ps1-variable-in-etc-skel-bashrc-or-bashrc-file-using-sed-awk: Yep, a StackOverflow question. :-) When I wrote my seed-script for my FAI images I struggeled to get the PS1 variable modified as I wanted to. No escaping method I knew worked. No workaround I came up with worked. Turns out escaping the single ticks with \x27 did the trick. As can be seen in my script: https://github.com/ChrLau/scripts/blob/master/fai-prepare-user-env.sh#L96

https://www.debian.org/releases/stable/example-preseed.txt: When playing around with FAI I grew curious what the Debian way is. https://www.debian.org/releases/stable/amd64/apbs03.en.html had the answer in the form of the chapter on how to create a preconfiguration file and https://www.debian.org/releases/stable/amd64/ch05s03.en.html#preseed-args explains how to set some parameters to avoid having a dialog pop up during package install.

https://serverless.industries/2020/05/07/debconf-unattended-package-install.html (german): Turns out, installing some packages on Debian in an unattended way is somewhat complicated. So I searched for the correct way to do it via debconf.

https://austinsnerdythings.com/2021/08/30/how-to-create-a-proxmox-ubuntu-cloud-init-image/: As I currently try to find my preferred way to set up VMs automatically there is of course cloud-init. This article explains how to build a cloud-init image yourself.

https://austinsnerdythings.com/2021/09/01/how-to-deploy-vms-in-proxmox-with-terraform/: Same blog as above. This time about how to deploy VMs in Proxmox with Terraform. Well, nowadays you might want to use OpenTOFU instead of Terraform.

https://pve.proxmox.com/wiki/Cloud-Init_Support: Proxmox documentation about Cloud-Init.

https://github.com/cobbler/cobbler: From the project Readme: "Cobbler is a Linux installation server that allows for rapid setup of network installation environments. It glues together and automates many associated Linux tasks so you do not have to hop between lots of various commands and applications when rolling out new systems, and, in some cases, changing existing ones. It can help with installation, DNS, DHCP, package updates, power management, configuration management orchestration, and much more." Still want to play around with that.

http://www.infrastructures.org/papers/bootstrap/bootstrap.html: Very interesting article about how to bootstrap an infrastructure. Which tools/parts must come first, etc.

http://download.proxmox.com/images/system/: As I discovered, Proxmox hosts some ready to use images for the most popular Linux distributions. Didn't use them, so can't saying anything about the quality but wanted to share it nonetheless.

https://lookscanned.io/: That one is funny. Take a PDF, upload it and you can modify it in such ways that it looks like it had been scanned from a sheet of paper. Maybe useful for our archaic german bureaucracy!?

https://www.reddit.com/r/selfhosted/comments/180maoe/plex_crossed_a_line_with_your_week_in_review/: That one made me laugh too. But rather in disbelief than in a humoristic way. Plex decided to nuke it's entire user base by introducing a feature which shows your friends what shows you've watched and recommends stuff to you. And, of course, it also shows them what kind of "educational adult movie content" you've consumed. I'm just glad I never used Plex. Many users stated they are moving to Jellyfin (https://jellyfin.org/).

https://github.com/workadventure/workadventure: A virtual meeting software. You can move around with your avatar, seeing other users doing the same and either interact with them (also via voice and video) or move to designated zones which represents an open meeting channel. Nice idea!

https://github.com/tmux/tmux/issues/213#issuecomment-159678122: This comment finally explained to me why a horizontal split in Tmux uses the split-window -v command and a vertical split uses split-windows -h when, as I thought, it did exactly the opposite. Well yeah, if you know that the -v and -h is in reference to the Axis, then all makes a lot more sense. Thanks for the enlightenment!

https://jamielinux.com/docs/openssl-certificate-authority/certificate-revocation-lists.html: I needed to research how to create a CRL using OpenSSL. This taught me how to do it.

https://gtfobins.github.io/: "GTFOBins is a curated list of Unix binaries that can be used to bypass local security restrictions in misconfigured systems." If you need a small reminder what tool you can use to escape that chroot..

https://messwithdns.net/: A tool to "Mess with DNS". It allows you to set up DNS entries and display what happens in the background if the entry is being queried. Nice to teach people how DNS works.

https://pandoc.org/: A colleague recommended me Pandoc as it can convert between many document formats like Markdown to DokuWiki markup or even Markdown to Word. Still need to install and test it.

Comments

Puppet's optional parameters might not be what you think they are

Photo by Kevin Ku: https://www.pexels.com/photo/data-codes-through-eyeglasses-577585/

Recently I encountered a puppet-lint warning regarding one of the classes I maintain at a customer. And this warning lead me down a rabbit hole of things I knew, things I understood and things I didn't know and apparently haven't grasp fully before. Surprisingly I never encountered this warning before. Despite being, most likely, a pretty common one.

So, I learned a bit or two about "optional parameters" in Puppet and thought this will give a decent read for my blog.

The problem

Take the following class definition. The code/logic is omitted as it doesn't matter (likewise I removed the puppet-strings documentation at the start of the manifests). We can purely focus on the class definition.

class profile::services::test (
  String $blatest,
  String $password = "test",
  Pattern[/^\d+\.\d+\.\d+(?:-\d+)?$/] $version = '11.2.3-4',
  String $system = 'SOMEEXAMPELSTRING',
  Optional[Hash[Stdlib::Port, Stdlib::Host]] $backupservers,
) {
# intentionally left empty
}

puppet-lint printed out the following warning:

WARNING: optional parameter listed before required parameter on line 6 (check: parameter_order)

And I was stumped by it. "Line 6 IS an optional parameter!" I thought. "There is no parameter defined after this, so how can it be listed before a required parameter?" I was confused. I moved line 6 around and sometimes the warning would vanished, sometimes not. Always defying what I thought I knew was correct.

The documentation is always right?

When you pass a certain amount of time you should stop to fiddle around and start solving it in an iterative way. So I went on to read the documentation. Thinking that maybe I missed some change in the Puppet DSL.

That's when I came across the paragraph on "Display order of parameters" as it mentioned the term "optional parameter". However.. It defined it in a totally different way I was used to use this term.

Display order of parameters

In parameterized class and defined resource type definitions, you can list required parameters before optional parameters (that is, parameters with defaults). Required parameters are parameters that are not set to anything, including undef. For example, parameters such as passwords or IP addresses might not have reasonable default values.

You can also group related parameters, order them alphabetically, or in the order you encounter them in the code. How you order parameters is personal preference.

Note that treating a parameter like a namevar and defaulting it to $title or $name does not make it a required parameter. It should still be listed following the order recommended here.

Source: The Puppet language style guide: Display order of parameters

And here I learned that: Any parameter with an associated default-value is called an optional parameter. But what about the Optional-data type?

Puppet goes on to give us one good and one bad example regarding the ordering:

Good:

class dhcp (
  $dnsdomain,
  $nameservers,
  $default_lease_time = 3600,
  $max_lease_time     = 86400,
) {}

Bad:

class ntp (
  $options   = "iburst",
  $servers,
  $multicast = false,
) {}

This recommendation is the reason why the puppetlabs-puppet-lint Gem enforces the order of: Required parameters first, optional parameters last. Where "optional parameter" again means: Any parameter with an associated default-value.

I changed line 6 by setting an empty hash as the default-value and the puppet-lint warning was gone. I also could have moved line 6 above or below line 2 (String $blatest,). Which would have fixed the warning too.

But here it is more or less the coding-style to list Optional-data type parameters after all others. Regardless of being a required or optional parameter. And again, this is being done here this way as people watch them as "optional parameters" in the sense of "I don't have to use if I don't need them". And here the requirement for parameter ordering bites the official definition of "optional parameters"...

The solution:

class profile::services::test (
  String $blatest,
  String $password = "test",
  Pattern[/^\d+\.\d+\.\d+(?:-\d+)?$/] $version = '11.2.3-4',
  String $system = 'SOMEEXAMPELSTRING',
  Optional[Hash[Stdlib::Port, Stdlib::Host]] $backupservers = {},
) {
# intentionally left empty
}

A bit more explanation

Now that we have clarified what an optional parameter is: You are either already confused, or ask yourself where the confusion originates from. So, without further ado, let me introduce you to the Optional data type.

The Optional data type

The Optional data type wraps one other data type, and results in a data type that matches anything that type would match plus undef. This is useful for matching values that are allowed to be absent. It takes one required parameter.

Source: Puppert: Values, data types, and aliases: The Optional data type

Most likely you have seen that parameters in Puppet classes are defined with an identifier of the type of data they will store. Same as it's required in any programming language where you have to define type of the variable (Integer, Float, Boolean, String, etc.). The only difference to Puppet is that in Puppet this is not enforced (as to avoid the term "optional" here. 😅)

If we adopt the given "good example" from above, we can make it look like this:

class dhcp (
  String $dnsdomain,
  Hash[String] $nameservers,
  Optional[Integer] $default_lease_time = 3600,
  Integer $max_lease_time               = 86400,
) {}

Here $default_lease_time is an optional parameter, right? Yes, but not because it uses the Optional data type. It's only an optional parameter because it has a default-value of 3600 assigned. Likewise $max_lease_time is an optional parameter too.

And here the problem originates.

Most of people I encountered use the term "optional parameter" to refer to the $default_lease_time parameter and not $max_lease_time. Which is absolutely understandable given how your speech works, how we like to name things and how we combine those two.

Adding to this is the fact that parameters which are initialized with the additional Optional-data type are allowed to be undef additionally to the other types of data defined. Effectively making it optional to assign a value to them. And this is exactly how these type of parameters are often used. Hence the term "optional parameter" sounds logical when referring to these parameters.

Technically however, that's wrong. Alas in my case it was the reason why I spent more time than I liked fixing that one linter warning. But I learned something along that way. I think that's what matters, right?

A little bit more confusion?

When reading through all data language types definitions and data types I found a data type I knowingly never encountered before. The Undef and NotUndef data types.

The Undef data type

The data type of undef is Undef. It matches only the value undef, and takes no parameters.

Several abstract data types can match the undef value:

  • The Data type matches undef in addition to several other data types.
  • The Any type matches any value, including undef.
  • The Optional type wraps one other data type, and returns a type that matches undef in addition to that type.
  • The Variant type can accept the Undef type as a parameter, which makes the resulting data type match undef.
  • The NotUndef type matches any value except undef.

Source: Puppert: Values, data types, and aliases: The Undef data type

The NotUndef data type

The NotUndef type matches any value except undef. It can also wrap one other data type, resulting in a type that matches anything the original type would match except undef. It accepts one optional parameter.

Source: Puppert: Values, data types, and aliases: The NotUndef data type

And yes, they are useful for what they are designed. But I REALLY wished Puppet would rename that Optional data-type to something else. (Is: CanBeUndef still available? 😂)

Conclusion

All definition problems aside: This shows again why the usage of proper development/analyze tools like Linters is so important. It not only helps reducing errors, no. It forces you to understand what you are doing. 😉

Comments