Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Duplicati Support #53

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Duplicati Support #53

wants to merge 5 commits into from

Conversation

i014n
Copy link
Member

@i014n i014n commented Aug 22, 2022

Metadata

Proposed Changes

  • Make a list of the modifications you want to apply.
  • Implements Duplicati module for the new MutableSecurity structure.

New Functioning

Duplicati can be used to securely store encrypted, incremental, compressed backups.

Other Information

The storage providers available in this version are: Local folder, SFTP (SSH) and Google Drive.

@i014n i014n requested review from iosifache and AntociAlin August 22, 2022 13:04
@i014n i014n force-pushed the issue-12 branch 3 times, most recently from 2e3fa02 to 98b8d5f Compare August 23, 2022 15:16
Copy link
Member

@iosifache iosifache left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Besides the comments in the code, please consider the following:

  • Recheck the descriptions. These will appear as they are (no manual modification) in the documentation. So let's ensure that they are well formatted and correct (valid phrases, punctuation, etc.).
  • On multiple information, the set_configuration method is repeated. Can we create a module-level deploy function to be called on every information?
  • Ensure that your linters works. The solution class definition raises warnings because of missing # type: ignore[list-item] comments. In addition, multiple type annotations are wrong.
  • In the methods of the helper class, let's use format f-strings. They are more readable than string concatenation.
  • Remove the class DuplicatiHelper. As all methods are static, it is the same with defining the functions directly in the module.
  • The commit does not respect the format: the length is greater than 70 characters and the title is not imperative. Please check the .github/COMMIT_TEMPLATE. Same for PR: the "Make a list of the modifications you want to apply." remained from the format and there are no labels and assignees, as the issue has (we need to add this mention in the docs too).

By testing the solution in a VM, I can say that there is something with the encryption_test test. It is not executed at all. Please check if that return of a commands' array is a valid syntax in pyinfra.

import os
import typing
import uuid
from logging.config import IDENTIFIER
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this import correct? It may come from IDENTIFIER access within your operations, but in these places the IDENTIFIER is a member of the parent object.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done



class IncompatibleArchitectureException(BaseSolutionException):
"""Your architecture does not support any teler build."""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mistaken solution name here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

ACT = restore_google_drive_backup


# info
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a forgot comment? The comment dividing the classes is already present below.


IDENTIFIER = "exclude_files_attributes"
DESCRIPTION = "Don't backup files which have this attribute"
INFO_TYPE = StringDataType
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From this comment on Duplicati's forum, I understand that there are multiple attributes that can be excluded. Please transform this into an array of string, such as users may skip multiple file types.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

InformationProperties.NON_DEDUCTIBLE,
InformationProperties.WRITABLE,
]
DEFAULT_VALUE = "mutablesecutiy"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove this hard-coded password. Attach the MANDATORY property and remove WITH_DEFAULT_VALUE + OPTIONAL.

references:
- https://www.duplicati.com/
- https://github.com/duplicati/duplicati
maturity: DEV_ONLY
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After solving all the change requests, let's set the maturity to PRODUCTION. We will push this whole module into a future version of MutableSecurity 🎉.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- https://github.com/duplicati/duplicati
maturity: DEV_ONLY
categories:
- NONE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And add here a BACKUP category. Don't forget to define it into solution.py in base package.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

return int(output[0]) != 0

IDENTIFIER = "encryption_test"
DESCRIPTION = "Checks if the Duplici local encryption works"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe typo ("Duplici") here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


class ClientCommandPresence(BaseTest):
IDENTIFIER = "command"
DESCRIPTION = "Checks if the Duplici cli is registered as a command."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another possible typo here, "Duplici". And please respect the abbreviation (CLI with uppercase letters) as that text will appear as it is in documentation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

def process(output: typing.List[str]) -> bool:
return int(output[0]) != 0

IDENTIFIER = "encryption_test"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"encryption_test" may be too generic. Let's try to make it more specific (maybe "local_encrypted_backup", just an idea).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This commit implements support for Duplicati's backups methods:
LOCAL, SSH and GOOGLE DRIVE for MutableSecurity.

Resolves: #12

Signed-off-by: Ionut Bajan <ionutm.bajan@yahoo.com>
This commit resolves some errors found in the previous version.

Resolves: #12

Signed-off-by: Ionut Bajan <ionutm.bajan@yahoo.com>
This commit adds support for creating crontabs for the following:
	-CrontabLocalBackup,
	-CrontabSshBackup
	-CrontabGoogleDriveBackup

Resolves: #12

Signed-off-by: Ionut Bajan <ionutm.bajan@yahoo.com>
This commit implements support for removing crontabs when the solution
is uninstalled.

Resolves: #12

Signed-off-by: Ionut Bajan <ionutm.bajan@yahoo.com>
This commit resolves the problems found in the previous version
which have affected all the back-up operations.

Resolves: #12

Signed-off-by: Ionut Bajan <ionutm.bajan@yahoo.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants