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

WIP: Add python3 and virtual environment support #8

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
408845f
Rubocop fixes
mojibake-umd Jul 8, 2022
03b8f98
augeas_core fixture required for Puppet > 6
mojibake-umd Jul 8, 2022
369f5dc
remove jethrocarr/initfact dependency
mojibake-umd Jul 11, 2022
c10011b
pip install is no longer an option
mojibake-umd Jul 11, 2022
58c1b91
WIP: Manage python installation
mojibake-umd Jul 11, 2022
9a86749
Implement virtual environments
mojibake-umd Jul 12, 2022
9ad0a7f
Attempt to eliminate hardcoded paths for yas3fs and python
mojibake-umd Jul 14, 2022
4f15753
move simple defaults to init.pp
mojibake-umd Jul 15, 2022
c8ae014
Let python class or user manage pip
mojibake-umd Jul 15, 2022
904dee8
Remove python class
mojibake-umd Jul 15, 2022
95b6ff3
Rename package class to install class
mojibake-umd Jul 15, 2022
0c1c962
Add python_version specs
mojibake-umd Jul 15, 2022
65997fc
spec/defines/mount_spec.rb: Target Supported Operating Systems
mojibake-umd Jul 15, 2022
db2740f
Trigger install on vcsrepo refresh
mojibake-umd Jul 18, 2022
77dbb39
Need more specific pip version
mojibake-umd Jul 18, 2022
2aa7ef7
Fix install exec creates location
mojibake-umd Jul 26, 2022
58184fb
Optionally manage yas3fs requirements.txt
mojibake-umd Jul 27, 2022
2f51dae
default venv_path = /opt/yas3fs/venv
mojibake-umd Jul 28, 2022
0ff91d2
completely manage/unmanage python
Aug 26, 2022
dccddc5
Follow python class version scheme
Aug 26, 2022
d58d23c
pyenv needs major and minor version number
Aug 26, 2022
86829df
fix install creates cleanup on first vcs pull
Aug 26, 2022
7e4a1ec
Be more explicit with source command/built-in
Aug 26, 2022
bff20c6
pyvenv needs some base system pip packages
Aug 26, 2022
65061f6
Revert "pyvenv needs some base system pip packages"
Sep 6, 2022
2d0ada7
manage_python = false is better default
Sep 6, 2022
5a07cbc
params.pp: When to set manage_requirements = true
Sep 6, 2022
532c965
Install venv before yas3fs
Sep 6, 2022
87b2a8b
Virtual Environments are only validate with python3+
Sep 7, 2022
3cf8977
Make sure requirements installe for all OSes
Sep 8, 2022
963cafa
trigger requirements to be installed on change
Sep 9, 2022
3940ea6
Ensure venv parent dirs exist
Nov 4, 2022
2af2485
Add spec for venv_path deep path
Nov 4, 2022
c10fc2d
Version bump: 0.5.0
Nov 4, 2022
7451539
Finish /usr/local/bin support.
Nov 4, 2022
bf0b0fb
Avoid duplicate declarations.
Nov 11, 2022
aee8be0
Update documentation
Nov 14, 2022
8eeabe8
Move manage_requirements default
Nov 14, 2022
19b8dc8
Add some data types
Nov 14, 2022
0f984bc
Big version bump
Nov 14, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
fixtures:
repositories:
"stdlib": "git://github.com/puppetlabs/puppetlabs-stdlib.git"
forge_modules:
augeas_core: 'puppetlabs/augeas_core'
epel:
repo: 'puppet/epel'
ref: '3.0.1'
python: 'puppet/python'
stdlib: 'puppetlabs/stdlib'
vcsrepo:
repo: 'puppetlabs/vcsrepo'
ref: '3.2.1'
yumrepo_core: 'puppetlabs/yumrepo_core'
symlinks:
"yas3fs": "#{source_dir}"
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@

All notable changes to this project will be documented in this file.

## Release 0.4.0
## Release 0.5.0

**Features**

Add python3 and virtual environment support

**Bugfixes**

