How Do You Troubleshoot the yum Repository “Errors during downloading metadata for repository”?

Problem scenario
You try to use a yum command on RHEL 8.2. But you get this error:

Docker Repository 0.0 B/s | 0 B 00:00 Errors during downloading metadata for repository ‘foobar’: – Curl error (6): Couldn’t resolve host name for https://yum.dockerproject.org/repo/main/centos/7/repodata/repomd.xml [Could not resolve host: yum.dockerproject.org] Error: Failed to download metadata for repo ‘foobar’: Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried

What should you do?

 » Read more..

How Do You Troubleshoot the InsufficientFreeAddressSpaceInVpc Error?

Problem scenario
You run an AWS CLI command. But you get this message:

An error occurred (InsufficientFreeAddressSpaceInVpc) when calling the CreateDefaultSubnet operation: The VPC ‘vpc-123abcd’ does not have enough free address space to allocate an additional /20 subnet.

How do you troubleshoot this AWS CLI error?

Solution
Go to the VPC section of AWS. Find the VPC in the error and click on it.

 » Read more..

How Do You Troubleshoot the kubectl ‘version “extensions/v1beta1″‘ Error Message?

Problem scenario
You run a kubectl command, but you get this problem: ‘error: unable to recognize “foobar.yaml”: no matches for kind “Deployment” in version “extensions/v1beta1″‘

What should you do?

Solution
Change your yaml file so the apiVersion setting/value works. To learn more about the acceptable values, see this posting.

 » Read more..

How Do You Replace a Pattern with a String in Bash?

Problem scenario
You have a .txt file. You want to use Bash to replace every occurrence in the file with a string.

Solution
Let’s assume the file you have is called coolfile.txt. Run these two commands to replace “foo” with “bar” every time “foo” is found in the file named coolfile.txt:

oldfile=$(cat coolfile.txt)
echo “${oldfile//’foo’/bar}” newfile.txt
# The resulting file newfile.txt will have “bar” instead of “foo”  » Read more..

How Do You Escape or Break from a Method in Python?

Problem scenario
You want to quit a function, or return out of it, when a certain condition is met. How do you do this?

Solution
This program illustrates how it is done. You will want to run the program twice, once by leaving the “5” as it is, and a second time by changing the “5” to “6”.

def cool(x):
if x == 5:
return “There was equivalence”
else:
y = x
print(“This statement is printing as an illustration”)
return “The comparison was NOT equivalent”

var1 = cool(5)
print(var1)  » Read more..

How Do You Troubleshoot a C Program That Prints a Warning Message like “expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]”?

Problem scenario
You compile a C program (with gcc foobar.cc) but you get an error message like this:

basicprog.c:5:13: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘char *’ [-Wformat=]
printf (“y is a %d\n”,y);

What do you do to not get this error?

Solution
While the code compiles, the executable may not run.  A compilation error can be benign. 

 » Read more..

How Do You Use Terraform and Kubernetes in a Simple Way (as a Proof of Concept)?

Problem scenario
You want to use Terraform and Kubernetes (in EKS). How do you do this in a simple way to test it out?

Solution
Prerequisite

This assumes you have deployed EKS. If you need assistance, see this posting.
This assumes you have installed Terraform. If you need assistance, see this posting.

Procedures

  1. This first step is optional.

 » Read more..

How Do You Fix the AWS CLI Error “Following required service principals [eks.amazonaws.com] were not found in the trust relationships”?

Problem scenario
You run an AWS CLI command, but you get this error:

An error occurred (InvalidParameterException) when calling the CreateNodegroup operation: Following required service principals [eks.amazonaws.com] were not found in the trust relationships of clusterRole arn:aws:iam::12345678910:role/foobar

How do you fix this?

Solution
Draft a command like this (but replace “12345677810:role/foobar” with the equivalent string in the error, and replace foobar.amazonaws.com with the service principal in the error):

aws iam list-roles –query ‘Roles[?Arn==arn:aws:iam::12345678910:role/foobar]’ | grep foobar.amazonaws.com

If the above command returns nothing,

 » Read more..

How Do You Install the dot Utility on a Debian/Ubuntu Server?

Problem scenario
You want the dot utility to transform “terraform graph” command output to usable files. What should you do?

Solution
Run this command: sudo apt -y install graphviz

 » Read more..

A List of PowerShell Books

1593279183PowerShell for Sysadmins: Workflow Automation Made Easy by No Starch Press

1617294160Learn Windows PowerShell in a Month of Lunches by Manning Publications

1449320686Windows PowerShell Cookbook: The Complete Guide to Scripting Microsoft’s Command Shell by O’Reilly Media

1789536669Mastering Windows PowerShell Scripting: Automate and manage your environment using PowerShell Core 6.0, 3rd Edition by Packt Publishing

B085RQNL9XWindows PowerShell and Scripting for Beginners: Complete Beginners Guide to learn Windows PowerShell and its Scripting by Independently published

1617295094Learn PowerShell Scripting in a Month of Lunches by Manning Publications

0735675112Windows PowerShell Step by Step by Microsoft Press

1789808537Windows Server 2019 Automation with PowerShell Cookbook: Powerful ways to automate and manage Windows administrative tasks,  » Read more..