Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions fig/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,17 @@ def pull(self, project, options):
"""
Pulls images for services.

Usage: pull [SERVICE...]
Usage: pull [options] [SERVICE...]

Options:
--allow-insecure-ssl Allow insecure connections to the docker
registry
"""
project.pull(service_names=options['SERVICE'])
insecure_registry = options['--allow-insecure-ssl']
project.pull(
service_names=options['SERVICE'],
insecure_registry=insecure_registry
)

def rm(self, project, options):
"""
Expand Down
4 changes: 2 additions & 2 deletions fig/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ def up(self, service_names=None, start_links=True, recreate=True):

return running_containers

def pull(self, service_names=None):
def pull(self, service_names=None, insecure_registry=False):
for service in self.get_services(service_names, include_links=True):
service.pull()
service.pull(insecure_registry=insecure_registry)

def remove_stopped(self, service_names=None, **options):
for service in self.get_services(service_names):
Expand Down
7 changes: 5 additions & 2 deletions fig/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,10 +413,13 @@ def can_be_scaled(self):
return False
return True

def pull(self):
def pull(self, insecure_registry=False):
if 'image' in self.options:
log.info('Pulling %s (%s)...' % (self.name, self.options.get('image')))
self.client.pull(self.options.get('image'))
self.client.pull(
self.options.get('image'),
insecure_registry=insecure_registry
)


NAME_RE = re.compile(r'^([^_]+)_([^_]+)_(run_)?(\d+)$')
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def find_version(*file_paths):
'texttable >= 0.8.1, < 0.9',
'websocket-client >= 0.11.0, < 0.12',
'dockerpty >= 0.2.3, < 0.3',
'docker-py >= 0.3.2, < 0.6',
'docker-py >= 0.5, < 0.6',
'six >= 1.3.0, < 2',
]

Expand Down
7 changes: 7 additions & 0 deletions tests/unit/service_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,13 @@ def test_get_container(self, mock_container_class):
mock_container_class.from_ps.assert_called_once_with(
mock_client, container_dict)

@mock.patch('fig.service.log', autospec=True)
def test_pull_image(self, mock_log):
service = Service('foo', client=self.mock_client, image='someimage:sometag')
service.pull(insecure_registry=True)
self.mock_client.pull.assert_called_once_with('someimage:sometag', insecure_registry=True)
mock_log.info.assert_called_once_with('Pulling foo (someimage:sometag)...')


class ServiceVolumesTest(unittest.TestCase):

Expand Down