Fix script approvals from client side
Change-Id: I219d4bc058af9cf8dd66358ffc8d416e970192f1
diff --git a/_states/jenkins_approval.py b/_states/jenkins_approval.py
index 63df775..f5263fb 100644
--- a/_states/jenkins_approval.py
+++ b/_states/jenkins_approval.py
@@ -5,16 +5,16 @@
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval
import org.jenkinsci.plugins.scriptsecurity.scripts.languages.GroovyLanguage
import org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext
-def signature = "{signature}"
+def signature = '{signature}'
def scriptApproval = ScriptApproval.get()
def approvedSignatures = Arrays.asList(scriptApproval.approvedSignatures)
if(approvedSignatures.contains(signature)){{
- println("EXISTS")
+ print("EXISTS")
}}else{{
try{{
scriptApproval.pendingSignatures.add(new ScriptApproval.PendingSignature(signature, false, ApprovalContext.create()))
scriptApproval.approveSignature(signature)
- if(approvedSignatures.contains(signature)){{
+ if(Arrays.asList(scriptApproval.approvedSignatures).contains(signature)){{
print("SUCCESS")
}}else{{
print("FAILED")
@@ -29,7 +29,7 @@
import org.jenkinsci.plugins.scriptsecurity.scripts.ScriptApproval
import org.jenkinsci.plugins.scriptsecurity.scripts.languages.GroovyLanguage
import org.jenkinsci.plugins.scriptsecurity.scripts.ApprovalContext
-def signature = "{signature}"
+def signature = '{signature}'
def scriptApproval = ScriptApproval.get()
def approvedSignatures = Arrays.asList(scriptApproval.approvedSignatures)
if(approvedSignatures.contains(signature)){{
diff --git a/jenkins/client/approval.sls b/jenkins/client/approval.sls
index ed09f70..6969807 100644
--- a/jenkins/client/approval.sls
+++ b/jenkins/client/approval.sls
@@ -2,5 +2,5 @@
{% for approval in client.get("approved_scripts",[]) %}
approve_jenkins_signature_{{ approval }}:
jenkins_approval.approved:
- - name: {{ approval) }}
+ - name: {{ approval }}
{% endfor %}
\ No newline at end of file
diff --git a/jenkins/files/jobs/_common.xml b/jenkins/files/jobs/_common.xml
index 7972520..c723b65 100644
--- a/jenkins/files/jobs/_common.xml
+++ b/jenkins/files/jobs/_common.xml
@@ -66,9 +66,9 @@
<onUnstable>{%- if "unstable" in trigger.get('skip_vote',[]) %}true{%- else %}false{%- endif %}</onUnstable>
<onNotBuilt>{%- if "not_built" in trigger.get('skip_vote',[]) %}true{%- else %}false{%- endif %}</onNotBuilt>
</skipVote>
- <silentMode>{{ trigger.get('silent_mode',"false") }}</silentMode>
+ <silentMode>{{ trigger.get('silent_mode', False)|lower }}</silentMode>
<notificationLevel></notificationLevel>
- <silentStartMode>{{ trigger.get('silent_start_mode',"false") }}</silentStartMode>
+ <silentStartMode>{{ trigger.get('silent_start_mode', False)|lower }}</silentStartMode>
<escapeQuotes>true</escapeQuotes>
<nameAndEmailParameterMode>PLAIN</nameAndEmailParameterMode>
<dependencyJobsNames></dependencyJobsNames>