|
@@ -22,6 +22,9 @@ log = logging.getLogger(__name__)
|
|
|
class Command(DocoptCommand):
|
|
class Command(DocoptCommand):
|
|
|
base_dir = '.'
|
|
base_dir = '.'
|
|
|
|
|
|
|
|
|
|
+ def __init__(self):
|
|
|
|
|
+ self.yaml_path = os.environ.get('FIG_FILE', None)
|
|
|
|
|
+
|
|
|
def dispatch(self, *args, **kwargs):
|
|
def dispatch(self, *args, **kwargs):
|
|
|
try:
|
|
try:
|
|
|
super(Command, self).dispatch(*args, **kwargs)
|
|
super(Command, self).dispatch(*args, **kwargs)
|
|
@@ -54,6 +57,11 @@ Couldn't connect to Docker daemon at %s - is it running?
|
|
|
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
|
|
If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.
|
|
|
""" % self.client.base_url)
|
|
""" % self.client.base_url)
|
|
|
|
|
|
|
|
|
|
+ def perform_command(self, options, *args, **kwargs):
|
|
|
|
|
+ if options['--file'] is not None:
|
|
|
|
|
+ self.yaml_path = os.path.join(self.base_dir, options['--file'])
|
|
|
|
|
+ return super(Command, self).perform_command(options, *args, **kwargs)
|
|
|
|
|
+
|
|
|
@cached_property
|
|
@cached_property
|
|
|
def client(self):
|
|
def client(self):
|
|
|
return Client(docker_url())
|
|
return Client(docker_url())
|
|
@@ -61,9 +69,10 @@ If it's at a non-standard location, specify the URL with the DOCKER_HOST environ
|
|
|
@cached_property
|
|
@cached_property
|
|
|
def project(self):
|
|
def project(self):
|
|
|
try:
|
|
try:
|
|
|
- yaml_path = self.check_yaml_filename()
|
|
|
|
|
|
|
+ yaml_path = self.yaml_path
|
|
|
|
|
+ if yaml_path is None:
|
|
|
|
|
+ yaml_path = self.check_yaml_filename()
|
|
|
config = yaml.load(open(yaml_path))
|
|
config = yaml.load(open(yaml_path))
|
|
|
-
|
|
|
|
|
except IOError as e:
|
|
except IOError as e:
|
|
|
if e.errno == errno.ENOENT:
|
|
if e.errno == errno.ENOENT:
|
|
|
log.error("Can't find %s. Are you in the right directory?", os.path.basename(e.filename))
|
|
log.error("Can't find %s. Are you in the right directory?", os.path.basename(e.filename))
|