Problem scenario
You type emails or type text in Notepad or Wordpad (e.g., in Windows). Sometimes you use a web browser in Windows. You want to create this symbol £. What do you do?
Solution
Hold the "Alt" key and type "156" (with no quotes).
A Technical I.T./DevOps Blog
Problem scenario
You type emails or type text in Notepad or Wordpad (e.g., in Windows). Sometimes you use a web browser in Windows. You want to create this symbol £. What do you do?
Solution
Hold the "Alt" key and type "156" (with no quotes).
Problem scenario
You try to run sonarscanner from a command prompt. But you get this message:
"java.lang.IllegalStateException: Failed to create lock in /opt/app/sonar-scanner/conf/...sonar_locak...DirectoryLock..."
What should you do?
Solution
Become a different user to run the sonarscanner command or use "sudo " before your command.
Problem scenario
Through the register keyword you assign a variable. You want to know what variable type it is (e.g., a string, a dictionary or a JSON). You know the data type is not a Boolean. What do you do?
Solution
If you have a variable (e.g., foobar) and you want to know what data type it is, do this:
debug:
msg:
when: foobar.stdout == ""
The playbook will tell you if foobar is a dictionary with an error. If there is no error, it is a string. If foobar is a JSON you will see a message when you run the playbook about "ansible.utils.unsafe.proxy.AnsibleUnsafeText"
(The above will not help you if it is a Boolean. You should compare it to "TRUE" or "FALSE" instead of "" if you think the value may be a Boolean.)
Problem scenario
You have an Ansible module that uses a database module. When you run the playbook, you get an error about a user being unable to authenticate when this database module is run. What could be wrong?
Solution
Is the user in the error message a user that is created via the playbook? If it is, does that user get assigned a password? The password must not be clear text. Here is an example of an incorrect attribute for the password attribute:
password: "verygoodpassword"
You must use a hashed password. It would look something like this:
password: "$j3/$j4.afjeroi48e89ksdaefqasfijklr/xk3.asdfklir"
To obtain this hashed password (and know what the value actually is beforehand), follow these instructions.
Problem scenario
You are using the "which" command. You only get one result. How does Linux choose the result when the file exists in two directories in the $PATH variable?
Solution
Run this command to see every directory in the $PATH variable:
echo $PATH
The "which" command evaluates from left to right and will return the first match found.
Problem scenario
You are running a Groovy program.
Here is your code:
def input = System.console().readLine 'Please provide some input: '
def x = input
def boardArray = new String[2]
boardArray[0] = ""
boardArray[1] = ""
boardArray[1] = "$x"
println boardArray[1]
When you run it (i.e., with groovy foobar.groovy), you get this error:
Caught: java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
java.lang.ArrayStoreException: org.codehaus.groovy.runtime.GStringImpl
What should you do?
Solution
To assign an element of an array, should have quotes around the variable and the $ symbol and the syntax " as String" should follow the closing quote mark.
def input = System.console().readLine 'Please provide some input: '
def x = input
def boardArray = new String[2]
boardArray[0] = ""
boardArray[1] = ""
boardArray[1] = "$x" as String //This is the correct version
println boardArray[1]
You may also want to view this external web pages:
https://stackoverflow.com/questions/44192690/set-array-to-variable-in-groovy
http://docs.groovy-lang.org/latest/html/api/org/codehaus/groovy/runtime/GStringImpl.html
Question
What is the Westrum Cultural Model?
Answer
Merriam-Websters Collegiate Dictionary 11th Edition defines culture as "the set of shared attitudes, values, goals, and practices that characterizes an institution or organization."
What we might call the "Westrum Cultural Model," based on Ron Westrum's "The Three Cultures Model", (according to this site), consists of three categories of corporate culture. These three are pathological, bureaucratic, and generative and are defined as follows:
"Pathological organizations are characterized by large amounts of fear and threat. People often hoard information or withhold it for political reasons, or distort it to make themselves look better.
Bureaucratic organizations protect departments. Those in the department want to maintain their ‘‘turf,’’ insist on their own rules, and generally do things by the book—their book.
Generative organizations focus on the mission. How do we accomplish our goal? Everything is subordinated to good performance, to doing what we are supposed to do."
The above quotes were taken from this site.
The assessment of a given business may be subjective. The DevOps movement that emphasizes collaboration has an ideal for each business to strive to be a generative organization. If you want more information on DevOps and the Westrum Cultural Model, see the following links:
https://www.andykelk.net/devops/using-the-westrum-typology-to-measure-culture
https://continuousdelivery.com/implementing/culture/
Problem scenario
You want to learn more about Google BigQuery. What do you do?
Solution
Background
"BigQuery is Google's serverless, highly scalable, enterprise data warehouse..." taken from this site.
If you want to learn more about the components of BigQuery, see this link. This solution will allow you to create data to query.
Procedures
1. Log into the web UI for GCP.
2. Go here: https://console.cloud.google.com/bigquery?p=bigquery-public-data&page=project
3. Have the cloud-based data warehouse ingest data.* In the following example we will walk you through creating a JSON file and importing it.
a. Via a web browser, go here: https://www.mockaroo.com/
b. Add or remove fields as you like. Rename them as needed. (For this example we eliminated "IP address" and changed "Gender" to phone number. We also added a field for "Street address.")
c. Click "Download Data".
d. Go to the GCP web UI where you have BigQuery open. Go here: https://console.cloud.google.com/bigquery
e. Click on a project you already have, or on the left where it says "My First Project" click the down arrow and go to "Create new dataset".
f. Enter a value for "Dataset ID" and click "OK"
g. This value should now appear under "My First Project". Hover over it and a "+" sign should appear. Click the "+" sign. h. In the "Create Table" window that appears, make sure that the Location is set to "File upload" and then click "Choose file."
i. Make sure the "File format" is set to "JSON".
j. In the "Destination Table" section, enter text into the "Table name" field.
k. For the "Schema" check the button for "Automatically detect".
l. Click "Create table".
4. Click "Compose Query".
5. Compose a query like this, but replace "contint" with the name of your project and replace "h2" with the value you entered above (in step 3.j) for "Table name":
select * from contint.h2
6. Enter it into the field. Click "RUN QUERY".
* If you want separate directions for other uploading methods, see this posting.
Question
In the context of Jenkinsfiles, there are two types of pipelines: declarative and scripted. What are the differences between these two types?
Answer
1. The syntax of the two is one difference. While both are based on Groovy, Declarative Pipeline syntax is more simple (according to this posting). Declarative Pipeline syntax follows more of an declarative paradigm whereas Scripted Pipeline syntax follows more of a imperative paradigm (according to this posting).
2. The Scripted Pipeline is more like a "general purpose DSL" (according to this posting). Thus Scripted Pipelines are more complex, flexible and powerful than Declarative Pipelines.
3. The Declarative Pipeline is easier to learn how to use (according to this posting).
4. The Declarative pipeline uses three reserved words that the Scripted does not: pipeline, agent, and steps (according to this posting).
5. The Scripted pipeline uses the reserved word "node" that the Declarative pipeline does not use (according to this site).
Problem scenario
You run a "kops" command but you receive this error:
"unable to infer CloudProvider from Zones (is there a typo in --zones?)"
How do you get the "kops" command to work?
Solution
There is a value and a format that are necessary for your kops' "--zones" flag.
Determine what region you want to know the zone name for (e.g., us-west-9). Run this command but substitute us-west-9 with your region of choice:
aws ec2 describe-availability-zones --region us-west-9 | grep ZoneName
The results will be possible choices for you to use as the "zones=" value. Use one of the "ZoneName" values in your "kops" command. The problem should go away.