I am trying to error handle in ansible for http status code. My use case is to check for status code 400(fail code) and it needs to pass for 2 known error conditions.
Like if content has particular search strings in 400 response.
Sample task:
-name: create repo
uri:
url:
method: POST
body_format:json
.
.
status_code:
- 201
- 400
register: value
changed_when: value.status == 201
failed_when: value.status == 400 and
value.content|default() is not search ("found duplicate value")
Above is working but
Expecting another search string with or condition to the same and 400 like.
-name: create repo
uri:
url:
method: POST
body_format:json
.
.
status_code:
- 201
- 400
register: value
changed_when: value.status == 201
failed_when: value.status == 400 and
( value.content|default() is not search ("found 1st duplicate value") or value.content|default() is not search ("found 2nd duplicate value") )
How to handle either condition 2 or's with the 'and'..
i think you have parenthesis problem and you have to add simple quote:
try:
failed_when: (value.status == 400) and
'(value.content|default() is not search ("found 1st duplicate value") or value.content|default() is not search ("found 2nd duplicate value"))'
Related
This my data coming from Api : "TAX_BREAKUP": "ab=4835,ay=1400,at=852,cb=4835,cy=1400,ct=852"
#foreach(explode(',', $data['TAX_BREAKUP']) as $amt)
Adult Price₹ {{$amt}}
Tax{{$amt}}
#endforeach
An this is code which I am trying to break the string.
If I understand your question, what you want is :
$Tax_arr = explode(',', $data['TAX_BREAKUP']);
foreach($Tax_arr as $amt){
$amt_arr = explode('=', $amt);
echo $amt_arr[0]." is ".$amt_arr[1]."<br>";
}
$amt_arr[0] is the attribute name and $amt_arr[1] is the value
I have a <a> tag in my vue component & by checking some condition v-bind:href may differ. I have used ternary operator for it and in the else part I want to pass id with the url, but with not as part of url (like '/test/' +id). id should not be in the url. so how to do it?
This is how I tried for it & it giving me the compile error due to comma before id in else part,
<a v-bind:href="type === 'single' ? '/user/'+user.id+'/edit' : '/profile',user.id">
Url should be like "/profile"
I have resolved it as follows,
<a v-bind:href="type === 'single' ? '/user/'+user.id+'/edit' : '/profile?user_id='+user.id">
{
"address" : <address>
}
Examples:
| address |
| 00247 |
And match $.address == <address>
I have above case where I need to pass 'address' attribute as integer and not a string.
But script passes it as 247 and not 00247.
actual: '247', expected: '00247', reason: not equal
Your help would be appreciated. Thank you!
Covered in the docs: https://github.com/intuit/karate#scenario-outline-enhancements
Make this change:
Scenario Outline:
* def body = { address: '#(address)' }
* And match $.address == address
Examples:
| address! |
| 00247 |
I can't access the product catalog page or edit any products after upgrading from 1.7.3.1 to 1.7.6.1
It gives me two fatal php errors.
The first exception: Twig\Error\RuntimeError
in src/PrestaShopBundle/Resources/views/Admin/layout.html.twig (line 34)
layoutHeaderToolbarBtn is defined ? layoutHeaderToolbarBtn : [],
layoutDisplayType is defined ? layoutDisplayType : '',
showContentHeader is defined ? showContentHeader : true,
headerTabContent is defined ? headerTabContent : '',
enableSidebar is defined ? enableSidebar : false,
Line 34 help_link is defined ? help_link : ''
)
)) %}
{% import '#PrestaShop/Admin/macros.html.twig' as ps %}
The second exception: Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException
in vendor/symfony/symfony/src/Symfony/Component/DependencyInjection/Container.php (line 348)
if ($lev <= \strlen($id) / 3 || false !== strpos($knownId, $id)) {
$alternatives[] = $knownId;
}
}
throw new ServiceNotFoundException($id, null, null, $alternatives);
}[enter image description here][1]
}
/**
* Returns true if the given service has actually been initialized.
Cross posted here https://www.prestashop.com/forums/topic/1003821-catalog-product-page-gives-error-500-after-upgrade-from-173-to-176/
Error screenshot
Turns out, that the related products module was not updated. It's a module bought on the Marketplace. I checked the compatibility and it said it was compatible with 1.7.6.1, so for that reason, combined with my backoffice telling me i had 0 available updates and that the module was up to date, i assumed it was all good.
But apparently, modules bought on the marketplace, don't have their updates show up in prestashop.
I fixed the issue, by uninstalling the related products module and downloading the newest one 1.6.4 instead of 1.6.3 from the prestashop marketplace.
I have an unordered list, from which I need to get the title from each element.
li class="chart-flyout-option" ng-repeat="option in filteredOptions = ($ctrl.options | filter: { value: $ctrl.filterText })" ng-class="{'chart-flyout-option-selected': option.key == $ctrl.selectedOption.key}"><a class="chart-flyout-link" ng-bind-html="option.value | highlight:$ctrl.filterText" title="HERE IS TITLE 1" ng-click="$ctrl.select(option.key, $event)" data-key="126">HERE IS TITLE 1</a></li>
Next element would be similar, but assume - HERE IS TITLE 2
I have a for loop, which looks like this:
Get Flyout Entry Child Links
${numflyoutentries}= Get Number Chart Flyout Entries
${numflyoutentries}= Evaluate ${numflyoutentries} + ${1}
: FOR ${entry} IN RANGE 1 ${numflyoutentries}
\ ${label}= Get Text class:chart-flyout-link
\ Log ${label}
However this only ever returns the text "HERE IS TITLE 1".
Why doesn't my selector increment?