Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Imldeployment
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
c4463690
Commit
c4463690
authored
3 years ago
by
hahn
Browse files
Options
Downloads
Patches
Plain Diff
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
!15
task 5038 - fix awx item count per api request (default is 25)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/deployment/plugins/rollout/awx/rollout_awx.php
+33
-5
33 additions, 5 deletions
public_html/deployment/plugins/rollout/awx/rollout_awx.php
with
33 additions
and
5 deletions
public_html/deployment/plugins/rollout/awx/rollout_awx.php
+
33
−
5
View file @
c4463690
...
@@ -9,6 +9,9 @@
...
@@ -9,6 +9,9 @@
* @author <axel.hahn@iml.unibe.ch>
* @author <axel.hahn@iml.unibe.ch>
*/
*/
class
rollout_awx
extends
rollout_base
{
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
* check requirements if the plugin could work
...
@@ -86,7 +89,7 @@ class rollout_awx extends rollout_base {
...
@@ -86,7 +89,7 @@ class rollout_awx extends rollout_base {
*/
*/
static
public
function
getAwxInventories
(){
static
public
function
getAwxInventories
(){
$aResponse
=
$this
->
_httpRequest
(
array
(
$aResponse
=
$this
->
_httpRequest
(
array
(
'url'
=>
'/inventories/?order_by=name'
,
'url'
=>
'/inventories/?order_by=name'
.
$this
->
_sAwxApiPaging
,
'method'
=>
'GET'
,
'method'
=>
'GET'
,
)
)
);
);
...
@@ -96,7 +99,20 @@ class rollout_awx extends rollout_base {
...
@@ -96,7 +99,20 @@ class rollout_awx extends rollout_base {
}
}
$aData
=
json_decode
(
$aResponse
[
'body'
],
1
);
$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
){
foreach
(
$aData
[
'results'
]
as
$aItem
){
$aReturn
[
$aItem
[
'id'
]]
=
[
$aReturn
[
$aItem
[
'id'
]]
=
[
...
@@ -114,7 +130,7 @@ class rollout_awx extends rollout_base {
...
@@ -114,7 +130,7 @@ class rollout_awx extends rollout_base {
*/
*/
static
public
function
getAwxJobTemplates
(){
static
public
function
getAwxJobTemplates
(){
$aResponse
=
$this
->
_httpRequest
(
array
(
$aResponse
=
$this
->
_httpRequest
(
array
(
'url'
=>
'/job_templates/?order_by=name'
,
'url'
=>
'/job_templates/?order_by=name'
.
$this
->
_sAwxApiPaging
,
'method'
=>
'GET'
,
'method'
=>
'GET'
,
)
)
);
);
...
@@ -124,8 +140,20 @@ class rollout_awx extends rollout_base {
...
@@ -124,8 +140,20 @@ class rollout_awx extends rollout_base {
}
}
$aData
=
json_decode
(
$aResponse
[
'body'
],
1
);
$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
){
foreach
(
$aData
[
'results'
]
as
$aItem
){
$aReturn
[
$aItem
[
'id'
]]
=
[
$aReturn
[
$aItem
[
'id'
]]
=
[
'value'
=>
$aItem
[
'id'
],
'value'
=>
$aItem
[
'id'
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment