Commit Graph

5 Commits

Author SHA1 Message Date
Alexander Hughes 55349d078e Fix: Allow Pegleg to generate unencrypted bundle
Promenade supports generating a bundle with or without encryption
Pegleg currently does not, it requires encryption.

This patch changes Pegleg behavior to look for an encryption method
and key before generating a bundle.
1. If both are present - generate with encryption
2. If neither are present - generate without encryption
3. If one or the other is present - raise an error

Change-Id: Id55e310ced3d650f64d3f6f626faa10dbe3ab052
2019-08-06 13:17:55 +00:00
Alexander Hughes 1c8d92ef6b Standardize Pegleg code with YAPF
This patch addresses inconsistent code style and enforces it with a
gate for future submissions.

Separate work will be done in the future to address several of the
PEP8 ignores for docstrings, and attempt to bring the tests directory
to PEP8 compliance.

This patch:
1. Updates .style.yapf to set the knobs desired for YAPF.
2. Updates tox.ini to allow one of the knobs to work.
3. Removes unused code from several __init__.py files.
4. Updates the YAPF version in test-requirements.txt to latest (this
   is needed for several knobs to work).
5. Stylistic changes to the python codebase in Pegleg.
6. Updates to tox.ini to run YAPF during PEP8 check.

Change-Id: Ieaa0fdef2b601d01c875d64b840986e54df73abf
2019-07-25 17:28:18 +00:00
HUGHES, ALEXANDER (ah8742) a8620cfd8d Implement default umask for 640 file permissions
Some secrets are being created with undesirable permissions. Upon
inspection it was noticed that in general Pegleg is creating files,
then changing permissions after the fact. This leads to a small
window where the permissions on a file are overly permissive.

This patchset:
1. Sets default umask of 0o027 (640 permissions for files)
2. Explicitly adds the open flag ('r', 'w' etc.) to all open() calls.
3. Replaces sys.stdout.write calls with click.echo() calls to be more
   in line with the rest of the project.
4. Re-orders methods that write so that data is always first, and the
   path is always second.
5. Updates unit tests.
6. Adds unit tests for testing directory and file permissions.
7. Minor style changes.

Change-Id: I0c154aa311ea371940fd24b0aabf58fffaf1d231
2019-06-29 17:56:55 +00:00
Alexander Hughes 820df6d625 Genesis Bundle Encryption Key source
Previously the site PEGLEG_PASSPHRASE variable was used to encrypt the
genesis bundle. This is not always desired.

This patch:
1. Separates the Pegleg and Promenade encryption credentials
2. Simplifies the bundle code to avoid circular setting of environment
   variables unnecessarily.

Change-Id: I2195cf8df81d3775402299d9a2b0aad4ba483b2c
2019-06-11 13:15:08 +00:00
Ahmad Mahmoudi c4f25b4d4f CLI: Add command to generate genesis bundle
Added a pegleg cli command to build genesis.sh bundle for
a site deployment.
Pegleg imports promenade engine, and uses promenade to build
and encrypt the genesis.sh deployment bundle.

Change-Id: I1a489459b2c56b7b53018c32aab5e6550c69e1d2
2019-03-07 03:00:30 -06:00