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

[BUG] [BACKUP/RECOVERY] rsync command fails trying to copy artifacts #2942

Closed
9 of 18 tasks
przemyslavic opened this issue Feb 3, 2022 · 2 comments
Closed
9 of 18 tasks
Assignees
Labels

Comments

@przemyslavic
Copy link
Collaborator

przemyslavic commented Feb 3, 2022

Describe the bug
Backup command fails on rsync task with the following error: rsync error: syntax or usage error (code 1) at main.c(1344) [sender=3.1.2].

2022-02-02T19:54:15.2675029Z[38;21m19:54:15 INFO cli.engine.ansible.AnsibleCommand - TASK [backup : Use rsync to copy all artifacts] ********************************
2022-02-02T19:54:16.0768848Z[31;21m19:54:16 ERROR cli.engine.ansible.AnsibleCommand - failed: [ci-recazurcentcanal-kubernetes-master-vm-0 -> ci-recazurcentcanal-repository-vm-0(1.1.1.1)] (item=/epibackup/k8s_snapshot_20220202-195348.tar.gz) => {"ansible_loop_var": "item", "changed": false, "cmd": "/bin/rsync --delay-updates -F --compress --checksum --archive --rsync-path='sudo -u root rsync' --rsh=/usr/bin/ssh -S none -i /root/.ssh/ansible.Qk7_tI.tmp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null --out-format='<<CHANGED>>%i %n%L' [email protected]:/epibackup/k8s_snapshot_20220202-195348.tar.gz /epibackup/mounted", "item": "/epibackup/k8s_snapshot_20220202-195348.tar.gz", "msg": "Unexpected remote arg: [email protected]:/epibackup/k8s_snapshot_20220202-195348.tar.gz\nrsync error: syntax or usage error (code 1) at main.c(1344) [sender=3.1.2]\n", "rc": 1}
2022-02-02T19:54:16.4286627Z[31;21m19:54:16 ERROR cli.engine.ansible.AnsibleCommand - failed: [ci-recazurcentcanal-kubernetes-master-vm-0 -> ci-recazurcentcanal-repository-vm-0(1.1.1.1)] (item=/epibackup/k8s_snapshot_20220202-195348.tar.gz.sha1) => {"ansible_loop_var": "item", "changed": false, "cmd": "/bin/rsync --delay-updates -F --compress --checksum --archive --rsync-path='sudo -u root rsync' --rsh=/usr/bin/ssh -S none -i /root/.ssh/ansible.Qk7_tI.tmp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null --out-format='<<CHANGED>>%i %n%L' [email protected]:/epibackup/k8s_snapshot_20220202-195348.tar.gz.sha1 /epibackup/mounted", "item": "/epibackup/k8s_snapshot_20220202-195348.tar.gz.sha1", "msg": "Unexpected remote arg: [email protected]:/epibackup/k8s_snapshot_20220202-195348.tar.gz.sha1\nrsync error: syntax or usage error (code 1) at main.c(1344) [sender=3.1.2]\n", "rc": 1}

https://github.com/epiphany-platform/epiphany/blob/develop/ansible/playbooks/roles/backup/tasks/common/download_via_rsync.yml#L72

https://github.com/epiphany-platform/epiphany/blob/develop/ansible/playbooks/roles/recovery/tasks/common/upload_via_rsync.yml#L67

This is related to Ansible/Python update #2933.

Worth checking the remote shell we use: /usr/bin/ssh -S none -i {{ private_key_file.path }} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
https://github.com/epiphany-platform/epiphany/blob/develop/ansible/playbooks/roles/backup/tasks/common/download_via_rsync.yml#L84.
Maybe it's no longer needed or it should be within quotation marks

How to reproduce
Steps to reproduce the behavior:

  1. execute epicli apply to deploy a cluster with e.g. kubernetes master component enabled
  2. execute epicli backup -b /build/directory -f /backup/config.yml

Expected behavior
Backup should be successful

Config files
Backup config

---
kind: configuration/backup
title: Backup Config
provider: aws
name: default
specification:
  components:
    load_balancer:
      enabled: true
    logging:
      enabled: true
    monitoring:
      enabled: true
    postgresql:
      enabled: true
    rabbitmq:
      enabled: true
    kubernetes:
      enabled: true

Environment

  • Cloud provider: found on Azure but probably provider doesn't matter
  • OS: [RHEL, CentOS, Ubuntu]

epicli version: 2.0.0dev

Additional context


DoD checklist

  • Changelog
    • updated
    • not needed
  • COMPONENTS.md
    • updated
    • not needed
  • Schema
    • updated
    • not needed
  • Backport tasks
    • created
    • not needed
  • Documentation
    • added
    • updated
    • not needed
  • Feature has automated tests
  • Automated tests passed (QA pipelines)
    • apply
    • upgrade
    • backup/restore
  • Idempotency tested
  • All conversations in PR resolved
@przemyslavic
Copy link
Collaborator Author

From what I've already tested this should do the trick:
https://github.com/epiphany-platform/epiphany/blob/c687e8eca0347fda6dd7a0b092deafeccdb53fb6/ansible/playbooks/roles/backup/tasks/common/download_via_rsync.yml#L79

          - --rsh="{{ rsh }}"

https://github.com/epiphany-platform/epiphany/blob/c687e8eca0347fda6dd7a0b092deafeccdb53fb6/ansible/playbooks/roles/recovery/tasks/common/upload_via_rsync.yml#L74

          - --rsh="{{ rsh }}"

But it might be worth refactoring this task:

        # this fixes / replaces incorrect path to the private key file that synchronize provides
        # (setting private_key parameter has no effect whatsoever, looks like a bug tbh)

@przemyslavic przemyslavic changed the title [BUG] [BACKUP] rsync command fails trying to copy artifacts [BUG] [BACKUP/RECOVERY] rsync command fails trying to copy artifacts Feb 3, 2022
@cicharka cicharka self-assigned this Feb 8, 2022
cicharka added a commit to cicharka/epiphany that referenced this issue Feb 9, 2022
Bug hitachienergy#2942 rsync command fails trying to copy artifacts
* With new version of ansible we can use private_key option for
  synchronize module, therefore there's no need to use rsh

Bug hitachienergy#2930 Backup/recovery commands fail when default configuration for
backup attached to cluster-config.yml
* extend run_for_individual_documents method so it can choose relevant
  schema for validated document
cicharka added a commit to cicharka/epiphany that referenced this issue Feb 14, 2022
Bug hitachienergy#2942 rsync command fails trying to copy artifacts
* With new version of ansible we can use private_key option for
  synchronize module, therefore there's no need to use rsh

Bug hitachienergy#2930 Backup/recovery commands fail when default configuration for
backup attached to cluster-config.yml
* extend run_for_individual_documents method so it can choose relevant
  schema for validated document
cicharka added a commit to cicharka/epiphany that referenced this issue Feb 23, 2022
Bug hitachienergy#2942 rsync command fails trying to copy artifacts
* With new version of ansible we can use private_key option for
  synchronize module, therefore there's no need to use rsh

Bug hitachienergy#2930 Backup/recovery commands fail when default configuration for
backup attached to cluster-config.yml
* extend run_for_individual_documents method so it can choose relevant
  schema for validated document
@przemyslavic przemyslavic self-assigned this Feb 23, 2022
cicharka added a commit that referenced this issue Feb 24, 2022
* Fix for #2942 - with new version of ansible we can use private_key option for
  synchronize module, therefore there's no need to use rsh

* Fix for #2930

* Remove legacy code

* Additional check to verify if backup/recovery present in input docs
@przemyslavic
Copy link
Collaborator Author

Fixed rsync command.
Improved validation for backup/recovery.
Configuration for backup/recovery can be placed in a separate file (recommended) or attached to the cluster configuration (or any yaml file).

@seriva seriva closed this as completed Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants