summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZuul <zuul@review.opendev.org>2020-01-22 21:27:15 +0000
committerGerrit Code Review <review@openstack.org>2020-01-22 21:27:15 +0000
commit3a7388375a3e7a772fd02a377e62c6986d53b01b (patch)
tree2343c6041da6bb96bacd180f31e1d36ecb9bf63c
parentee706cbdf173b77be4d59318c1a8329c34020c70 (diff)
parentad94757a4a8714b60ed1231ef58310b5a2246b30 (diff)
downloadpython-jenkins-job-builder-3a7388375a3e7a772fd02a377e62c6986d53b01b.tar.gz
python-jenkins-job-builder-3a7388375a3e7a772fd02a377e62c6986d53b01b.tar.xz
python-jenkins-job-builder-3a7388375a3e7a772fd02a377e62c6986d53b01b.zip
Merge "Fix authorization property issue"
-rw-r--r--jenkins_jobs/modules/properties.py2
-rw-r--r--tests/yamlparser/fixtures/project-with-auth-properties.xml23
-rw-r--r--tests/yamlparser/fixtures/project-with-auth-properties.yaml12
3 files changed, 36 insertions, 1 deletions
diff --git a/jenkins_jobs/modules/properties.py b/jenkins_jobs/modules/properties.py
index c225eafb..8ade7506 100644
--- a/jenkins_jobs/modules/properties.py
+++ b/jenkins_jobs/modules/properties.py
@@ -510,7 +510,7 @@ def authorization(registry, xml_parent, data):
"""
# get the folder name if it exists
- in_a_folder = data.pop("_use_folder_perms")
+ in_a_folder = data.pop("_use_folder_perms", None) if data else None
credentials = "com.cloudbees.plugins.credentials.CredentialsProvider."
ownership = "com.synopsys.arc.jenkins.plugins.ownership.OwnershipPlugin."
diff --git a/tests/yamlparser/fixtures/project-with-auth-properties.xml b/tests/yamlparser/fixtures/project-with-auth-properties.xml
new file mode 100644
index 00000000..4d4c1dfb
--- /dev/null
+++ b/tests/yamlparser/fixtures/project-with-auth-properties.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.cloudbees.hudson.plugins.folder.Folder plugin="cloudbees-folder">
+ <icon class="com.cloudbees.hudson.plugins.folder.icons.StockFolderIcon"/>
+ <views/>
+ <viewsTabBar class="hudson.views.DefaultViewsTabBar"/>
+ <primaryView>All</primaryView>
+ <healthMetrics/>
+ <actions/>
+ <description>&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
+ <keepDependencies>false</keepDependencies>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <concurrentBuild>false</concurrentBuild>
+ <canRoam>true</canRoam>
+ <properties>
+ <hudson.security.AuthorizationMatrixProperty>
+ <permission>hudson.model.Item.Build:auser</permission>
+ </hudson.security.AuthorizationMatrixProperty>
+ </properties>
+ <scm class="hudson.scm.NullSCM"/>
+ <publishers/>
+ <buildWrappers/>
+</com.cloudbees.hudson.plugins.folder.Folder>
diff --git a/tests/yamlparser/fixtures/project-with-auth-properties.yaml b/tests/yamlparser/fixtures/project-with-auth-properties.yaml
new file mode 100644
index 00000000..f761d8ce
--- /dev/null
+++ b/tests/yamlparser/fixtures/project-with-auth-properties.yaml
@@ -0,0 +1,12 @@
+- property:
+ name: auth-prop-test
+ properties:
+ - authorization:
+ auser:
+ - job-build
+
+- job:
+ name: auth-job-test
+ project-type: folder
+ properties:
+ - auth-prop-test