[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:49 UTC 2013
The following commit has been merged in the master branch:
commit 270afafff3f1ca42be2762c4229e6d408f3e27b5
Author: Garrett Holmstrom <gholms at fedoraproject.org>
Date: Sun Mar 31 12:43:09 2013 -0700
Implement DescribeLoadBalancerPolicies
Fixes TOOLS-240
diff --git a/bin/euelb-describe-lbs b/bin/euelb-describe-lb-policies
similarity index 76%
copy from bin/euelb-describe-lbs
copy to bin/euelb-describe-lb-policies
index f4b44aa..5bb6b64 100755
--- a/bin/euelb-describe-lbs
+++ b/bin/euelb-describe-lb-policies
@@ -1,6 +1,6 @@
#!/usr/bin/python -tt
-import euca2ools.commands.elasticloadbalancing.describeloadbalancers
+import euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicies
if __name__ == '__main__':
- euca2ools.commands.elasticloadbalancing.describeloadbalancers.DescribeLoadBalancers.run()
+ euca2ools.commands.elasticloadbalancing.describeloadbalancerpolicies.DescribeLoadBalancerPolicies.run()
diff --git a/euca2ools/commands/autoscaling/describepolicies.py b/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py
similarity index 56%
copy from euca2ools/commands/autoscaling/describepolicies.py
copy to euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py
index 9cff37c..cadd13b 100644
--- a/euca2ools/commands/autoscaling/describepolicies.py
+++ b/euca2ools/commands/elasticloadbalancing/describeloadbalancerpolicies.py
@@ -28,42 +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.autoscaling import AutoScalingRequest
+from euca2ools.commands.argtypes import delimited_list
+from euca2ools.commands.elasticloadbalancing import ELBRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingCommand
-from requestbuilder.response import PaginatedResponse
-class DescribePolicies(AutoScalingRequest, TabifyingCommand):
- DESCRIPTION = 'Describe auto-scaling policies'
- ARGS = [Arg('PolicyNames.member', metavar='POLICY', nargs='*',
- help='limit results to specific auto-scaling policies'),
- Arg('-g', '--auto-scaling-group', dest='AutoScalingGroupName',
- metavar='ASGROUP'),
+class DescribeLoadBalancerPolicies(ELBRequest, TabifyingCommand):
+ DESCRIPTION = 'Show information about load balancer policiess'
+ 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'),
Arg('--show-long', action='store_true', route_to=None,
help="show all of the policies' info")]
- LIST_TAGS = ['ScalingPolicies', 'Alarms']
-
- def main(self):
- return PaginatedResponse(self, (None,), ('ScalingPolicies',))
-
- def prepare_for_page(self, page):
- # Pages are defined by NextToken
- self.params['NextToken'] = page
-
- def get_next_page(self, response):
- return response.get('NextToken') or None
+ LIST_TAGS = ['PolicyDescriptions', 'PolicyAttributeDescriptions']
def print_result(self, result):
- for policy in result.get('ScalingPolicies', []):
- bits = ['SCALING-POLICY']
- bits.append(policy.get('AutoScalingGroupName'))
- bits.append(policy.get('PolicyName'))
- bits.append(policy.get('ScalingAdjustment'))
- if self.args['show_long']:
- bits.append(policy.get('MinAdjustmentStep'))
- bits.append(policy.get('AdjustmentType'))
+ for policy in result.get('PolicyDescriptions', []):
+ bits = ['POLICY', policy.get('PolicyName'),
+ policy.get('PolicyTypeName')]
if self.args['show_long']:
- bits.append(policy.get('Cooldown'))
- bits.append(policy.get('PolicyARN'))
+ 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)
print self.tabify(bits)
--
managing cloud instances for Eucalyptus
More information about the pkg-eucalyptus-commits
mailing list