Ejemplo n.º 1
0
  def getResourceName(self):
    """ Query AWS for the name value of the OpsWorks instance

    NOTE: overrides method in base class

    :returns: name value if available or None if not
    :rtype: string or NoneType
    """

    conn = layer1.OpsWorksConnection(**self._getFreshAWSAuthenticationArgs())

    result = conn.describe_stacks([self._dimensions["StackId"]])

    if "Stacks" in result:
      stack = next(iter(result["Stacks"]))
      return stack["Name"]
 def getResources():
     conn = layer1.OpsWorksConnection(
         **cls._getFreshAWSAuthenticationArgs())
     return conn.describe_stacks()
Ejemplo n.º 3
0
import boto.opsworks.layer1 as opsworks
import os


conn   = opsworks.OpsWorksConnection()

def display_intro():
  print '\nfofops - connect to your amazon opsworks instances'

def get_input_from_choices(choices, header, entity):
  print '\n%s\n------------------------------------------------' % header
  for k, v in choices.iteritems(): print '%2s - %s' % (k, v)
  print ' 0 - exit'

  try:
    num = int(raw_input('\nChoose an %s: ' % entity))
  except:
    num = -1
    pass

  if num > 0 and num <= len(choices):
    return choices[num]
  elif num is 0:
    os._exit(0)

def get_stack():
  stacks = dict([(s['Name'], s) for s in conn.describe_stacks()['Stacks']])
  stack_names = dict([(i+1, s) for (i, s) in enumerate(stacks.keys())])

  stack = None
  while not stack: