How to change attribute values of a activity using clear-case commands? - command-line

I want to change the values of the clear-case activity attributes. Can anyone give me commands which I can use in a windows command prompt.
activity "<activity_id>"
created 2015-05-04by ayz
master replica: <xxx>
owner: <owner>
group: <group>
stream: <stream>
title: <title>
change set versions:
xxx.java##\main\...\5
Attributes:
activity_ok = "yes"
Delivered = "no"
Finished = "no"
Type_Activity = "User"
I want to change the values of the attributes Delivered and Finished to "Yes".

It should be possible using cleartool mkattr:
cleartool mkattr -replace Delivered \"yes\" activity:activity_id#\aPVob

Related

Rundeck Conditional options variables

I have a question about rundeck (noob alert !)
I need to set conditionnal options variables, (don't know if its the good word).
For exemple, i want to launch a job with only one value option:
Customer01
and i need to have a relation between variable.
If i put Customer01 the other variable need to dynamic have default options:
exemple:
if
cust = Customer01ID
then ID = MyID and Oracle_schema = Myschema.
How can i make this working ?
Thanks a lot and forgive me if my problem is not clear.
A good way to do that is using cascade options, take a look at this answer.
Another way is just scripting, basing on an option selection and using an inline script step you can do anything based on the option selected, let me share a job definition based example (save as a YAML file and import to your instance to test it):
- defaultTab: nodes
description: ''
executionEnabled: true
id: e89a7cb0-2ecc-445d-b744-c1eebd540c91
loglevel: INFO
name: VariablesExample
nodeFilterEditable: false
options:
- name: customer_id
value: acme
plugins:
ExecutionLifecycle: null
scheduleEnabled: true
sequence:
commands:
- fileExtension: .sh
interpreterArgsQuoted: false
script: |-
database="none"
if [ "#option.customer_id#" = "fiat" ]; then
database="oracle"
else
database="postgresql"
fi
echo "setting $database"
scriptInterpreter: /bin/bash
keepgoing: false
strategy: node-first
uuid: e89a7cb0-2ecc-445d-b744-c1eebd540c91
Basically, the script takes the option value (#option.customer_id#) and based on that option sets the bash variable $database and does anything.
So, probably you're thinking about executing a specific step based on a job option, and for that, you can use the ruleset strategy (Rundeck Enterprise), which basically is a way to design complex workflows and a perfect scenario is to execute specific steps based on a job option selection.

Assign ITGlue Contact to the Field using API powershell

I just want to assign the contacts to Application's field and another field with API Powershell but I don't know how to do it. could anyone help me?
According to their API documentation, there is no 'Application' resource type. Is it a custom resource, or a field on a different type of object? (what type?)
Try installing ITGlue's PowerShell wrapper module ITGlueAPI from the gallery (or github link):
Install-Module ITGlueAPI
Import-Module ITGlueAPI
# Check out all the available commands
Get-Command -Module ITGlueAPI
# initial setup:
Add-ITGlueBaseURI -base_uri 'http://myapi.gateway.example.com'
Add-ITGlueAPIKey -ApiKey 'your-key-here'
# Play around with these kinds of "Get-" commands which exist for each resource type:
# This is a good way to see how the data is formatted, and which fields exist per resource
Get-ITGlueFlexibleAssets
Get-ITGlueContacts -organization_id 1234 -filter_first_name 'Foo' -sort 'first_name'
# To make changes, run similar "Set-" or "New-" commands with the updates in hash table format:
Set-ITGlueContacts -id 1234 -data #{
location-id = 795
location-name = "San Francisco - HQ"
field-name = "Value"
}

Why is the defaults command just returning the syntax?

I'm trying to run a terminal command from an application I'm working on in Xcode 11.4.
let path = "/usr/bin/defaults"
let arguments = ["defaults delete com.apple.dock; killall Dock"]
let task = Process.launchedProcess(launchPath: path, arguments: arguments)
task.waitUntilExit()
That code is inside an #IBAction function which is connected to a button. I have testing that the button does actually call this as I replaced the above code with a simple print("Hello world") script and it worked great. However when I have the above code in the action and click it. The response is
Command line interface to a user's defaults.
Syntax:
'defaults' [-currentHost | -host <hostname>] followed by one of the following:
read shows all defaults
read <domain> shows defaults for given domain
read <domain> <key> shows defaults for given domain, key
read-type <domain> <key> shows the type for the given domain, key
write <domain> <domain_rep> writes domain (overwrites existing)
write <domain> <key> <value> writes key for domain
rename <domain> <old_key> <new_key> renames old_key to new_key
delete <domain> deletes domain
delete <domain> <key> deletes key in domain
import <domain> <path to plist> writes the plist at path to domain
import <domain> - writes a plist from stdin to domain
export <domain> <path to plist> saves domain as a binary plist to path
export <domain> - writes domain as an xml plist to stdout
domains lists all domains
find <word> lists all entries containing word
help print this help
<domain> is ( <domain_name> | -app <application_name> | -globalDomain )
or a path to a file omitting the '.plist' extension
<value> is one of:
<value_rep>
-string <string_value>
-data <hex_digits>
-int[eger] <integer_value>
-float <floating-point_value>
-bool[ean] (true | false | yes | no)
-date <date_rep>
-array <value1> <value2> ...
-array-add <value1> <value2> ...
-dict <key1> <value1> <key2> <value2> ...
-dict-add <key1> <value1> ...
If I run the above script defaults delete com.apple.dock; killall Dock manually in terminal it works fine and resets all the docks settings.
Other information
The application is an agent as I am making it as a status/menu bar
application
I am running Mac OS 10.15.4 Catalina
I also tried
running defaults write com.apple.dock persistent-apps -array-add
'{"tile-type"="spacer-tile";}'; killall Dock which again worked in
terminal but not when run from the app.
I have also tried to put those commands into a file inside the Xcode project such as spacer.command and then changing the let arguments = ["defaults delete com.apple.dock; killall Dock"] line to let arguments = ["spacer.command"]. However it produces the same result.
My problem is that instead of running the full command, the swift code just seems to run the first word defaults because if you do that in terminal you get the same result. Why would it be doing this; and does anyone know how to fix it?
If you are trying to call multiple commands then you want to call the shell, not the defaults command directly.
Also:
Separate-out each argument into a separate word in the array.
I would probably use && to invoke multiple commands.
Something like:
let path = "/bin/sh"
let arguments = ["/usr/bin/defaults", "delete", "com.apple.dock", "&&", "killall", "Dock"]
let task = Process.launchedProcess(launchPath: path, arguments: arguments)
task.waitUntilExit()
Alternatively call each command (defaults and killall) separarely.
Thanks to everyone for the help. I solved it by putting the shell command into a file in the project directory and then calling this code to run it...
let compiler = "/bin/sh"
let filePath = Bundle.main.url(forResource: "scriptName", withExtension: "sh")
let file = filePath!.path
let arguments = [file]
let task = Process.launchedProcess(launchPath: compiler, arguments: arguments)
task.waitUntilExit()

How can I hide skipped tasks output in Ansible

I have Ansible role, for example
---
- name: Deploy app1
include: deploy-app1.yml
when: 'deploy_project == "{{app1}}"'
- name: Deploy app2
include: deploy-app2.yml
when: 'deploy_project == "{{app2}}"'
But I deploy only one app in one role call. When I deploy several apps, I call role several times. But every time there is a lot of skipped tasks output (from tasks which do not pass condition), which I do not want to see. How can I avoid it?
I'm assuming you don't want to see the skipped tasks in the output while running Ansible.
Set this to false in the ansible.cfg file.
display_skipped_hosts = false
Note. It will still output the name of the task although it will not display "skipped" anymore.
UPDATE: by the way you need to make sure ansible.cfg is in the current working directory.
Taken from the ansible.cfg file.
ansible will read ANSIBLE_CONFIG,
ansible.cfg in the current working directory, .ansible.cfg in
the home directory or /etc/ansible/ansible.cfg, whichever it
finds first.
So ensure you are setting display_skipped_hosts = false in the right ansible.cfg file.
Let me know how you go
Since ansible 2.4, a callback plugin name full_skip was added to suppress the skipping of task names and skipping keyword in the ansible output. You can try the below ansible configuration:
[defaults]
stdout_callback = full_skip
Ansible allows you to control its output by using custom callbacks.
In this case you can simply use the skippy callback which will not output anything on a skipped task.
That said, skippy is now deprecated and will be removed in ansible v2.11.
If you don't mind losing colours you can elide the skipped tasks by piping the output through sed:
ansible-playbook whatever.yml | sed -nr '/^TASK/{h;n;/^skipping:/{n;b};H;x};p'
If you are using roles, you can use when to cancel the include in main.yml
# roles/myrole/tasks/main.yml
- include: somefile.yml
when: somevar is defined
# roles/myrole/tasks/somefile.yml
- name: this task will only run (and be seen in the output) if somevar is defined
debug:
msg: "Hello World"

Use AppCmd to LIST CONFIG in APPHOST only

I have a requirement to use powershell to configure IIS7.5 on WebApplications that have not yet had code deployed (possibly at all, possibly old/broken web.configs exist) to the file system. I would like to be able to do this all at the APPHOST level. (Note at the bottom about use of Powershell > AppCmd).
I can SET all the values properly, however, being somewhat diligent, I like to also validate the values were set properly by retrieving them after setting.
Here's the scenario:
I can set this value using AppCmd so the setting is applied at the APPHOST level using the /Commit:APPHOST flag. However, I havent found a way to READ the values exclusively at the APPHOST level.
Setting the Code is successful:
C:\Windows\System32\inetsrv\appcmd.exe set config "webSiteName/webAppName" -section:system.webServer/security/authentication/anonymousAuthentication /enabled:"True" /commit:apphost
However, I cant find a way to read the values using AppCmd (or Powershell):
Running the following AppCmd returns an error due to the broken pre-existing web.config in the folder (the specific error is unimportant, as it is reading the WebApp's web.config instead of the ApplicationHost.config/APPHOST):
C:\Windows\System32\inetsrv\appcmd.exe list config "MACHINE/WEBROOT/APPHOST/webSiteName/webAppName" -section:system.webServer/security/authentication/anonymousAuthentication
ERROR ( message:Configuration error
Filename: \\?\c:\inetpub\wwwroot\webSiteName\webAppName\web.config
Line Number: 254
Description: The configuration section 'system.runtime.caching' cannot be read because it is missing a section declaration
. )
Note: I would prefer to do this all in Powershell instead of using AppCmd, so if anyone has the syntax for modifying the APPHOST settings for anonymousAuthentication section of a WebApplication, that lives under a Website, from inside Powershell (Get-WebConfiguration seems to only use the WebApp web.config), that would be totally awesome and much appreciated!
Here's how to do this in PowerShell:
[Reflection.Assembly]::Load(
"Microsoft.Web.Administration, Version=7.0.0.0,
Culture=Neutral, PublicKeyToken=31bf3856ad364e35") > $null
$serverManager = New-Object Microsoft.Web.Administration.ServerManager
$config = $serverManager.GetApplicationHostConfiguration()
$anonymousAuthenticationSection = $config.GetSection("system.webServer/security/authentication/anonymousAuthentication", "simpleasp.net")
Write-Host "Current value: " $anonymousAuthenticationSection["enabled"]
# Now set new value
$anonymousAuthenticationSection["enabled"] = $true
$serverManager.CommitChanges()