**Known Issues**

When not using virtual environment, please confirm install
location of yas3fs and make symlink from /usr/local/bin/yas3fs
if not created in /usr/local/bin
103 changes: 53 additions & 50 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,71 +32,41 @@ invalidating caches on other nodes using SQS and SNS.

* fuse package and configuration
* init jobs (sysvinit, upstart or systemd) that are used to manage yas3fs mounts
* python-pip package (optional)
* python package

###Beginning with yas3fs

To install fuse, python-pip, and yas3fs
```puppet
class { 'yas3fs': }
```
To install fuse, python-pip, and yas3fs from github source
```puppet
class { 'yas3fs':
provider: 'vcs',
}
```

If you'd rather provide pip though some other means, set
`install_pip_package` to `false`:
To install fuse and yas3fs from github source
```puppet
class { 'yas3fs':
install_pip_package => false,
}
```

##Usage

###Classes and Defined Types

####Class: `yas3fs`

The primary module. By default, fuse, python-pip, and yas3fs are installed and
The primary module. By default, fuse, and yas3fs are installed and
configured.

**Parameters within `yas3fs`**

#####`install_pip_package`

When set to true, the python-pip package is installed. If the parameter is false
then the pip command should be provided by some other means or yas3fs will not
be installed.

#####`init_system`

Defines the type of init script/configuration to install out of `upstart`,
`systemd` or `sysvinit`. If the parameter is unset, autodiscovery takes place.
Default: $facts['service_provider']

#####`provider`
#####`manage_python`

Sets if yas3fs should installed from default pip package provider
or if github source is pulled and pip package is built.
Set to 'vcs' to build from github source.
To switch to vcs from yas3fs previously installied pip package
manually intervention is required. Please manually
uninstall previosly installied pip package before switching to
vcs type install.
Default: 'pip'
Defines if this module should attempt to install and manage python
Default: false

#####`vcs_remote`
#####`manage_requirements`:

Optionally set yas3fs source code to be other than original
Default: 'https://github.com/danilop/yas3fs.git'

#####`vcs_revision`

Optionally set to use code from a specific commit or branch
Default: 'master'
Defines if this module should attempt to install and manage yas3fs dependencies.
Default: true

#####`mounts`

