help me - error: Filespec must match the canonical format: [[namespace/]pod:]file/path

453 views
Skip to first unread message

Balaji

unread,
Apr 8, 2019, 10:42:27 PM4/8/19
to Ansible Project

Hello All,

Need your help on below issue.

I am trying to run kubernetes command on a remote host using ansible.

This command works when directly run on a remote host.

======>   kubectl cp /etc/passwd bus-service/ssh-jumphost-6954f877bf-p5fmq:/etc/passwd_test

But when using ansible

    - name: Copy commands
      shell: "kubectl cp {{ item }} baas-service/{{ jumphost.stdout_lines }}:{{ item }}"
      with_items:
        - { '/etc/master.passwd' }
        - { '/etc/passwd' }
        - { '/etc/group' }
        
        
I get an error.


failed: [gngqnc014c] (item={u'/etc/master.passwd': None}) => {
    "changed": true, 
    "cmd": "kubectl cp {u'/etc/master.passwd': None}bus-service/[u'ssh-jumphost-6954f877bf-p5fmq', u'ssh-jumphost-6954f877bf-twg7j', u'ssh-jumphost-6954f877bf-xrmhs']:{u'/etc/master.passwd': None}", 
    "delta": "0:00:00.070410", 
    "end": "2019-04-08 16:04:49.551694", 
    "invocation": {
        "module_args": {
            "_raw_params": "kubectl cp {u'/etc/master.passwd': None}bus-service/[u'ssh-jumphost-6954f877bf-p5fmq', u'ssh-jumphost-6954f877bf-twg7j', u'ssh-jumphost-6954f877bf-xrmhs']:{u'/etc/master.passwd': None}", 
            "_uses_shell": true, 
            "argv": null, 
            "chdir": null, 
            "creates": null, 
            "executable": null, 
            "removes": null, 
            "stdin": null, 
            "warn": true
        }
    }, 
    "item": {
        "/etc/master.passwd": null
    }, 
    "msg": "non-zero return code", 
    "rc": 1, 
    "start": "2019-04-08 16:04:49.481284", 
    "stderr": "error: Filespec must match the canonical format: [[namespace/]pod:]file/path", 
    "stderr_lines": [
        "error: Filespec must match the canonical format: [[namespace/]pod:]file/path"
    ], 
    "stdout": "", 
    "stdout_lines": []
}
        


Can anyone help me on this issue?


Thanks

vinoth kumar

unread,
Apr 10, 2019, 1:31:38 AM4/10/19
to ansible...@googlegroups.com
On Tue, 9 Apr 2019 at 8:12 AM, Balaji <balaji...@gmail.com> wrote:

Hello All,

Need your help on below issue.

I am trying to run kubernetes command on a remote host using ansible.

This command works when directly run on a remote host.

======>   kubectl cp /etc/passwd bus-service/ssh-jumphost-6954f877bf-p5fmq:/etc/passwd_test

But when using ansible

    - name: Copy commands
      shell: "kubectl cp {{ item }} baas-service/{{ jumphost.stdout_lines }}:{{ item }}"
      with_items:
        - { '/etc/master.passwd' }
        - { '/etc/passwd' }
        - { '/etc/group' }
        
        
I get an error.


failed: [gngqnc014c] (item={u'/etc/master.passwd': None}) => {
    "changed": true, 


Here you have to take a look , it’s not seems sane which you directly rub in command line.
You have to use 

kubectl cp {{ item }} baas-service/{{ jumphost.stdout_lines }}:{{ item }}_test”



--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/09110715-1ca6-4223-93f5-13691c03550b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages