How Do You Troubleshoot a GitLab Webhook Failing Because of “Execution expired”?

Problem scenario
You try to test an Integration, specifically a Webhook, in GitLab.  The URL is for Jenkins.  You get "Execution expired."  What could be wrong?

Possible solution #1
See if the GitLab's IP address or hostname changed.  If the external_url stanza in /etc/gitlab/gitlab.rb uses an old IP address or FQDN, then that may need to be updated.  You may need to run "sudo gitlab-ctl reconfigure" again.  Then you may want to reboot your server.

Possible solution #2
Is there a firewall blocking connectivity over port 8080 (or whichever port your Jenkins server listens on)?

Possible solution #3
To find out more, go to the webhook job, click on "Edit."  At the lower portion of the screen you may find more about the job.

How Do You Write a Java Program to Accept Text from the Command Terminal and Print It Back Out?

Problem scenario
You want to write a basic Java program to test it out.  How do you write a program to accept user input, specifically a alphanumeric input, and print it back to the screen?

Solution
1.  Install the Java Development Kit if you have not installed it yet.  If you are not sure you have it, run "javac -version".  If it says that the command is not found, you need to install the Java Development Kit.  If you do not know how, see this posting.

2.  Create this file named acceptText.java:

import java.util.Scanner;

public class acceptText {

public static void main(String[] args) {
   System.out.println("Please enter text, then press enter: ");
   Scanner x = new Scanner(System.in);
   String var1 = x.next();
   System.out.println(var1);
  }
 }

3.  Run this command: javac acceptText.java

4.  Run this command: java acceptText

How Do You Troubleshoot the Ansible Error “Syntax Error while loading YAML expected <block end>, but found ‘-‘”?

Problem scenario
You are trying to run an Ansible playbook with the "become: yes" stanza.  You get this error after your ansible-playbook command:

"ERROR! Syntax Error while loading YAML.
  expected <block end>, but found '-'

The error appears to have been in '/home/cooluser/good.yaml': line 4, column 3, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  become: yes
  - copy:
  ^ here"

How do you get your playbook to run?

Solution
Put the "become: yes" stanza under the module -- not under the "tasks:" statement.

Here is an example of an incorrect order:

- hosts: all
  tasks:
  become: yes
  - copy:
      src: /home/cooluser/swapspace.sh
      dest: /home/cooluser/swapspace.sh
      owner: cooluser
      group: wheel
      mode: 0644

Here is an example of a correct order:

- hosts: all
  tasks:
  - copy:
      src: /home/cooluser/swapspace.sh
      dest: /home/cooluser/swapspace.sh
      owner: cooluser
      group: wheel
      mode: 0644
    become: yes

In Python, How Do You Call an Unbound Function as a New Thread with the thread Module?

Problem scenario
You want to write a program to call a unbound function in a new thread with the threading module. How do you do this?

Solution
Run this program (e.g., python foobar.py):

import _thread as thread
def contint():
  print("Hello!")

#if name == "main":
foobar = thread.start_new_thread(contint, () )
print("thread finished exiting")

How Do You Troubleshoot the Bash Script Error “line 5: $’\r’: command not found”?

Problem scenario
You drafted a Bash script on a Windows computer.  You then uploaded it to Google Cloud Platform via a web browser feature.  When you run the bash script on a Linux server (e.g., in GCP), you get this error "line 5: $'\r': command not found".  You do not want to install dos2unix or any new packages.  What should you do?

Solution
The file needs to be modified or "cleaned up."  Special characters were introduced with the way it was transferred over to the Linux system.  Assuming the file is called foo.txt, run this command:

perl -p -i -e "s/\r//g" foo.txt

How Do You Install Jira When You Get an Error about Not Having a Graphical UI or an Error about Using the -c Flag to Use the “console” to Install Jira?

Problem scenario
You are trying to install Jira on a RHEL server (e.g., in AWS).  You run this:

sudo ./atlassian-jira-software-7.8.1-x64.bin

But it gives you an error.  You see a message about not being able to connect to an X server and the -c option will invoke a console method.  You try using the -c flag when invoking the .bin script to install Jira.  The problem keeps happening.  What should you do?

Solution
1.  Run these two commands:
sudo yum groupinstall "X Window System"
sudo yum groupinstall 'Server with GUI'

2.  Reboot the server.

How Do You Troubleshoot “ERROR! ‘service’ is not a valid attribute for a Play”?

