PageRenderTime 27ms CodeModel.GetById 19ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/boto-2.5.2/boto/emr/bootstrap_action.py

#
Python | 44 lines | 16 code | 7 blank | 21 comment | 2 complexity | cd0a56b1a0559cea99e6615f602d22cc MD5 | raw file
 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
23class BootstrapAction(object):
24    def __init__(self, name, path, bootstrap_action_args):
25        self.name = name
26        self.path = path
27
28        if isinstance(bootstrap_action_args, basestring):
29            bootstrap_action_args = [bootstrap_action_args]
30
31        self.bootstrap_action_args = bootstrap_action_args
32
33    def args(self):
34        args = []
35
36        if self.bootstrap_action_args:
37            args.extend(self.bootstrap_action_args)
38
39        return args
40
41    def __repr__(self):
42        return '%s.%s(name=%r, path=%r, bootstrap_action_args=%r)' % (
43            self.__class__.__module__, self.__class__.__name__,
44            self.name, self.path, self.bootstrap_action_args)