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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
Imldeployment
Commits
12115f73
Commit
12115f73
authored
6 years ago
by
hahn
Browse files
Options
Downloads
Patches
Plain Diff
task-2494 ... show templates of current project only
parent
e9f801df
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
public_html/deployment/classes/config-replacement.class.php
+23
-14
23 additions, 14 deletions
public_html/deployment/classes/config-replacement.class.php
with
23 additions
and
14 deletions
public_html/deployment/classes/config-replacement.class.php
+
23
−
14
View file @
12115f73
...
@@ -101,6 +101,10 @@ class configreplacement {
...
@@ -101,6 +101,10 @@ class configreplacement {
*/
*/
protected
function
_getForemanReplacement
(){
protected
function
_getForemanReplacement
(){
global
$aConfig
;
global
$aConfig
;
$sProject
=
$this
->
_oProject
->
getId
();
// echo "DEBUG: project id = $sProject<br>";
if
(
!
$this
->
_sPhase
){
if
(
!
$this
->
_sPhase
){
return
false
;
return
false
;
}
}
...
@@ -111,12 +115,12 @@ class configreplacement {
...
@@ -111,12 +115,12 @@ class configreplacement {
}
}
// return already cached result
// return already cached result
if
(
array_key_exists
(
$
this
->
_sPhase
,
$this
->
_aForemanReplacements
)){
if
(
array_key_exists
(
$
sProject
,
$this
->
_aForemanReplacements
)){
return
$this
->
_aForemanReplacements
[
$
this
->
_sPhase
];
return
$this
->
_aForemanReplacements
[
$
sProject
];
}
}
// rebuilt
// rebuilt
$this
->
_aForemanReplacements
[
$
this
->
_sPhase
]
=
false
;
$this
->
_aForemanReplacements
[
$
sProject
]
=
false
;
$iEffectiveHostgroup
=
$this
->
getForemanHostgroup
();
$iEffectiveHostgroup
=
$this
->
getForemanHostgroup
();
// abort if no hostgroup was set
// abort if no hostgroup was set
...
@@ -204,8 +208,12 @@ class configreplacement {
...
@@ -204,8 +208,12 @@ class configreplacement {
$aYaml
=
spyc_load
(
$sPart
);
$aYaml
=
spyc_load
(
$sPart
);
// echo 'DEBUG: <pre>'.print_r($aYaml, 1).'</pre>';
// echo 'DEBUG: <pre>'.print_r($aYaml, 1).'</pre>';
if
(
!
isset
(
$aYaml
[
$sProject
])){
return
false
;
}
foreach
(
$aYaml
as
$sPrjId
=>
$aProject
){
$aReturn
=
array
();
$aReturn
=
array
();
foreach
(
$aYaml
as
$aProject
){
foreach
(
$aProject
as
$sFile
=>
$aParams
){
foreach
(
$aProject
as
$sFile
=>
$aParams
){
$aReturn
[
$sFile
]
=
array
();
$aReturn
[
$sFile
]
=
array
();
if
(
array_key_exists
(
'target'
,
$aParams
)){
if
(
array_key_exists
(
'target'
,
$aParams
)){
...
@@ -222,9 +230,8 @@ class configreplacement {
...
@@ -222,9 +230,8 @@ class configreplacement {
}
}
}
}
}
}
}
$this
->
_aForemanReplacements
[
$sPrjId
]
=
array
(
'phase'
=>
$this
->
_sPhase
,
$this
->
_aForemanReplacements
[
$this
->
_sPhase
]
=
array
(
'rules'
=>
$aReturn
,
'rules'
=>
$aReturn
,
'host'
=>
$sHost
,
'host'
=>
$sHost
,
'yaml'
=>
$sPart
,
'yaml'
=>
$sPart
,
...
@@ -232,7 +239,9 @@ class configreplacement {
...
@@ -232,7 +239,9 @@ class configreplacement {
'hostsall'
=>
$aHosts
,
'hostsall'
=>
$aHosts
,
'hostsphase'
=>
$aHostsOfPhase
,
'hostsphase'
=>
$aHostsOfPhase
,
);
);
return
$this
->
_aForemanReplacements
[
$this
->
_sPhase
];
}
return
$this
->
_aForemanReplacements
[
$sProject
];
}
}
/**
/**
...
...
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