Problem scenario
You are trying to use the "service" Ansible playbook reserved word.  You want a service to be started.  But when you run the Ansible playbook, you get "ERROR! 'service' is not a valid attribute for a Play".  How do you fix this?

Solution
Change the formatting of the playbook.  Eliminate spaces and make sure indentation aligns with other sections of the playbook.

Happy Halloween!!

Did you know these two interesting facts about Halloween?

If you are looking for a type of cinnamon that you do not eat and yearn for that creepy green glow color, try Linux Mint (not the type you eat) on a bootable USB stick.  Linux Mint has a "Spooky" login theme that is very festive for today.  On the topic of Linux and Halloween, you may want to read this article that CNet published ten years ago about Microsoft's relationship to open source software. 

Halloween is celebrated around the world; if you want to read about the different locations, you can consult with Wikipedia here.  To prepare your manse for a special effects extravaganza, there is now software that is ideal for Halloween lights in your yard.  If your budget cannot afford you this luxury and you want just that one Misfits song "Halloween," you can buy it alone for a low price.  If you need a pair of those festive Misfits gloves, you can buy them here.  Halloween skeleton costumes remind some people of The Karate Kid movie especially this scene.  The movie involves an underdog who learns self-defense techniques without realizing it.  By waxing cars for an immigrant mentor the underdog, Italian American youngster develops a muscle memory and physical reflex to block attacks from his opponents.  On the topic of southern European underdogs, the Battle of Thermopylae was won by the Greeks.  By winning this battle the Greeks, who do not celebrate Halloween, have given struggling people hope to those who read about this famous battle.  The victory shows the benefits of both patriotism (knowing your country and its land and being prepared to sacrifice) and preparation can combine to prevail against incredible odds.

The writer of The Karate Kid movie (Robert Kamen) went to the University of Pennsylvania and received a PhD in American Studies.  Kamen's focus on America undoubtedly played a role in his ability to create touching stories for films that have a broad appeal to movie watchers in the U.S. Relevant to Philadelphia (where the University of Pennsylvania is), we had this post for Constitution Day.  Philadelphia, despite being home to many technology companies (some of them growing rapidly),  has many historic buildings with gothic architectures which would be great to see in the fall (with trees' leaves changing colors).  Trick-or-treaters would love the costumed Patriotic interpreters as well.  Benjamin Franklin founded the University of Pennsylvania -- despite having only two years of schooling himself.  The first American to propose daylight saving time was Ben Franklin himself, and for many years clocks were set back in October (lasting until 2006).  This made it seem like sunset came earlier on October 31st which was great for trick-or-treating enthusiasts who could not stay up late due to their parents' caring restrictions. 

What Are Some Tips on a Bash Programmer Becoming a PHP Programmer?

Problem scenario
You are a Bash programmer, but you want to learn how to code in PHP.  How do you learn to develop PHP scripts when you have a Linux bash background?

Solution
If you are new to PHP programming and familiar with Bash programming, remember these tips:

1.  Variable assignments involve the variable with the syntax of a cash sign "$" before the variable name.  Here is an example:

$var4        = 4;

2.  An error such as this "PHP Parse error:  syntax error, unexpected '...' (T_VARIABLE) " can be caused by forgetting to have a semi-colon at the end of a line.  Here is an example:

$var1        = "A sentence";

3.  To concatenate strings, use a period between two variables like this:

$var3        = $var1.$var2;

4.  Here is a basic program to learn about arithmetic and conditionals:

<?php
   $var1        = "The beginning of a sentence";
   $var2        = " and other stuff.";
   $var3        = $var1.$var2;
   $var4        = 4;
   $var5        = 5;
   $var6        = $var4 - $var5;
   if ($var6 > 3) { echo "It is bigger than three!!!";}
   else { echo "It is not bigger than three!!!";}
?>

Save the above file as test.php, and run it with this command: php test.php

How Do You Troubleshoot the Jira Cluster Message “Node is not using the correct shared home…”?

Problem scenario
In the Jira "Instance health checks" section you see a problem has been detected under the "Cluster" section.  It says "Node jiranode1 is not using the correct shared home..."  How do you get this error to go away?

Possible solution #1
Log into the node on the back-end.  Stop the Jira service and then start the Jira service.

Possible solution #2
Log into a working node on the back-end.  Look at the differences between the directories with the one that is not working.  Are the permissions set similarly?  Do they have the same subdirectories?

Possible solution #3
Go here for more information.