How Do You Troubleshoot “config.status: error: Something went wrong bootstrapping makefile fragments”?

Problem scenario
You run this command: sudo ./configure --prefix=/usr/local

But you see this:

config.status: error: in `/usr/bin/make-4.3':
config.status: error: Something went wrong bootstrapping makefile fragments
for automatic dependency tracking. Try re-running configure with the
'--disable-dependency-tracking' option to at least be able to build
the package (albeit without support for automatic dependency tracking).

What should you do?

Solution
Run this: sudo bash build.sh

How Do You Read a JSON File to Extract the Value of a Given Key in a JSON File?

Problem scenario
You want to print the value of a given non-nested key in a JSON value. How can Python help you achieve this?

Solution
Here is an illustrative example. Create a file called reader.py with the following lines of code:

import json
with open("first.json", "r") as reading_content:
i = reading_content.read()
j = json.loads(i)
print(j["bird"])

Have the JSON file look like this:

cat first.json
{"bird": {"name": "singy", "species": "sparrow", "amount": "45"}}

Run the program like this (with first.json in the same directory as the Python program): python3 reader.py

What Is the Syntax for Viewing ec2_instance_info Return Values in Ansible?

Problem scenario
You read about a supported data type (defined keys) in Ansible playbooks related to EC-2 servers in AWS. How do you view this data?

Solution

  1. Have a playbook (.yaml file) with the following syntax:

ec2_instance_info:
region: us-west-1
register: vara

  1. Refer to vara as a variable. Here is an example of how to see it:

debug:
msg: "{{ item.instance_id }}"
loop: "{{ vara.instances }}"

How Do You Get xargs to Execute Rather Than Print a Command?

Problem Scenario
You are writing a Bash command to craft AWS CLI commands. But the commands are not running with your xargs command. You created something like this:

aws s3 ls s3://bucketname/ | awk '{print "/usr/local/bin/aws s3 rm s3://bucketname/"$4}' | xargs -L 1

But it merely displays the well-crafted AWS CLI commands. You want the commands to execute.

You tried a variation but received "xargs: awscli: No such file or directory."

What should you do?

Solution

  1. Find where you AWS binary is. Run this: whereis aws
  2. Place the location before the "aws" command so it appears in the "print" statement of your awk command.

Rewrite the command. This example uses "tail" in case you are dealing with many files in an s3 bucket. You want to have all the command drafted after the xargs -L 1 portion. The piped output should be just the variable for the command (and flags) to run. Here is an example of a command that would work:

aws s3 ls s3://bucketname/ | tail -n 10 | awk '{print "s3://bucketname/"$4}' | xargs -L 1 aws s3 rm

How Do You Unhighlight Text in Mac’s TextEdit program?

Problem scenario
You are using a Mac and modifying text with TextEdit. Some text you copied is highlighted. How do you unhighlight the text?

Solution
Highlight the text that is highlighted with the mouse. There should be two pallettes at the top of the TextEdit application. These are solid-color rectangular icons to the right of the font size and to the left of the BIU (bold, italicize, underscore) icons. The righthand pallette should have a letter "a" in it. Click this pallette. Choose the option that has a red diagonal line through it.

This media.idownloadblog.com picture has an illustrative example of where to click first. You just click there then find the option with a red diagonal line on it.

How Do You Troubleshoot the CloudWatch Command Line Error “no outputs found, did you provide a valid config file”?

Problem scenario
You think your amazon-cloudwatch-agent.toml file has been misconfigured. You run "amazon-cloudwatch-agent-ctl" but you get an error about "no outputs found, did you provide a valid config file." What should you do about this error?

Solution

  1. Use amazon-cloudwatch-agent-config-wizard to create the configuration file. From the command line it will walk you through step-by-step directions in text.
  2. Assuming the default configuration has been saved as "AmazonCloudWatch-linux" (based on how you responded above), run this command to get it to be used:

sudo amazon-cloudwatch-ctl -a fetch-config -m ec2 -c ssm:AmazonCloudWatch -linux -s

Does Automation Subsume DevOps or Does DevOps Subsume Automation?

Question
Is automation bigger than DevOps?

Answer
We think that the canonical answer is yes, automation subsumes DevOps. Some professionals think in terms of automation, and automation existed before DevOps was a word. It is well known that the Toyota Production System has influenced DevOps. Automation played a big role in the success of Sakichi Toyoda.

His "most famous invention was the automatic power loom ["a hand-operated or power-driven apparatus for weaving fabrics", taken from Dictionary.com] in which he implemented the principle of Jidoka (autonomous automation). The principle of Jidoka, which means that the machine stops itself when a problem occurs, became later a part of the Toyota Production System." Taken from Wikipedia.

Automation may seem commonplace. But it is quite complex. Sophisticated automation in I.T. uses DevOps. To be fair, some people would consider DevOps to be a field that leverages automation; this characterization would render automation "smaller" than DevOps. Page 360 of The Phoenix Project (5 year anniversary edition) says 'As Christopher Little, a technology executive and one of the earliest chroniclers of DevOps, wrote, "DevOps isn't about automation, just as astronomy isn't about telescopes."'

In some ways automation and DevOps are different subjects like the same way biology and chemistry are different from each other. To the extent that they are related, automation predates DevOps. Automation is central to I.T.


How Do You Create a Class That Is an Iterator in Python?

Problem scenario
You want to implement an object that is an iterator in Python. What do you do to implement iterator behavior in the class?

Solution
Run this program as an example:

class Computation:

    def __init__(self, max = 0):
        self.max = max

    def __iter__(self):
        self.n = 0
        return self

    def __next__(self):
        if self.n <= self.max:
            product = 2 * self.n
            self.n += 1
            return product

objecta = Computation(4) # The number must be 3 or greater if you want to print something other than "None" with this program. 
variter1 = iter(objecta)
next(variter1)
next(variter1)
next(variter1)
pf = next(variter1)
print(pf)

How Do You Install the make Utility on Any Type of Linux?

Problem scenario
You want to install make on Linux. You want it to work on any type of Linux (e.g., Red Hat, Debian and SUSE derivatives). What should you do?

Solution
Prerequisite

Install the C language compiler. If you need assistance, see this posting: How Do You Install a C Compiler on Linux?

Procedures
Run this script:

a=$(which gcc)
echo $a" was found."
echo "This will fail if no c compiler is installed."
sleep 2
version=4.3
curl -L http://ftp.gnu.org/gnu/make/make-$version.tar.gz > /tmp/make-$version.tar.gz
mv /tmp/make-4.3.tar.gz /usr/bin/
cd /usr/bin
tar xf make-$version.tar.gz
cd make-$version
./configure --prefix=/usr/local
rm make
bash build.sh
rm /usr/bin/make
echo "Ignore a message like this:"
echo "rm: cannot remove '/usr/bin/make': No such file or directory"
echo "That message can be safely disregarded."
ln -s /usr/bin/make-$version/make /usr/bin/make

How Do You Hyperlink to Specific Paragraphs (Not the Top) of a WordPress Article?

Problem scenario
You are using WordPress. You have a posting that is long, and you want a link to a paragraph at about halfway down in it. How do you create a hyperlink to a specific paragraph of a WordPress article?

Solution

  1. In your web UI editor for WordPress, click on the three vertically-stacked dots in the upper right-hand corner.
  2. Click on "Code Editor"
  3. Go to the place in the posting where you want the hyperlink to be. Insert this text (but change "contint" to the phrase of your choice):
<div id="contint"></div>
  1. Click update (in the upper right-hand corner).
  2. Create a URL like this (where foobar.com is the URL of the posting): www.foobar.com/#contint
  3. Open a web browser and test this hyperlink as it should bring you to the paragraph of your choice.