Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when specifying permission in volume #260

Closed
hackzilla opened this issue Jun 20, 2014 · 7 comments · Fixed by #442
Closed

Error when specifying permission in volume #260

hackzilla opened this issue Jun 20, 2014 · 7 comments · Fixed by #442

Comments

@hackzilla
Copy link

root@dev-stats-web:~# fig up
Recreating root_statssymfony_1...
Traceback (most recent call last):
  File "/usr/local/bin/fig", line 9, in <module>
    load_entry_point('fig==0.4.2', 'console_scripts', 'fig')()
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 39, in main
    command.sys_dispatch()
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 21, in sys_dispatch
    self.dispatch(sys.argv[1:], None)
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 31, in dispatch
    super(Command, self).dispatch(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 24, in dispatch
    self.perform_command(*self.parse(argv, global_options))
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/command.py", line 50, in perform_command
    return super(Command, self).perform_command(options, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/docopt_command.py", line 27, in perform_command
    handler(command_options)
  File "/usr/local/lib/python2.7/dist-packages/fig/cli/main.py", line 306, in up
    to_attach = self.project.up(service_names=options['SERVICE'])
  File "/usr/local/lib/python2.7/dist-packages/fig/project.py", line 131, in up
    for (_, new) in service.recreate_containers():
  File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 173, in recreate_containers
    tuples.append(self.recreate_container(c, **override_options))
  File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 195, in recreate_container
    self.start_container(new_container, volumes_from=intermediate_container.id)
  File "/usr/local/lib/python2.7/dist-packages/fig/service.py", line 225, in start_container
    external_dir, internal_dir = volume.split(':')
ValueError: too many values to unpack

Took me a while to figure out I'd added :rw to the fig.yml

  volumes:
   - stats-symfony/logs:/var/log/nginx:rw

Would be good idea to add a warning, or support it.

@aanand
Copy link

aanand commented Jun 23, 2014

Added to #129.

@amalagaura
Copy link

How do we specify :ro to the fig.yml for volumes

@montells
Copy link

How do we specify :ro to the fig.yml for volumes

http://stackoverflow.com/questions/25385164/how-to-specify-write-access-to-volume-with-fig

@prologic
Copy link

+1

dnephin added a commit to dnephin/compose that referenced this issue Aug 26, 2014
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
dnephin added a commit to dnephin/compose that referenced this issue Aug 26, 2014
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
dnephin added a commit to dnephin/compose that referenced this issue Aug 28, 2014
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
@prologic
Copy link

Commits from @dnephin look great to me :) Can we get this merged in?

@prologic
Copy link

I solved this locally with minor change:

diff --git a/fig/service.py b/fig/service.py
--- a/fig/service.py
+++ b/fig/service.py
@@ -232,10 +232,17 @@
         if options.get('volumes', None) is not None:
             for volume in options['volumes']:
                 if ':' in volume:
-                    external_dir, internal_dir = volume.split(':')
+                    tokens = volume.split(":")
+
+                    if len(tokens) == 3:
+                        external_dir, internal_dir, ro = tokens
+                    else:
+                        external_dir, internal_dir = tokens
+                        ro = "rw"
+
                     volume_bindings[os.path.abspath(external_dir)] = {
                         'bind': internal_dir,
-                        'ro': False,
+                        'ro': ro.lower() == "ro"
                     }

         privileged = options.get('privileged', False)

dnephin added a commit to dnephin/compose that referenced this issue Aug 31, 2014
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
@alexandresalome
Copy link

💥 hitting same problem

yuval-k pushed a commit to yuval-k/compose that referenced this issue Apr 10, 2015
Adds ~ support and ro mode support for volumes, along with some additional validation.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>

Signed-off-by: Yuval Kohavi <yuval.kohavi@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants