Friday, August 31, 2018

The latest version of OpenStack (Rocky) can leverage bare metal servers directly

The source link from ZDNet:

https://www.zdnet.com/article/new-openstack-cloud-release-embraces-bare-metal/

Now you can provision bare metal servers through OpenStack. The linked article describes some of the use cases, and provides additional links to more information.

Wednesday, August 29, 2018

ServiceNow - requiring input from a user completing a task from workflow

Background

A normal part of workflow is requiring some additional information from someone involved in the workflow. A lot of information can be captured automatically, but there often seems to be some information that must be input manually by someone simply because not everything can be determined within an algorithm. This may be because the information is maintained in a separate, walled-off system, or it could be because the sensors required to gather the information aren't yet deployed, etc.

In ServiceNow IT Operations Management, you have this ability Out-of-the-box when dealing with Service Catalog Items. A Service Catalog Item is also known as a Requested Item or an RITM. Specifically, you can define Variables that are associated with an RITM, and those Variables are then available for use within any Catalog Tasks that you create within the workflow for that RITM. Without a little customization, this feature is ONLY available within workflows that target the sc_req_item table. So if you require some generic user input as part of a change task, for example, you need to perform the customizations detailed here.

Here is a link to a great article on this very topic. That post is a little old (from 2010), so the information is a bit dated and very terse. I'm writing this article to update the information and to clarify a few pieces to make it clearer.

I suggest you read through these instructions once or twice before you start trying to follow them. Then re-read them as you're implementing them. The pieces will come together for you at some point, just probably not immediately unless you've worked on this area of ServiceNow a bit.

What's already in place?

Basically, almost all of the components needed to provide this capability already exist in the system, so there's only one place that you'll have to add some code. Everything else is just customization.

By default there are two tables that already exist in ServiceNow for this very purpose:

Question [question]
Question Answer [question_answer]

(The format of these names is a common one that you'll see in ServiceNow. It is
"Label [actual_table_name]")

The Question table holds all of the questions/variables defined in the system. What's specified here is the text of the question and the type of field required (simple text field, choice list, reference, etc.)

The Question Answer table exists to hold one entry for each question and its answer associated with an "entity". For the purpose of this article, the "entity" we'll be adding question/answer pairs to is a change_task item.

Note: Catalog Items already use both the question and question_answer tables to store the Variables (options) that can be specified for each item. 

Areas that need to be customized

You will need to make customizations in the following areas:

1. Workflow->Administration->Activity Definitions

In here, you need to edit the definition for the Create Task activity. The customizations we're making here will allow us to add Questions to a Create Task workflow activity when we add it to the workflow canvas.


Click on Create Task to edit its definition:


As with most forms in ServiceNow, there are numerous fields and sections within this form. 

Define new variable

The first thing we need to do is define a new variable in the bottom section named "Activity Variables":


Add a variable of type "List", with a label of "Questions" with a Column name of "task_questions" (this name will have "u_" prepended to it once you click Submit), and that this is a Reference to the table Question:

Edit the script

The next thing we need to do is add to the script on the Script tab near the top of the page:



In here, you're going to add two pieces of code. In the onExecute function, you're going to add this code, which references the variable you defined in the last step:

if(activity.vars.u_task_questions)
   this._setVars(taskID);

Add it before the call to this.autoClose(taskID), as shown here:


The purpose of this portion of code is to call our function (defined in the next paragraph) when the "Create Activity" task actually creates a task as part of a workflow.

The next piece of code you'll add is the definition of the _setVars() function that's called in the code you just inserted. This is the code you'll add:

_setVars: function(taskID){
   var questions = activity.vars.u_task_questions;
   questions = questions.split(",");
   for(i=0;i<questions.length;i++){
  var qa = new GlideRecord("question_answer");
  qa.initialize();
  qa.question = questions[i];
  qa.table_name = activity.vars.task_table;
  qa.table_sys_id = taskID;
  qa.insert();
   }
},

Add it after the _generate function definition, as shown here:


The purpose of this code is to add one entry to the question_answer table for each of the questions that are defined for this particular workflow activity task. We'll see this in action later.

Edit the Create Task form

Now that you've got a variable to hold the questions for the task and you've got the code in place to add each of the questions to each new task that will be created by this workflow activity, you need to edit the form to actually let someone choose the questions that will be presented in the task. For this, you need to click on the Edit Variables Layout link in the Related Links section of the Create Task Workflow Activity Definition (hint: this section is directly under the "Update" button under the body of the script):

