Fix grains in case python-jenkins not installed
Change-Id: I83b9f6f51cfdd774ce2710edcebc33adea66dc73
diff --git a/_grains/jenkins_plugins.py b/_grains/jenkins_plugins.py
index c13cb8b..e0743d1 100644
--- a/_grains/jenkins_plugins.py
+++ b/_grains/jenkins_plugins.py
@@ -1,9 +1,16 @@
#!/usr/bin/env python
-import jenkins
+try:
+ import jenkins
+ HAS_JENKINS = True
+except ImportError:
+ HAS_JENKINS = False
import salt.config
def main():
+ if not HAS_JENKINS:
+ return {}
+
output = { "jenkins_plugins" : {} }
opts = salt.config.minion_config('/etc/salt/minion')
user = opts['jenkins']['user']