소스 검색

Making the app nodes an optional return.

Matt Bruzek 6 년 전
부모
커밋
72bc28723f
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      playbooks/openstack/inventory.py

+ 5 - 1
playbooks/openstack/inventory.py

@@ -121,11 +121,15 @@ def build_inventory():
     '''Build the dynamic inventory.'''
     cloud = shade.openstack_cloud()
 
+    # Use an environment variable to optionally skip returning the app nodes.
+    show_compute_nodes = os.environ.get('OPENSTACK_SHOW_COMPUTE_NODES', 'true').lower() == "true"
+
     # TODO(shadower): filter the servers based on the `OPENSHIFT_CLUSTER`
     # environment variable.
     cluster_hosts = [
         server for server in cloud.list_servers()
-        if 'metadata' in server and 'clusterid' in server.metadata]
+        if 'metadata' in server and 'clusterid' in server.metadata and
+        (show_compute_nodes or server.metadata.get('sub-host-type') != 'app')]
 
     inventory = base_openshift_inventory(cluster_hosts)