In here, drag and drop your new "Questions" field  wherever you'd like to see it on the form. I've placed mine in the second section of the form:


That's the end of the customizations you need to make to the Workflow Activity Definition. If you want to see the fruits of your labor, you can open the Workflow Editor and create a new workflow, and drop the Create Task activity onto it. Here's what it looks like by default:


And here it is with the new "Questions" field:


We'll come back to the Workflow Editor later. 

2. System UI->Formatters

You now need to create a UI Formatter to display the list of questions and answers. This is covered in the ServiceNow documentation here:


Basically, you just need to create a new UI Formatter that specifies the name you want (I chose "FTQuestionFormatter), the "Formatter" value as com_glideapp_questionset_default_question_editor and you need to specify the type of task that you're going to be creating. In my case, I'm working with a Change Task (the change_task table):


You don't need to change anything about the UI Macro for this formatter - it's written to do exactly what we need.

3. Change Task default view

This is described in the product documentation link above, but I'm including it here for completeness. Since I decided to make this feature available to Change Tasks, that's the form we're going to work with. The most straightforward way to edit this form is to go to System Definition->Tables and select the Change Task [change_task] table


Then scroll down to the middle of the page to select the Design Form Related Link to open the Form Designer, and there you can drag your UI Formatter from the Formatters section (on the left under "Fields") onto the form where you want the questions displayed. I put mine at the bottom of the second section:


This formatter will ONLY show something if the change task you're viewing actually has questions defined. That means that ONLY change tasks created from the workflow that you create in the next step will have anything shown. So at this point, you won't see anything different on any existing change tasks.

4. Service Catalog->Catalog Variables->All Variables

Here is where you need to define any "Questions" (aka Variables) that you want to see on the tasks you'll create later. The main tip here is that you don't need to specify a value for the Catalog Item field, as what we're doing has nothing to do with catalog items. In fact, catalog items already have this capability built-in, with some additional capabilities. What we're configuring is a bit more generic, but we're using the built-in forms to accomplish our goal.

5. Workflow->Workflow Editor

At this point, you can edit a workflow that targets a table that extends the task table and drag the "Create Task" Core Activity onto the canvas. When you do, you'll see your Questions field:


Make sure to select the appropriate type of task - Change Task. This does NOT work for Task items directly in the Task table. This is important to remember! You will not see a successful result if you select "Task".

You can click the padlock icon to open it, then click the magnifying glass to search for your questions:


You'll see ALL of the variables/questions in the questions table. Pick the ones you want displayed to the person assigned the task.

The Result

Now when this task is assigned to a user, that user will see the task in "My Work" and will see that they have the option to provide values for all of the questions selected in the workflow design:


Conclusion

You now have the ability to prompt users for additional input when they're completing a task as part of a workflow. You still need to write scripts to access that data, perform validation, make decisions, etc., and I'll leave that for another day.

Tuesday, August 14, 2018

The Lenovo P1 is a thin-and-light laptop with a Xeon and 64GB RAM that will be available by September

https://www.theverge.com/circuitbreaker/2018/8/13/17682992/lenovo-thinkpad-thin-laptop-work-travel

Additionally, they've got a P72 that will support up to 128GB RAM coming out at the same time.

More memory, storage and power is a great thing.

Wednesday, July 11, 2018

Processing JSON in automation scripts in IBM Control Desk 7.6

Background

You may need to deal with JSON-formatted data in an automation script, and it can be a little tricky. I've written this post to provide the few little pointers to make it easier for you.

JavaScript

You can write automation scripts in Rhino JavaScript or Jython. While Jython is the most common language used for automation scripts, it turns out that JSON processing is MUCH easier in JavaScript. Specifically, in a JavaScript automation script, you have access to the popular object named JSON that will give you everything you need. Here's an example:

var jsonObject = JSON.parse(jsonString);

And that's it. You can now work with jsonObject as a JSON object as described in this reference material from w3schools:


As far as I know, this will work in both WebSphere and WebLogic application servers. One possible caveat is that the JavaScript engine is changing from JDK 7 to JDK 8. Here's more information on that:

Jython in WebSphere

For Maximo/ICD automation scripts, Jython is by far the most popular language. It's also more thoroughly documented and, IMO, easier to work with in this context. However, JSON parsing has a couple of caveats. Specifically, the Jython interpreter in ICD 7.6 is version 2.5.2, which doesn't have a built-in JSON parser (one was added in Jython version 2.6). However, we're still in luck because WebSphere actually includes a JAR file that provides JSON processing. The specific class that you need to import is com.ibm.json.java.JSONObject :

from com.ibm.json.java import JSONObject
...
my_json = JSONObject.parse(my_filebody)

And from there, you can deal with my_json appropriately according to the JavaDoc here:


Jython in WebLogic

Admittedly, I haven't tested this one. I've tested the above two, and from my research, I believe this will work. Specifically, these two links give the necessary information:



If you find that it doesn't work, please ping me and I'll help you get it to work then update this entry as necessary.

With that in mind, you just need to import the appropriate classes in your automation script:

from javax.json import Json
from javax.json import JsonObject

And there you go.

Tuesday, July 10, 2018

It only takes an hour to get a test BigFix environment installed and working

The only caveat (which they've maybe fixed now) is that the SQL Server that's bundled with the BigFix Eval is borked, so you first need to install an eval version of MSSQL Server 2014, which is available from Microsoft.

But the whole process is really easy:

1. Create/clone a Windows 2012 or 2016 server (you can download an eval copy of Windows Server 2016 if needed)
2. Google MSSQL Server 2014 evaluation download and download it
3. Install MSSQL with all the defaults
5. Follow IBM's instructions for installation.
6. Once it's up and running (takes about 10 minutes), continue through the install instructions to add all of the available Sites. The site named IBM BigFix Inventory v9 is actually the one that will get you the BigFix Inventory install files.
8. Optionally create/clone a Windows or Linux VM to be an additional client in your environment

That's it, and even if you need to install Windows Server from scratch, it only takes at most 1.5 hours.

There are other parts you can also install now, such as BigFix Inventory or the WebUI (both are available via fixlets in one of the available Sites).

Monday, July 9, 2018

How to change the BigFix WebUI database userid and password

I recently installed the BigFix WebUI with the wrong password and needed to fix it. I found the encrypted information in the db_config.json file in the folder:

C:\Program Files (x86)\BigFix Enterprise\BES WebUI\WebUI

However, this is what the contents of that file are:

{"user":"96\u002fzY1rPfE40v69uFttQAg==","password":"MwKBDmT00BEwEZm1ctZahg==","hostname":"WIN-5M6866TPST1.mynet.foo","port":1433}

And while those look like Base64 encoded values, there's also some encryption going on (try putting either of those strings through an online Base64 encoder/decoder and you'll see).

So the first thing I tried was to just put the information in the file in cleartext and restart the WebUI service, so the file looked like:

{"user":"sa","password":"passw0rd","hostname":"WIN-5M6866TPST1.mynet.foo","port":1433}

Amazingly, that worked, and here's the logfile entry that shows it:

Wed, 04 Jul 2018 13:14:24 GMT bf:dbcredentials-error Failed to decrypt database credentials, attempting to use inputted credentials as plaintext

However, the file kept the cleartext data (I had hoped that it would re-encrypt the values on startup, but it did not).

Then I found the solution in the place I should have looked to begin with - in the BigFix console! There's a task defined in the BES Support site specifically for this purpose. The task is named "Deploy/Update WebUI Database Configuration". Run the action associated with that task and it will create a new db_config.json file with the properly encrypted data and you're good to go.

Friday, July 6, 2018

For business use, don't buy a laptop with higher than 1080p resolution

The high resolution screens available today are amazing for graphics and gaming, but absolutely horrible if you need to use any traditional/legacy applications. The main application that gives me trouble is Quickbooks Desktop Pro. We have version 2016, and I don't imagine they're going to fix it anytime soon since they seem to (rightly) want everyone to move to their online version. We've been using Quickbooks for over 15 years, so we're using some features that simply aren't available in the online version. I'm sure we'll move to the online version at some point, but it won't be any time soon. I'm certain there are other desktop applications that similarly have a problem with high resolution monitors - specifically, the text and windows are too small to see, and scaling doesn't work correctly at all. It's just ugly.

The higher end business laptops (Lenovo Thinkpad T, P or X series; Dell XPS; etc.) generally offer a 1920x1080 pixel option as a base, then higher resolutions and touchscreens cost more. In my experience, you'll be the happiest with the lower cost 1920x1080 option. Whether you get a touch-enabled screen or not is up to you, but definitely skip the high resolution screen.