• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2010 Spotify AB
2# Copyright (c) 2010 Yelp
3#
4# Permission is hereby granted, free of charge, to any person obtaining a
5# copy of this software and associated documentation files (the
6# "Software"), to deal in the Software without restriction, including
7# without limitation the rights to use, copy, modify, merge, publish, dis-
8# tribute, sublicense, and/or sell copies of the Software, and to permit
9# persons to whom the Software is furnished to do so, subject to the fol-
10# lowing conditions:
11#
12# The above copyright notice and this permission notice shall be included
13# in all copies or substantial portions of the Software.
14#
15# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
16# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL-
17# ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
18# SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21# IN THE SOFTWARE.
22
23from boto.compat import six
24
25class BootstrapAction(object):
26    def __init__(self, name, path, bootstrap_action_args):
27        self.name = name
28        self.path = path
29
30        if isinstance(bootstrap_action_args, six.string_types):
31            bootstrap_action_args = [bootstrap_action_args]
32
33        self.bootstrap_action_args = bootstrap_action_args
34
35    def args(self):
36        args = []
37
38        if self.bootstrap_action_args:
39            args.extend(self.bootstrap_action_args)
40
41        return args
42
43    def __repr__(self):
44        return '%s.%s(name=%r, path=%r, bootstrap_action_args=%r)' % (
45            self.__class__.__module__, self.__class__.__name__,
46            self.name, self.path, self.bootstrap_action_args)
47