from lib import action


class ActionManager(action.BaseAction):

    def run(self, **kwargs):
        action = kwargs['action']
        del kwargs['action']
        module_path = kwargs['module_path']
        del kwargs['module_path']
        if action == 'run_instances':
            kwargs['user_data'] = self.st2_user_data()
        if action == 'create_tags':
            kwargs['tags'] = self.split_tags(kwargs['tags'])
        if 'cls' in kwargs.keys():
            cls = kwargs['cls']
            del kwargs['cls']
            return self.do_method(module_path, cls, action, **kwargs)
        else:
            return self.do_function(module_path, action, **kwargs)

from lib import action


class ActionManager(action.BaseAction):

    def run(self, **kwargs):
        action = kwargs['action']
        del kwargs['action']
        module_path = kwargs['module_path']
        del kwargs['module_path']
        if action == 'run_instances':
            kwargs['user_data'] = self.st2_user_data()
        if action == 'create_tags':
            kwargs['tags'] = self.split_tags(kwargs['tags'])
        if action in ('add_a', 'update_a'):
            kwargs['value'] = kwargs['value'].split(',')
        if 'cls' in kwargs.keys():
            cls = kwargs['cls']
            del kwargs['cls']
            return self.do_method(module_path, cls, action, **kwargs)
        else:
            return self.do_function(module_path, action, **kwargs)

Support DNS round-robin balancing through Route53
Support DNS round-robin balancing through Route53

Our codegen actions for adding/updating A records in Route53 only support a single IP as a value. Changing to accept a comma-separated list, which will add an unweighted round-robin A record.

Should also add WRR at some point probably, but I just don't care enough.
  from lib import action
  
  
  class ActionManager(action.BaseAction):
  
      def run(self, **kwargs):
          action = kwargs['action']
          del kwargs['action']
          module_path = kwargs['module_path']
          del kwargs['module_path']
          if action == 'run_instances':
              kwargs['user_data'] = self.st2_user_data()
          if action == 'create_tags':
              kwargs['tags'] = self.split_tags(kwargs['tags'])
+         if action in ('add_a', 'update_a'):
+             kwargs['value'] = kwargs['value'].split(',')
          if 'cls' in kwargs.keys():
              cls = kwargs['cls']
              del kwargs['cls']
              return self.do_method(module_path, cls, action, **kwargs)
          else:
              return self.do_function(module_path, action, **kwargs)
  
Support DNS round-robin balancing through Route53
## Code Before:
from lib import action


class ActionManager(action.BaseAction):

    def run(self, **kwargs):
        action = kwargs['action']
        del kwargs['action']
        module_path = kwargs['module_path']
        del kwargs['module_path']
        if action == 'run_instances':
            kwargs['user_data'] = self.st2_user_data()
        if action == 'create_tags':
            kwargs['tags'] = self.split_tags(kwargs['tags'])
        if 'cls' in kwargs.keys():
            cls = kwargs['cls']
            del kwargs['cls']
            return self.do_method(module_path, cls, action, **kwargs)
        else:
            return self.do_function(module_path, action, **kwargs)

## Instruction:
Support DNS round-robin balancing through Route53
## Code After:
from lib import action


class ActionManager(action.BaseAction):

    def run(self, **kwargs):
        action = kwargs['action']
        del kwargs['action']
        module_path = kwargs['module_path']
        del kwargs['module_path']
        if action == 'run_instances':
            kwargs['user_data'] = self.st2_user_data()
        if action == 'create_tags':
            kwargs['tags'] = self.split_tags(kwargs['tags'])
        if action in ('add_a', 'update_a'):
            kwargs['value'] = kwargs['value'].split(',')
        if 'cls' in kwargs.keys():
            cls = kwargs['cls']
            del kwargs['cls']
            return self.do_method(module_path, cls, action, **kwargs)
        else:
            return self.do_function(module_path, action, **kwargs)
