API action creation not-relevant [SOLVED]

Hello,
I’m doing a workflow with javascript that pulls all relevant fixlets and then creates xml to deploy all those fixlets to an endpoint. the action submits without issue, but the action is always not-relevant even though the action contains missing updates. here is the xml i am uploading to create the action:

<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
	<MultipleActionGroup>
	    <Title>Multiple Action Group</Title>
	    <Relevance>true</Relevance>
	    <MemberAction>
		<Title>MS18-NOV: Servicing stack update for Windows Server 2016 - Windows Server 2016 - KB4465659 (x64)</Title>
		<Relevance><![CDATA[((((((((if( name of operating system starts with "Win" ) then platform id of operating system != 3 else false) AND (if exists property "in proxy agent context" then ( not in proxy agent context ) else true )) AND (x64 of operating system)) AND (not ia64 of operating system)) AND (((it starts with "Win20") of name of it AND (exists value "CurrentMajorVersionNumber" of it AND value "CurrentMajorVersionNumber" of it as integer = 10) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry) of operating system)) AND ((name of it = "Win2016" OR name of it starts with "Win20" AND (exists value "CurrentMajorVersionNumber" of it AND value "CurrentMajorVersionNumber" of it as integer = 10) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry) of operating system)) AND (exists keys ("Package_for_KB4132216~31bf3856ad364e35~amd64~~10.0.1.0") whose ((it = 6 OR it = 7 OR it = 96 OR it = 112) of (value "CurrentState" of it as in				teger)) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages" of native registry AND not exists key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\Package_for_KB4465659~31bf3856ad364e35~amd64~~10.0.1.2" whose (value "CurrentState" of it = 112 or value "CurrentState" of it = 80) of native registry)) AND (exists value "ReleaseID" whose (it as string = "1607") of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry)) AND (not pending restart "af8e00c5ba5117880cbc346278c7742a6efa6db1")]]></Relevance>
		<ActionScript MIMEType="application/x-Fixlet-Windows-Shell">prefetch windows10.0-kb4465659-x64_af8e00c5ba5117880cbc346278c7742a6efa6db1.msu sha1:af8e00c5ba5117880cbc346278c7742a6efa6db1 size:12141800 http://download.windowsupdate.com/d/msdownload/update/software/secu/2018/11/windows10.0-kb4465659-x64_af8e00c5ba5117880cbc346278c7742a6efa6db1.msu sha256:9707da073612e9d169cf3d47cf26cbd083e63b909d86a5f2557424202188d6f3

			// Is Windows Update service running?
			continue if {exists running service "wuauserv" OR NOT exists service "wuauserv" whose (start type of it = "disabled")}

			waithidden "{pathname of system folder &amp; "\wusa.exe"}" "{pathname of client folder of current site &amp; "\__Download\windows10.0-kb4465659-x64_af8e00c5ba5117880cbc346278c7742a6efa6db1.msu"}" /quiet /norestart

			action requires restart "af8e00c5ba5117880cbc346278c7742a6efa6db1"</ActionScript>
		<SuccessCriteria Option="OriginalRelevance"></SuccessCriteria>
		<IncludeInGroupRelevance>true</IncludeInGroupRelevance>
	    </MemberAction>
	    <MemberAction>
			<Title>MS18-NOV: Cumulative Update for Windows Server 2016 - Windows Server 2016 - KB4467691 (x64)</Title>
			<Relevance><![CDATA[(((((((((if( name of operating system starts with "Win" ) then platform id of operating system != 3 else false) AND (if exists property "in proxy agent context" then ( not in proxy agent context ) else true )) AND (x64 of operating system)) AND (not ia64 of operating system)) AND (((it starts with "Win20") of name of it AND (exists value "CurrentMajorVersionNumber" of it AND value "CurrentMajorVersionNumber" of it as integer = 10) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry) of operating system)) AND ((name of it = "Win2016" OR name of it starts with "Win20" AND (exists value "CurrentMajorVersionNumber" of it AND value "CurrentMajorVersionNumber" of it as integer = 10) of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry) of operating system)) AND (exists value "ReleaseID" whose (it as string = "1607") of key "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry)) AND ((				it as integer < 2608) of value "UBR" of key "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry)) AND ((it as integer != 2551) of value "UBR" of key "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" of native registry OR exists setting "_BESClient_WindowsOS_ApplyCumulativeUpdateOnly" whose (value of it as integer = 1) of client)) AND (not pending restart "c1884b8c61fd7837b4a59a3aa7b87707474a8c12")]]></Relevance>
			<ActionScript MIMEType="application/x-Fixlet-Windows-Shell">prefetch windows10.0-kb4467691-x64_c1884b8c61fd7837b4a59a3aa7b87707474a8c12.msu sha1:c1884b8c61fd7837b4a59a3aa7b87707474a8c12 size:1445835954 http://download.windowsupdate.com/d/msdownload/update/software/secu/2018/10/windows10.0-kb4467691-x64_c1884b8c61fd7837b4a59a3aa7b87707474a8c12.msu sha256:463fffc64f460146d9e6adf1a8b1e24214566b45d2646f8f47be7b063a6344e7

				// Is Windows Update service running?
				continue if {exists running service "wuauserv" OR NOT exists service "wuauserv" whose (start type of it = "disabled")}

				waithidden "{pathname of system folder &amp; "\wusa.exe"}" "{pathname of client folder of current site &amp; "\__Download\windows10.0-kb4467691-x64_c1884b8c61fd7837b4a59a3aa7b87707474a8c12.msu"}" /quiet /norestart

				action requires restart "c1884b8c61fd7837b4a59a3aa7b87707474a8c12"
			</ActionScript>
			<SuccessCriteria Option="OriginalRelevance"></SuccessCriteria>
			<IncludeInGroupRelevance>true</IncludeInGroupRelevance>
	    </MemberAction>
	    <Settings>
			<PreActionShowUI>false</PreActionShowUI>
			<HasRunningMessage>false</HasRunningMessage>
			<HasTimeRange>false</HasTimeRange>
			<HasStartTime>true</HasStartTime>
			<StartDateTimeLocalOffset>P2DT5H38M5S</StartDateTimeLocalOffset>
			<HasEndTime>true</HasEndTime>
			<EndDateTimeLocalOffset>P14DT22H1M</EndDateTimeLocalOffset>
			<HasDayOfWeekConstraint>false</HasDayOfWeekConstraint>
			<UseUTCTime>false</UseUTCTime>
			<ActiveUserRequirement>NoRequirement</ActiveUserRequirement>
			<ActiveUserType>AllUsers</ActiveUserType>
			<HasWhose>false</HasWhose>
			<PreActionCacheDownload>false</PreActionCacheDownload>
			<Reapply>false</Reapply>
			<HasReapplyLimit>true</HasReapplyLimit>
			<ReapplyLimit>3</ReapplyLimit>
			<HasReapplyInterval>false</HasReapplyInterval>
			<HasRetry>false</HasRetry>
			<HasTemporalDistribution>false</HasTemporalDistribution>
			<ContinueOnErrors>true</ContinueOnErrors>
			<PostActionBehavior Behavior="Restart">
			<AllowCancel>false</AllowCancel>
			<PostActionDeadlineBehavior>RunAutomatically</PostActionDeadlineBehavior>
			<PostActionDeadlineInterval>PT1M</PostActionDeadlineInterval>
			<Title>Restart Now</Title>
			<Text>Your system administrator is requesting that you restart your computer.  Please save any unsaved work and then take this action to restart your computer.</Text>
			</PostActionBehavior>
			<IsOffer>false</IsOffer>
		</Settings>
		<SettingsLocks>
			<ActionUITitle>false</ActionUITitle>
			<PreActionShowUI>false</PreActionShowUI>
			<PreAction>
				<Text>false</Text>
				<AskToSaveWork>false</AskToSaveWork>
				<ShowActionButton>false</ShowActionButton>
				<ShowCancelButton>false</ShowCancelButton>
				<DeadlineBehavior>false</DeadlineBehavior>
				<ShowConfirmation>false</ShowConfirmation>
			</PreAction>
			<HasRunningMessage>false</HasRunningMessage>
			<RunningMessage>
				<Text>false</Text>
			</RunningMessage>
			<TimeRange>false</TimeRange>
			<StartDateTimeOffset>false</StartDateTimeOffset>
			<EndDateTimeOffset>false</EndDateTimeOffset>
			<DayOfWeekConstraint>false</DayOfWeekConstraint>
			<ActiveUserRequirement>false</ActiveUserRequirement>
			<ActiveUserType>false</ActiveUserType>
			<Whose>false</Whose>
			<PreActionCacheDownload>false</PreActionCacheDownload>
			<Reapply>false</Reapply>
			<ReapplyLimit>false</ReapplyLimit>
			<RetryCount>false</RetryCount>
			<RetryWait>false</RetryWait>
			<TemporalDistribution>false</TemporalDistribution>
			<ContinueOnErrors>false</ContinueOnErrors>
			<PostActionBehavior>
				<Behavior>false</Behavior>
				<AllowCancel>false</AllowCancel>
				<Deadline>false</Deadline>
				<Title>false</Title>
				<Text>false</Text>
			</PostActionBehavior>
			<IsOffer>false</IsOffer>
			<AnnounceOffer>false</AnnounceOffer>
			<OfferCategory>false</OfferCategory>
			<OfferDescriptionHTML>false</OfferDescriptionHTML>
		</SettingsLocks>
		<Target>
			<ComputerName>MYCOMPUTER</ComputerName>
		</Target>
	</MultipleActionGroup>
</BES>

any help would be greatly appreciated!

thanks,
Raul

I edited your post to put <code> tags on the XML. Then I copied the relevance for the first component into the debugger and got an error The operator "in teger" is not defined.

This might have just been a copy/paste issue, but I’d try the same method on your original XML - copy each Relevance piece into the debugger and see whether any of them give an error rather than a true/false result. I’ve found that if any component of a Baseline evaluates to an error, the baseline as a whole is marked Non-Relevant.

thank you @JasonWalker and I think i have more info. i think it’s a special character thing. i have to escape special characters for the xml package to be accepted, but looks like they aren’t converting back once they are received by bigfix:

(((((version of client **_&gt;_**THIS IS COMING ACROOS AS LG; = "8.2") AND (name of operating system starts with "Linux Red Hat") AND ((it = "x86_64") of architecture of operating system) AND (exists file "/etc/redhat-release" whose (exists line whose (exists match (regex "Red Hat Enterprise Linux (Client|Server|Workstation) release 7") of it) of it) AND NOT exists file "/etc/vmware-release" whose (exists line whose (it contains "VMware ESX") of it) AND NOT exists file "/etc/enterprise-release" whose (exists line whose (it contains "Enterprise Linux Enterprise Linux") of it)) AND (if exists property "in proxy agent context" then (not in proxy agent context) else true) AND (if exists property "android" of type "operating system" then (not android of operating system) else true)) AND ((architecture of operating system = "x86_64"))) AND (((exists package "bpftool" whose (rpm version record of it &lt; rpm package version record "3.10.0-957.1.3.el7" AND architecture of it = "x86_64") of it AND (not exists package "bpftool" whose (rpm version record of it **_&gt;_**= rpm package version record "3.10.0-957.1.3.el7" AND architecture of it = "x86_64") of it))

At what level are you escaping characters? I’d expect that the <[[CDATA tag is also doing some special handling, so if you are doing the escapes yourself in-script that could be a special case.

I’ve only used RESTAPI in a limited fashion, from curl and from the Insomnia client. With curl it’s easier to keep the XML in an external file, no URL-encoding, and let curl itself handle that part. With Insomnia there’s a separate tab to store the XML content, again with no special encoding needed.

Remember that anything other than ASCII in relevance must be in your FXF Encoding. While relevance is processed in UNICODE, the FXF files deliver the relevance in FXF encoding and it is transcoded to UTF8 internally.

Also depending on how you construct the fixlet, if you are using the REST api the encoding of the file must be the right encoding coming in. The XML file specifies the encoding on its header usually

In another forum we discussed using SourcedFixletAction rather than including the relevance and actionscript from your source. Here’s my sample XML of an action for a Baseline

<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<SourcedFixletAction SkipUI="false">
<SourceFixlet>
<Sitename>MY_CUSTOM_SITE</Sitename>
<FixletID>16931044</FixletID> <!-- id of a baseline -->
<Action>Action1</Action> <!-- for a Baseline it's always Action1, could vary for a single Fixlet -->
</SourceFixlet>
<Target><CustomRelevance>member of group 771099 of site "CustomSite_MY_CUSTOM_SITE"</CustomRelevance></Target>
<Settings> 
 <ActionUITitle>Title of UI window shown to user </ActionUITitle>
<PreActionShowUI>false</PreActionShowUI>
<HasRunningMessage>true</HasRunningMessage>
<RunningMessage>
<Text>System Updates are being installed by BigFix.  For a list of updates, reference the Workplan.  A reboot may be required when the updates are completed.</Text>
</RunningMessage>
<HasTimeRange>false</HasTimeRange>
<HasStartTime>false</HasStartTime>
<HasEndTime>false</HasEndTime>
<HasDayOfWeekConstraint>false</HasDayOfWeekConstraint>
<UseUTCTime>false</UseUTCTime>
<ActiveUserRequirement>NoRequirement</ActiveUserRequirement>
<ActiveUserType>AllUsers</ActiveUserType>
<HasWhose>false</HasWhose> 
<PreActionCacheDownload>true</PreActionCacheDownload>
<Reapply>true</Reapply>
<HasReapplyLimit>true</HasReapplyLimit>
<ReapplyLimit>2</ReapplyLimit>
<HasReapplyInterval>false</HasReapplyInterval>
<HasRetry>true</HasRetry>
<RetryCount>2</RetryCount>
<RetryWait Behavior="WaitForReboot">PT1H</RetryWait>
<HasTemporalDistribution>false</HasTemporalDistribution>
<ContinueOnErrors>true</ContinueOnErrors>
<PostActionBehavior Behavior="Nothing"></PostActionBehavior>
<IsOffer>false</IsOffer>

</Settings>
<Title> Name Of Action as viewed in Console </Title>
</SourcedFixletAction>

</BES>

Thanks @JasonWalker and @AlanM for all the input, I found the issue but have ran into 1 more little dilemma. I have to target the endpoints dynamically due to some of the endpoints having the fqdn for computer name in bigfix, but the systems aren’t picking up the actions. here is the code i have for my target node:

<Target>
<CustomRelevance>(exists true whose (if true then (exists (if exists computer name whose (it as string contains ".") then preceding text of first "." of computer name as string as lowercase else computer name as lowercase) whose (it as string as lowercase = "SERVERNAME" as lowercase)) else false))</CustomRelevance>
</Target>

this is the last thing i need to resolve and then i will be out of everyones hair!

thanks!

Not a problem at all, glad we can help. I always like to see people leatning new things, and you can unlock a lot of power in API and dashboarding.

Does that relevance statement work by itself (I don’t have a debugger handy but don’t see anything obviously wrong with it)?

If the targetting relevance is correct, then there are a few other things that can happen…
Does the API user account have rights to the target computer?
Did you switch over to SourcedFixletAction? Is the computer relevant to the source fixlet? Is the source fixlet’s site subscribed by the client?

Sorry I went radio slient on this. to make sure our workflows work properly I added an API call prior to the this current workflow to ask bigfix for the computer name given a specific string. it’s working like a champ now and I think this is the safer route to go for now. I plan to try the SourcedFixletAction as it keeps the xml packages smaller and looks cleaner so that is on the ‘to do’ list. Thank you everyone for your assistance on this.

2 Likes