Expand All @@ -113,6 +83,30 @@ class { 'yas3fs':
}
}
```
#####`python_version`:

Which version /usr/bin/pythonX[.Y] should be used to run yas3fs?
Major version X require, minor version Y is optional.
i.g. 3,3.6,3.8,2,2.7
Default: 3

#####`vcs_remote`

Optionally set yas3fs source code to be other than original
Default: 'https://github.com/danilop/yas3fs.git'

#####`vcs_revision`

Optionally set to use code from a specific commit or branch
Default: '5bbf8296b5cb16c8afecad94ea55d03c4052a683' # v2.4.6 No tag available

#####`venv_path`

Path to python virtual environment.
If set to '' system python library path will be used.
Highly recommend installing yas3fs to a virtual environment
to avoid causing issues with your python based package
management systems i.g. apt, yum...

####Defined Type: `yas3fs::mount`

Expand All @@ -132,6 +126,14 @@ yas3fs::mount { 'example-mount':

**Parameters within `yas3fs::mount`**

#####`s3_url`

The S3 URL that should be mounted (e.g. s3://my-bucket/my-path)

#####`local_path`

The location where the S3 bucket should be mounted.

#####`ensure`

Control what to do with this mount. Valid values are `mounted` (default), `unmounted`, `absent`,
Expand All @@ -140,24 +142,25 @@ and `present`.
WARNING: setting ensure to `absent` removes the service configuration, but cannot
verify that the service is stopped.

#####`s3_url`
#####`init_system`

The S3 URL that should be mounted (e.g. s3://my-bucket/my-path)
Your init system so that proper mount startup script can be created.

#####`local_path`
#####`options`

The location where the S3 bucket should be mounted.
An array of command line arguments that should be passed to yas3fs. The leading
dashes can be omitted. A full list of options is in the
[yas3fs documentation](https://github.com/danilop/yas3fs/blob/master/README.md).

#####`aws_access_key_id` and `aws_secret_access_key`

The credentials to use when connecting to AWS. Credentials can be omitted on EC2
instances with appropriate IAM roles assigned.

#####`options`
#####`venv_path`

An array of command line arguments that should be passed to yas3fs. The leading
dashes can be omitted. A full list of options is in the
[yas3fs documentation](https://github.com/danilop/yas3fs/blob/master/README.md).
The virtual environment where yas3fs is installed.
Help your init system start the mount properly.

##Reference

Expand All @@ -170,7 +173,7 @@ dashes can be omitted. A full list of options is in the
####Private Classes

* `yas3fs::config`: Manages the fuse configuration
* `yas3fs::package`: Installs pip, fuse, and yas3fs
* `yas3fs::install`: Installs fuse, and yas3fs
* `yas3fs::params`: Manages base parameters

###Defined Types
Expand All @@ -182,4 +185,4 @@ dashes can be omitted. A full list of options is in the
##Limitations

yas3fs is written for python 2.6, though there has been a lot of success running
it on 2.7.
it on 2.7, and now 3.x.
7 changes: 7 additions & 0 deletions files/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This file is puppet managed
# any changes will be removed
# by puppet.
# Minimum requirements for yas3fs
setuptools>=2.2
boto>=2.25.0
boto3>=1.6.12
12 changes: 7 additions & 5 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
class yas3fs::config {
assert_private()

file { '/etc/fuse.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0664',
if ! defined(File['/etc/fuse.conf']) {
file { '/etc/fuse.conf':
ensure => present,
owner => 'root',
group => 'root',
mode => '0664',
}
}

augeas { 'fuse.conf:user_allow_other':
Expand Down
48 changes: 41 additions & 7 deletions manifests/init.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,49 @@
# A module to manage S3 mounts using yas3fs
# * `init_system`:
# Specify the init system used. i.g. sysv, systemd
#
# * `manage_python`:
# Should this module attempt to install and manage
# python?
#
# * `manage_requirements`:
# Should this module attempt to install and manage
# yas3fs dependencies?
#
# * `mounts`:
# A hash of mounts and mount options passed to
# defined type yas3fs::mount
#
# * `python_version`:
# Which version /usr/bin/pythonX[.Y] should be
# used to run yas3fs?
#
# * `vcsrepo`:
# The VCS repository to fetch yas3fs code.
#
# * `vcs_revision`:
# Revision/Commit/Branch/Tag to check out
# when installing yas3fs
#
# * `venv_path`:
# If set to '' system python library path will be used.
# Highly recommend installing yas3fs to a virtual environment
# to avoid causing issues with your python based package
# management systems i.g. apt, yum...
#
class yas3fs (
$install_pip_package = $::yas3fs::params::install_pip_package,
$init_system = $::yas3fs::params::init_system,
$mounts = {},
Enum['pip', 'vcs'] $provider = $::yas3fs::params::provider,
$vcs_remote = $::yas3fs::params::vcs_remote,
$vcs_revision = $::yas3fs::params::vcs_revision,
Enum['systemd','sysvinit','upstart'] $init_system = $::yas3fs::params::init_system,
Boolean $manage_python = false,
Boolean $manage_requirements = true,
Hash $mounts = {},
String[1] $python_version = '3', # Versions 2,2.7,3,3.6
String[9] $vcs_remote = 'https://github.com/danilop/yas3fs.git',
String[1] $vcs_revision = '5bbf8296b5cb16c8afecad94ea55d03c4052a683', # v2.4.6 No tag available
String $venv_path = '/opt/yas3fs/venv', #Path to install python virtual environment
) inherits yas3fs::params {

anchor { 'yas3fs::begin': }
-> class { '::yas3fs::package': }
-> class { '::yas3fs::install': }
-> class { '::yas3fs::config': }
-> anchor { 'yas3fs::end':}

Expand Down
Loading