Skip to content
Snippets Groups Projects
Commit c4463690 authored by hahn's avatar hahn
Browse files

task 5038 - fix awx item count per api request (default is 25)

parent 20e368d9
No related branches found
No related tags found
1 merge request!15task 5038 - fix awx item count per api request (default is 25)
This commit is part of merge request !15. Comments created here will be created in the context of that merge request.
......@@ -10,6 +10,9 @@
*/
class rollout_awx extends rollout_base {
// url part for AWX API request to set count of results per page
protected $_sAwxApiPaging='&page_size=10000&page=1';
/**
* check requirements if the plugin could work
*/
......@@ -86,7 +89,7 @@ class rollout_awx extends rollout_base {
*/
static public function getAwxInventories(){
$aResponse=$this->_httpRequest(array(
'url'=>'/inventories/?order_by=name',
'url'=>'/inventories/?order_by=name'.$this->_sAwxApiPaging,
'method'=>'GET',
)
);
......@@ -96,7 +99,20 @@ class rollout_awx extends rollout_base {
}
$aData=json_decode($aResponse['body'], 1);
$aReturn=array();
$aReturn=[];
if (!$aData || !isset($aData['count'])){
$aReturn[]=[
'value'=>false,
'label'=>'!!! Access to awx api failed !!!'
];
return $aReturn;
}
if(count($aData['results']) < $aData['count']){
$aReturn[]=[
'value'=>false,
'label'=>'>>>>>>>>> WARNING: fetched ' . count($aData['results']) . ' of ' .$aData['count'] . ' items only'
];
}
foreach ($aData['results'] as $aItem){
$aReturn[$aItem['id']]= [
......@@ -114,7 +130,7 @@ class rollout_awx extends rollout_base {
*/
static public function getAwxJobTemplates(){
$aResponse=$this->_httpRequest(array(
'url'=>'/job_templates/?order_by=name',
'url'=>'/job_templates/?order_by=name'.$this->_sAwxApiPaging,
'method'=>'GET',
)
);
......@@ -124,8 +140,20 @@ class rollout_awx extends rollout_base {
}
$aData=json_decode($aResponse['body'], 1);
$aReturn=array();
$aReturn=[];
if (!$aData || !isset($aData['count'])){
$aReturn[]=[
'value'=>false,
'label'=>'!!! Access to awx api failed !!!'
];
return $aReturn;
}
if(count($aData['results']) < $aData['count']){
$aReturn[]=[
'value'=>false,
'label'=>'>>>>>>>>> WARNING: fetched ' . count($aData['results']) . ' of ' .$aData['count'] . ' items only'
];
}
foreach ($aData['results'] as $aItem){
$aReturn[$aItem['id']]= [
'value'=>$aItem['id'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment