Add internal dependencies in state jenkins.client

Change-Id: I1c580cb3e9479a54e000477ecb03737a8bf1e4a6
diff --git a/jenkins/client/_job.sls b/jenkins/client/_job.sls
index 1a8e6df..afb64da 100644
--- a/jenkins/client/_job.sls
+++ b/jenkins/client/_job.sls
@@ -20,6 +20,20 @@
   - config: {{ client.dir.jenkins_jobs_root }}/{{ job_name }}.xml
   - watch:
     - file: jenkins_job_{{ job_name }}_definition
+  - require:
+    - sls: jenkins.client.approval
+    - sls: jenkins.client.artifactory
+    - sls: jenkins.client.credential
+    - sls: jenkins.client.gerrit
+    - sls: jenkins.client.globalenvprop
+    - sls: jenkins.client.jira
+    - sls: jenkins.client.lib
+    - sls: jenkins.client.node
+    - sls: jenkins.client.plugin
+    - sls: jenkins.client.security
+    - sls: jenkins.client.slack
+    - sls: jenkins.client.smtp
+    - sls: jenkins.client.throttle_category
 
 {%- else %}
 
diff --git a/jenkins/client/approval.sls b/jenkins/client/approval.sls
index 6969807..e603444 100644
--- a/jenkins/client/approval.sls
+++ b/jenkins/client/approval.sls
@@ -3,4 +3,6 @@
   approve_jenkins_signature_{{ approval }}:
     jenkins_approval.approved:
       - name: {{ approval }}
-{% endfor %}
\ No newline at end of file
+      - require:
+        - sls: jenkins.client.plugin
+{% endfor %}
diff --git a/jenkins/client/artifactory.sls b/jenkins/client/artifactory.sls
index 7f06e20..64d5645 100644
--- a/jenkins/client/artifactory.sls
+++ b/jenkins/client/artifactory.sls
@@ -6,9 +6,12 @@
   - name: {{ artifactory.get('name', name) }}
   - url: {{ artifactory.get('url', '') }}
   - credential_id: {{ artifactory.get('credential_id', '') }}
+  - require:
+    - sls: jenkins.client.plugin
+    - jenkins_credential: {{ artifactory.get('credential_id', '') }}
 {% else %}
 jenkins_artifactory_server_{{ name }}_disable:
    jenkins_artifactory.absent:
    - name: {{ artifactory.get('name', name) }}
 {% endif %}
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/jenkins/client/credential.sls b/jenkins/client/credential.sls
index 1f2247f..d4e47c1 100644
--- a/jenkins/client/credential.sls
+++ b/jenkins/client/credential.sls
@@ -12,4 +12,6 @@
   - key: |
       {{ cred.get('key','')|indent(6) }}
   {%- endif %}
+  - require:
+    - sls: jenkins.client.plugin
 {% endfor %}
diff --git a/jenkins/client/gerrit.sls b/jenkins/client/gerrit.sls
index 24c4abf..b398584 100644
--- a/jenkins/client/gerrit.sls
+++ b/jenkins/client/gerrit.sls
@@ -20,5 +20,7 @@
       {{ gerrit.get('authkey','')|indent(6) }}
   {%- endif %}
   - auth_key_file_password: {{ gerrit.get('auth_key_file_password', '') }}
+  - require:
+    - sls: jenkins.client.plugin
 {% endfor %}
 {%- endif %}
diff --git a/jenkins/client/jira.sls b/jenkins/client/jira.sls
index 39d7105..ec8a31a 100644
--- a/jenkins/client/jira.sls
+++ b/jenkins/client/jira.sls
@@ -22,6 +22,8 @@
         },
       {% endfor %}
       }
+    - require:
+      - sls: jenkins.client.plugin
 {% else %}
 jenkins_jira_disable:
   jenkins_jira.absent
diff --git a/jenkins/client/lib.sls b/jenkins/client/lib.sls
index fd27d28..df0a8e3 100644
--- a/jenkins/client/lib.sls
+++ b/jenkins/client/lib.sls
@@ -7,6 +7,8 @@
         - url: {{ lib.url }}
         {%- if lib.credential_id is defined %}
         - credential_id: {{ lib.credential_id }}
