Using ChatGPT for writing Risu Plugins

Lately, there’s a lot of interest on ChatGPT, and yes, it’s really impressive the way it processes the context to provide answers to the questions. To give it a try, and put into play the requirements for writing a Risu plugin, I wrote some of the requirements in a paragraph: I want to create a bash script for checking system status. The script should use return codes to indicate success, failure, information, error or skipped via the values stored in the variables $RC_OKAY, $RC_SKIPPED, $RC_ERROR, $RC_FAILED and $RC_INFO. ...

March 2, 2023 · 2 min · Pablo Iranzo Gómez

OpenShift's oc debug and parallel execution

A colleague reported some issues in the OpenShift troubleshooting and diagnosis scripts at OpenShift-checks. Some time ago I did contribute some changes to use functions and allow using the RISU wrapper to the scripts, helping consuming the results via RISU’s HTML interface. As my colleague reported, for some plugins, the output of the command was not shown in the HTML Interface. After some investigation, it was found that parallel execution for the plugins was causing no output to be shown, but when filtering to individual ones via risu -i XXXXXXX/plugin -l it was working fine… the problem was not the check itself, as both of them worked fine when executed individually but failed when executing them together. ...

November 3, 2022 · 2 min · Pablo Iranzo Gómez

Go (golang) plugin in Citellus

I wanted to practice a bit Go programing, so I divided that task in two parts, one, adding a golang extension for Citellus and a sample, but working plugin using it. If interested in the code it’s available at the review at https://review.gerrithub.io/c/citellusorg/citellus/+/495622. The final sample code for it has been: // Author: Pablo Iranzo Gómez ([email protected]) // Header for citellus metadata // long_name: Report detected number of CPU's // description: List the processors detected in the system // priority: 200 package main import ( "bufio" "io" "os" "runtime" "strconv" "strings" ) func main() { var OKAY, _ = strconv.Atoi(os.Getenv("RC_OKAY")) var SKIP, _ = strconv.Atoi(os.Getenv("RC_SKIPPED")) var INFO, _ = strconv.Atoi(os.Getenv("RC_INFO")) var CITELLUS_ROOT = os.Getenv("CITELLUS_ROOT") var CITELLUS_LIVE, _ = strconv.Atoi(os.Getenv("CITELLUS_LIVE")) var FAILED, _ = strconv.Atoi(os.Getenv("RC_FAILED")) if CITELLUS_LIVE == 1 { // Report # of CPU's var CPUS = runtime.NumCPU() os.Stderr.WriteString(strconv.Itoa(CPUS)) os.Exit(INFO) } else if CITELLUS_LIVE == 0 { file, err := os.Open(CITELLUS_ROOT + "/proc/cpuinfo") if err != nil { os.Stderr.WriteString("Failure to open required file " + CITELLUS_ROOT + "/proc/cpuinfo") os.Exit(SKIP) } defer file.Close() counts := wordCount(file) os.Stderr.WriteString(strconv.Itoa(counts["processor"])) os.Exit(INFO) } else { os.Stderr.WriteString("Undefined CITELLUS_LIVE status") os.Exit(FAILED) } // Failback case, exiting as OK os.Exit(OKAY) } // https://forgetcode.com/go/2348-count-the-number-of-word-occurrence-in-given-a-file func wordCount(rdr io.Reader) map[string]int { counts := map[string]int{} scanner := bufio.NewScanner(rdr) scanner.Split(bufio.ScanWords) for scanner.Scan() { word := scanner.Text() word = strings.ToLower(word) counts[word]++ } return counts } Of course, lot of googling helped to start building the pieces. ...

June 14, 2020 · 2 min · Pablo Iranzo Gómez

Killercoda scenario redirection

After my post about killercoda, I did split my initial scenarios into ‘organizations’. One of them, is in progress to get contributed upstream to KubeVirt project killercoda (still getting some reviews to land on final repo), and the other is under Citellus organization. As the goal was not to lose visits using the prior links, I contacted the team behind killercoda Support (thanks a lot Ben!!) and the requirements to get a ‘redirect’ in place is to: ...

July 31, 2019 · 1 min · Pablo Iranzo Gómez

Contributing to OSP upstream a.k.a. Peer Review

Introduction In the article “Contributing to OpenStack” we did cover on how to prepare accounts and prepare your changes for submission upstream (and even how to find low hanging fruits to start contributing). Here, we’ll cover what happens behind the scene to get change published. Upstream workflow Peer review Upstream contributions to OSP and other projects are based on Peer Review, that means that once a new set of code has been submitted, several steps for validation are required/happen before having it implemented. ...

October 16, 2018 · 6 min · Pablo Iranzo Gómez
This blog is a participant in the Amazon Associate Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.