Server Automation Practitioners Forum
Showing results for 
Search instead for 
Do you mean 

SA CLI Scripting Question - creating a new Audit

Valued Contributor

SA CLI Scripting Question - creating a new Audit

I'm having an issue getting a simple CLI script to work creating a bogus test Audit. When I run this script I get the following error:

Struct parse error: Attribute name expected

I finally got through the API specification doc to at least understand where the fields are coming from class wise. I can't figure out what the error above means though.

Is there is way of running commands and the output tells where and what you're missing in relation to a VO argument ?

The following is the script:

#!/bin/bash
cd /opsw/api/com/opsware/compliance/sco/AuditTaskService/method

./create vo='{
description="Test Audit - API Created"
name="debug_test_api"
targets="server.onmynetwork.com"
platformPolicyType="UNIX"
policy={
lastSource=
type="UNIX"
scObjectPolicy={
rules={
policyType="POLICY"
description="tmp contents"
displayName="tmp contents"
policyComparisonDefinition={
notModifier=true
argsType="STRING"
values={
value=
source=0
resolvedValue=
}
caseIgnore=false
operator="CONT"
}
disabled=false
remediteArgs=

scriptType="SH"
script="ls /tmp; exit 0"
ignoreNonZeroExitCode=false
}
}
}
}'

exit 0
4 REPLIES
Occasional Contributor

Re: SA CLI Scripting Question - creating a new Audit

Hey RiverRat, did you ever figure this one out? I am trying to do the same thing.
Valued Contributor

Re: SA CLI Scripting Question - creating a new Audit

Hey,

No not yet. Apparently the scObjectPolicy object is read-only and you can't update it ... go figure.

I haven't touched this topic in a a bit but an idea I have is looking at how Audit Policies with CMDOUTPUT scripts applied to them could possibly be used here. Maybe defined the Audit Policy via the GUI and then use a script to "link" the Audit Policy into a new Audit.

Or even look at how to create an Audit Policy via the CLI and then link it.

Granted this isn't created an audit from scratch with a rule defined within the audit itself via the CLI but it's better than nothing. I haven't tried this yet but plan to once I get a few things off my plate.

Occasional Contributor

Re: SA CLI Scripting Question - creating a new Audit

The thing I *really* want to do is to automatically set rule associations in app configs. Going in manually to assign rules is killing me. I hope to do this either through the create method or the update method, but I am having problems with each.
Valued Contributor

Re: SA CLI Scripting Question - creating a new Audit

Yeah, app config rules is another area I share you're pain in and another area I would love to be able to script.