Could this be a bug in copy module?

Hi all,

I happened to name my file that has a string “raw” in it and copy module failed to do the right thing. Is there a list of reserved keywords that we should not use?

Thanks,
Steven.

print module_args

run the copy module

if ‘raw’ in module_args:

don’t send down raw=no

module_args.pop(‘raw’)
module_args = “%s src=%s original_basename=%s” % (module_args, pipes.quote(tmp_src), pipes.quote(os.path.basename(source)))
return self.runner._execute_module(conn, tmp, ‘copy’, module_args, inject=inject, complex_args=complex_args)

I’ve stubbed my toe on several variable naming issues.

Add these to the list of variable names to avoid

names.with.dots
names-with-dashes

Both give weird error messages.
elasticsearch.yml uses dot-separated names, so i’m not sure what the problem is with ansible group_vars/all vars.

kesten

Yes, the variables section will soon clearly indicate you should always use valid variable identifiers.

Hi Michael,

In my case, it is just a parameter for copy module (src=draw.repo) and why the copy module (sorry for my ignorance) even failed to copy a file with name that has the string “raw” in it. Is it too extreme?

There must be good reasons but I have not really read the code to understand the reasons.

Thanks in advances,
Steven.

steven, are you sure it’s not the “.” in the name. If you define
draw.repo: “value” somewhere, i know that will fail.

vars:

  • anything.anything # this will fail

  • draw.repo: “blah” # this will fail

  • anything-anything # this will fail

  • draw_repo" “blah” # this is fine

  • debug: msg=“{{draw_repo}}” # no problems here.

print module_args

run the copy module

if ‘raw’ in module_args:

don’t send down raw=no

module_args.pop(‘raw’)
module_args = “%s src=%s original_basename=%s” % (module_args, pipes.quote(tmp_src), pipes.quote(os.path.basename(source)))
return self.runner._execute_module(conn, tmp, ‘copy’, module_args, inject=inject, complex_args=complex_args)

Hi Kesten,

This is the part of the copy module that bombed out every time I ran my module. Going back to my first message, I printed out the module_args and there is nothing that is illegal there. Files have filename.extension and how can you avoid that entirely in dealing with files in any environment.

module_args.pop(‘raw’)

This line clearly is the issue for my use case.

Steven.

I don’t see why the pop command would split around this but please make sure there is a github ticket so we can reproduce and investigate.

Hi Michael,

As soon as I changed my src=draw.repo to src=dbrid.repo, things will just work. Otherwise, I would have been sitting here waiting for others to fix this bug before I could get anything done.

I will file a bug.

Thanks and see you at AnsibleFest in SF.

Steven.

This is now fixed on the development branch.