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

Fix group ownership on directory #36

Open
wants to merge 40 commits into
base: pull_here
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
bae6c8e
trying using the shell provider...
Jul 22, 2013
d4694c9
Reverting to using su as Exec strips environment variables required t…
Jul 22, 2013
608f92d
-l works?
Jul 22, 2013
9d7b47b
update README noting EOL of this module!
Jul 23, 2013
8a94bb9
Update README, created Windows Powershell script to create a Modulefi…
Aethylred Aug 27, 2012
fc40538
Rework powershell script to update all the files from templates with …
Aethylred Aug 27, 2012
dc020c5
First go with a cleanup script, be careful with it, git reset --hard …
Aethylred Aug 28, 2012
ab368a7
Changed from the Creative Commons (which is not suitable for software…
Aethylred Sep 11, 2012
cc36221
added a .gitignore
Aethylred Sep 11, 2012
dac4a5b
update the instructions in README1st.markdown
Mar 1, 2013
2caa718
This update should prime the puppet-blank for testing with Travis CI …
Apr 22, 2013
c05f270
change hard tabs to spaces
Apr 22, 2013
1deb8d0
Fix typos in unblank and tune Travis setup
May 8, 2013
2eb5bc0
New Version! 0.1.0
Aug 19, 2013
7a4ea95
Add .project to .gitignore for Eclipse users
Aug 29, 2013
655b04d
add Eclipse/Geppetto .project file to .gitignore
Sep 6, 2013
b8f4b75
Merge branch 'master' of [email protected]:Aethylred/puppet-blank.git
Sep 8, 2013
599a0a3
Update travis config to use rspec-puppet-augeas
Sep 10, 2013
1b020c7
update documentation to include rspec-puppet-augeas
Sep 10, 2013
5f16330
Improve Travis setup now includes:
Oct 30, 2013
de4f778
Merge remote-tracking branch 'blank/rspec_augeas' into refactor
Oct 30, 2013
79cef1e
Cleanup blank remnants.
Oct 30, 2013
b67c7bb
Some work on the README and a stub test for git.
Oct 30, 2013
ab12ccd
Update to comply with puppet-lint checks
Oct 30, 2013
317e918
Set paramaters by osfamily fact, and remove git::install from git cla…
Oct 30, 2013
3711d2c
Merge git::install into git class
Oct 30, 2013
3e871ac
depreciation warning in git::repo
Oct 30, 2013
4b168e4
Finish documenting git class parameters.
Oct 30, 2013
c42536d
ensure for the git package should override the ensure for git)_gui an…
Oct 30, 2013
f7ba20f
breakpoint for changing from git-core to git should be 10/11 not 11/1…
Oct 30, 2013
d5639fa
Markup README to get puppet syntax highlighting in code blocks
Oct 30, 2013
bef9641
Version 0.1.1
Oct 31, 2013
ee05889
Add travis status image.
Oct 31, 2013
b9f0302
Add timeout parameter to git::repo
citec Oct 31, 2013
667903c
Further restriction of the git vs. git-core test to just Ubuntu.
Oct 31, 2013
b3808d3
Merge pull request #32 from citec/timeout_parameter
Aethylred Oct 31, 2013
5624532
version 0.1.2
Oct 31, 2013
6545b57
Remove -l parameter from su. This forces the users enviroment to be …
b4ldr Feb 3, 2014
4468370
Merge pull request #34 from b4ldr/master
Aethylred Feb 4, 2014
f0a3869
FIX group ownership on directory
citec Feb 17, 2014
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
5 changes: 5 additions & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
symlinks:
git: "#{source_dir}"
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,9 @@ Thumbs.db
obj/
[Rr]elease*/
_ReSharper*/
pkg/*
[Tt]est[Rr]esult*
*~
.project
*~
*.sublime-project
*.sublime-workspace
35 changes: 35 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
language: ruby
bundler_args: --without development
script: "bundle exec rake validate && bundle exec rake lint && bundle exec rake spec SPEC_OPTS='--format documentation'"
before_install:
- sudo apt-get install -qq augeas-tools augeas-lenses libaugeas-dev libaugeas-ruby
rvm:
- 1.8.7
- 1.9.3
- 2.0.0
env:
matrix:
- PUPPET_GEM_VERSION="~> 2.6.0"
- PUPPET_GEM_VERSION="~> 2.7.0"
- PUPPET_GEM_VERSION="~> 3.0.0"
- PUPPET_GEM_VERSION="~> 3.1.0"
- PUPPET_GEM_VERSION="~> 3.2.0"
- PUPPET_GEM_VERSION="~> 3.3.1"
matrix:
allow_failures:
- env: PUPPET_GEM_VERSION="~> 2.6.0"
exclude:
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 1.9.3
env: PUPPET_GEM_VERSION="~> 2.6.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.6.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 2.7.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.0.0"
- rvm: 2.0.0
env: PUPPET_GEM_VERSION="~> 3.1.0"
notifications:
email: false
20 changes: 20 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
source 'https://rubygems.org'

group :development, :test do
gem 'rake', :require => false
gem 'rspec-puppet', :require => false
gem 'puppetlabs_spec_helper', :require => false
gem 'ruby-augeas', :require => false
gem 'rspec-puppet-augeas', :require => false
gem 'rspec-system', :require => false
gem 'rspec-system-puppet', :require => false
gem 'puppet-lint', :require => false
end

if puppetversion = ENV['PUPPET_GEM_VERSION']
gem 'puppet', puppetversion, :require => false
else
gem 'puppet', :require => false
end

# vim:ft=ruby
4 changes: 2 additions & 2 deletions Modulefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name 'nesi-git'
version '0.0.1'
name 'Aethylred-git'
version '0.1.2'
source 'https://github.com/nesi/puppet-git'
author 'Aaron Hicks'
license 'GPL3'
Expand Down
121 changes: 76 additions & 45 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,81 +1,97 @@
# puppet-git
============

A puppet module for managing git resources
[![Build Status](https://travis-ci.org/nesi/puppet-git.png?branch=master)](https://travis-ci.org/nesi/puppet-git)

# To install into puppet
A puppet module for managing the installation and configuration of [git](http://git-scm.com/).

Clone into your puppet configuration in your `puppet/modules` directory:
**WARNING** Changes to how Puppet sets up the environment variables with `exec` resources means this module no longer works as intended when managing repositories as any user other than root. It is recommended that the [Puppetlabs vcsrepo module](https://github.com/puppetlabs/puppetlabs-vcsrepo) is used manage repositories.

git clone git://github.com/nesi/puppet-git.git git
## Feature Roadmap

Or if you're managing your Puppet configuration with git, in your `puppet` directory:
This module is going to be refactored to operate in conjunction to the vcsrepo module. It will manage the installation of git, the configuration of git specific settings, executing git commands, and eventually the management of git hook scripts.

git submodule add git://github.com/nesi/puppet-git.git modules/git --init --recursive
cd modules/git
git checkout master
git pull
cd ../..
git commit -m "added git submodule from https://github.com/nesi/puppet-git"
#### Implemented Features:
* Installs git from packages
* Optionally installs git-svn from packages (defaults installed)
* Optionally installs git-gui from packages (defaults not installed)

It might seem bit excessive, but it will make sure the submodule isn't headless...
#### Features not yet updated
* Initialising user accounts with git configurations

#### Features to be Implemented
* Sets git user's globals settings
* Sets git repository local settings
* Executes git commands
* Pushes hook scripts into git repositories

# Usage

## To install git

A basic install with the defaults would be:

include git
A basic install with the defaults would be:
```puppet
include git
```

Otherwise using the parametrs:

class{git:
svn => true,
gui => true,
}
Otherwise using the parametrs:
```puppet
class{git:
svn => 'installed',
gui => 'installed',
}
```

### Parameters

* *svn* if true the git-svn package will also be installed
* *gui* if true the git-gui package will also be installed
* **ensure**: Sets the ensure parameter passed to the git package. The default is `installed`.
* **svn**: Sets the ensure paramater passed to the git-svn package. The default is `installed`.
* **gui**: Sets the ensure parameter passed to the git-gui package. The default is `absent`.
* **package**: Specifies a custom package. The default is `git`, except for older versions of Debian and Ubuntu where the default is `git-core`.
* **git_root**: Currently does nothing, it's functionality is to be reviewed.

## To set up git for a user

This basically sets the users name and email as git global variables, and should allow them to just use git. The username should be a valid user account.

With default settings just use:

git::user{'username':}
With default settings just use:
```puppet
git::user{'username':}
```

Otherwise using parameters:

git::user{'username':
user_name => 'Some User',
user_email => '[email protected]',
}
Otherwise using parameters:
```puppet
git::user{'username':
user_name => 'Some User',
user_email => '[email protected]',
}
```

### Parameters

* *user_name* sets the user's name to the specified string, and not the default of `${name} on ${fqdn}`, where fqdn is the fully qualified domain name as discovered by facter.
* *user_email* sets the user's email address to the specified string, and not the default of `${name}@${fqdn}`, where fqdn is the fully qualified domain name as discovered by facter.

## To specify a git repository

This will clone a git repository from a vaild git URI to a specified path on the target server. It is **strongly** recommended that *read-only* git URIs are used. If no source is given, the target path will simply be initialised as a git repository.
## To specify a git repository

With minimum parameters, should create the directory `/usr/src/repo` and run `git init` in it:
**Using the `git::repo` class is depreciated and `vcsrepo` should be considered instead.**

git::repo{'repo_name':
path => '/usr/src/repo',
}

With minimum parameters to clone from a remote source:
This will clone a git repository from a vaild git URI to a specified path on the target server. It is **strongly** recommended that *read-only* git URIs are used. If no source is given, the target path will simply be initialised as a git repository.

git::repo{'repo_name':
path => '/usr/src/repo',
source => 'git://example.org/example/repo.git'
}
With minimum parameters, should create the directory `/usr/src/repo` and run `git init` in it:
```puppet
git::repo{'repo_name':
path => '/usr/src/repo',
}
```

With minimum parameters to clone from a remote source:
```puppet
git::repo{'repo_name':
path => '/usr/src/repo',
source => 'git://example.org/example/repo.git'
}
```

### Parameters

Expand All @@ -96,6 +112,8 @@ With minimum parameters to clone from a remote source:

# Attribution

## puppet-blank

This module is derived from the puppet-blank module by Aaron Hicks ([email protected])

* https://github.com/Aethylred/puppet-blank
Expand All @@ -104,6 +122,19 @@ This module has been developed for the use with Open Source Puppet (Apache 2.0 l

* http://puppetlabs.com/puppet/puppet-open-source/

## rspec-puppet-augeas

This module includes the [Travis](https://travis-ci.org) configuration to use [`rspec-puppet-augeas`](https://github.com/domcleal/rspec-puppet-augeas) to test and verify changes made to files using the [`augeas` resource](http://docs.puppetlabs.com/references/latest/type.html#augeas) available in Puppet. Check the `rspec-puppet-augeas` [documentation](https://github.com/domcleal/rspec-puppet-augeas/blob/master/README.md) for usage.

This will require a copy of the original input files to `spec/fixtures/augeas` using the same filesystem layout that the resource expects:
```
$ tree spec/fixtures/augeas/
spec/fixtures/augeas/
`-- etc
`-- ssh
`-- sshd_config
```

# Gnu General Public License

This file is part of the git Puppet module.
Expand Down
24 changes: 24 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'rubygems'
require 'puppetlabs_spec_helper/rake_tasks'
require 'rspec-system/rake_task'
require 'puppet-lint/tasks/puppet-lint'
PuppetLint.configuration.send('disable_80chars')
PuppetLint.configuration.send('disable_class_parameter_defaults')
PuppetLint.configuration.send('disable_class_inherits_from_params_class')
PuppetLint.configuration.ignore_paths = ["spec/**/*.pp", "pkg/**/*.pp"]

