[pkg-eucalyptus-commits] [SCM] managing cloud instances for Eucalyptus branch, master, updated. 3.0.0-alpha3-257-g1da8e3a

Garrett Holmstrom gholms at fedoraproject.org
Sun Jun 16 02:30:50 UTC 2013


The following commit has been merged in the master branch:
commit 625da4333c470bff20a85ee0dc56fd30e5991c15
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date:   Sun Mar 31 13:27:23 2013 -0700

    Implement DescribeLoadBalancerPolicyTypes
    
    Fixes TOOLS-233

diff --git a/bin/euelb-describe-lb-policies b/bin/euelb-describe-lb-policy-types
similarity index 73%
copy from bin/euelb-describe-lb-policies
copy to bin/euelb-describe-lb-policy-types
index 5bb6b64..ec47dd9 100755
--- a/bin/euelb-describe-lb-policies
+++ b/bin/euelb-describe-lb-policy-types
@@ -1,6 +1,6 @@
 #!/usr/bin/python -tt
 
-import euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicies
+import euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicytypes
 
 if __name__ == '__main__':
-    euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicies.DescribeLoadBalancerPolicies.run()
+    euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicytypes.DescribeLoadBalancerPolicyTypes.run()
diff --git a/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py b/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicytypes.py
similarity index 57%
copy from euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py
copy to euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicytypes.py
index f010c96..2b84710 100644
--- a/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py
+++ b/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicytypes.py
@@ -28,35 +28,35 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 
-from euca2ools.commands.argtypes import delimited_list
 from euca2ools.commands.elasticloadbalancing import ELBRequest
 from requestbuilder import Arg
 from requestbuilder.mixins import TabifyingCommand
 
 
-class DescribeLoadBalancerPolicies(ELBRequest, TabifyingCommand):
-    DESCRIPTION = 'Show information about load balancer policies'
-    ARGS = [Arg('LoadBalancerName', metavar='ELB', nargs='?', help='''show
-                policies associated with a specific load balancer (default:
-                only describe sample policies provided by the service)'''),
-            Arg('-p', '--policy-names', dest='PolicyNames.member',
-                metavar='POLICY1,POLICY2,...', type=delimited_list(','),
-                help='limit results to specific policies'),
+class DescribeLoadBalancerPolicyTypes(ELBRequest, TabifyingCommand):
+    DESCRIPTION = 'Show information about load balancer policy types'
+    ARGS = [Arg('PolicyTypeNames.member', metavar='POLTYPE', nargs='*',
+                help='limit results to specific policy types'),
             Arg('--show-long', action='store_true', route_to=None,
-                help="show all of the policies' info")]
-    LIST_TAGS = ['PolicyDescriptions', 'PolicyAttributeDescriptions']
+                help="show all of the policy types' info")]
+    LIST_TAGS = ['PolicyTypeDescriptions', 'PolicyAttributeTypeDescriptions']
 
     def print_result(self, result):
-        for policy in result.get('PolicyDescriptions', []):
-            bits = ['POLICY', policy.get('PolicyName'),
-                    policy.get('PolicyTypeName')]
+        for poltype in result.get('PolicyTypeDescriptions', []):
+            bits = ['POLICY_TYPE', poltype.get('PolicyTypeName'),
+                    poltype.get('Description')]
             if self.args['show_long']:
                 attrs = []
-                for attr in policy.get('PolicyAttributeDescriptions', []):
-                    attrs.append('{{name={0},value={1}}}'.format(
-                        attr.get('AttributeName'), attr.get('AttributeValue')))
-                if len(attrs) > 0:
-                    bits.append(','.join(attrs))
-                else:
-                    bits.append(None)
+                for attr in poltype.get('PolicyAttributeTypeDescriptions', []):
+                    elem_map = (('name', 'AttributeName'),
+                                ('description', 'Description'),
+                                ('type', 'AttributeType'),
+                                ('default-value', 'DefaultValue'),
+                                ('cardinality', 'Cardinality'))
+                    attr_bits = []
+                    for name, xmlname in elem_map:
+                        attr_bits.append('='.join((name,
+                                                   attr.get(xmlname) or '')))
+                    attrs.append('{' + ','.join(attr_bits) + '}')
+                bits.append(','.join(attrs))
             print self.tabify(bits)

-- 
managing cloud instances for Eucalyptus



More information about the pkg-eucalyptus-commits mailing list