+        - require:
+          - jenkins_credential: {{ lib.credential_id }}
         {%- endif %}
         - branch: {{ lib.get("branch", "master") }}
 {%- else %}
@@ -14,4 +16,4 @@
     jenkins_lib.absent:
     - name: {{ lib.get('name', name) }}
 {%- endif %}
-{% endfor %}
\ No newline at end of file
+{% endfor %}
diff --git a/jenkins/client/security.sls b/jenkins/client/security.sls
index 4b9cc41..eb34669 100644
--- a/jenkins/client/security.sls
+++ b/jenkins/client/security.sls
@@ -10,6 +10,8 @@
     - user_search: {{ client.security.ldap.get('user_search','') }}
     - group_search_base: {{ client.security.ldap.get('group_search_base', '') }}
     - inhibit_infer_root_dn: {{ client.security.ldap.get('inhibit_infer_root_dn', False) }}
+    - require:
+      - sls: jenkins.client.plugin
 {%- endif %}
 
 {%- if client.security.matrix is defined %}
@@ -17,6 +19,8 @@
   jenkins_security.matrix:
     - strategies: {{ client.security.matrix.permissions }}
     - project_based: {{ client.security.matrix.get('project_based', False) }}
+    - require:
+      - sls: jenkins.client.plugin
 {%- endif %}
 
 {%- if client.security.csrf is defined %}
diff --git a/jenkins/client/slack.sls b/jenkins/client/slack.sls
index ed71773..e1f33db 100644
--- a/jenkins/client/slack.sls
+++ b/jenkins/client/slack.sls
@@ -7,4 +7,7 @@
     - token_credential_id: {{ client.slack.get('token_credential_id','') }}
     - send_as: {{ client.slack.get('send_as','') }}
     - room: {{ client.slack.get('room', '') }}
+    - require:
+      - sls: jenkins.client.plugin
+      - sls: jenkins.client.credential
 {%- endif %}
diff --git a/jenkins/client/smtp.sls b/jenkins/client/smtp.sls
index ae378eb..d322d38 100644
--- a/jenkins/client/smtp.sls
+++ b/jenkins/client/smtp.sls
@@ -9,6 +9,8 @@
     - port: {{ client.smtp.get('port', '') }}
     - ssl: {{ client.smtp.get('ssl', '') }}
     - charset: {{ client.smtp.get('charset', '') }}
+    - require:
+      - sls: jenkins.client.plugin
 {%- endif %}
 
 {%- if client.smtp is defined and client.smtp.admin_email is defined %}
diff --git a/jenkins/client/theme.sls b/jenkins/client/theme.sls
index 7707add..6e68f1c 100644
--- a/jenkins/client/theme.sls
+++ b/jenkins/client/theme.sls
@@ -4,4 +4,6 @@
   jenkins_theme.config:
     - css_url: {{ client.theme.css_url }}
     - js_url: {{ client.theme.js_url }}
+    - require:
+      - sls: jenkins.client.plugin
 {%- endif %}
diff --git a/jenkins/client/throttle_category.sls b/jenkins/client/throttle_category.sls
index de508a0..78a8da5 100644
--- a/jenkins/client/throttle_category.sls
+++ b/jenkins/client/throttle_category.sls
@@ -9,6 +9,7 @@
     - labels: {{ throttle_category.get('max_per_label',[]) }}
     - require:
       - jenkins_client_install
+      - sls: jenkins.client.plugin
 {% else %}
 'throttle_category_{{ name }}_disable':
    jenkins_throttle_category.absent:
diff --git a/jenkins/client/view.sls b/jenkins/client/view.sls
index 7ac0b07..c47555d 100644
--- a/jenkins/client/view.sls
+++ b/jenkins/client/view.sls
@@ -9,9 +9,12 @@
   - {{ key }}: {{ value }}
   {%- endif %}
   {%- endfor %}
+  - require:
+    - sls: jenkins.client.job
+    - sls: jenkins.client.plugin
 {% else %}
 view_{{ name }}_disable:
    jenkins_view.absent:
    - name: {{ view.get('name', name) }}
 {% endif %}
-{% endfor %}
\ No newline at end of file
+{% endfor %}