desc "Check for puppet and ruby syntax errors."
task :validate do
if ENV['PUPPET_GEM_VERSION'] == '~> 2.6.0'
puppet_parse_command = 'puppet --parseonly --ignoreimport'
else
puppet_parse_command = 'puppet parser validate --noop'
end
Dir['manifests/**/*.pp'].each do |path|
sh "#{puppet_parse_command} #{path}"
end
ruby_parse_command = 'ruby -c'
Dir['spec/**/*.rb'].each do |path|
sh "#{ruby_parse_command} #{path}"
end
end
44 changes: 38 additions & 6 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,45 @@
#
# Somewhat derived from https://github.com/theforeman/puppet-git
class git(
$gui = false,
$svn = true,
$ensure = 'installed',
$package = $git::params::package,
$gui = 'absent',
$svn = 'installed',
$git_root = false
) inherits git::params {
class{'git::install':
gui => $gui,
svn => $svn,
git_root => $git_root,

# ensure statement for the git package overrides svn and gui ensure.
case $ensure {
/^installed$|^(\d+)?(\.(x|\*|\d+))?(\.(x|\*|\d+))?(|-(\S+))$/: {
$ensure_svn = $svn
$ensure_gui = $gui
}
default: {
$ensure_svn = 'absent'
$ensure_gui = 'absent'
}
}

package{'git':
ensure => $ensure,
name => $package,
}

package{'git-svn':
ensure => $ensure_svn,
name => $git::params::svn_package,
}

package{'git-gui':
ensure => $ensure_gui,
name => $git::params::gui_package,
}

# Need to consider if this should happen or not.
# if $git_root {
# $root_name = "root on ${::fqdn}"
# $root_email = "root@${::fqdn}"
# git::user{'root':}
# }

}
42 changes: 0 additions & 42 deletions manifests/install.pp

This file was deleted.

Loading