chef_helpers 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.config.reek +3 -0
- data/.gitignore +10 -0
- data/.overcommit.yml +46 -0
- data/.rspec +2 -0
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +8 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/Gemfile +25 -0
- data/Guardfile +30 -0
- data/LICENSE.txt +21 -0
- data/README.md +76 -0
- data/Rakefile +14 -0
- data/bin/console +11 -0
- data/bin/setup +7 -0
- data/chef_helpers.gemspec +25 -0
- data/lib/chef_helpers.rb +35 -0
- data/lib/chef_helpers/exceptions.rb +16 -0
- data/lib/chef_helpers/version.rb +3 -0
- data/ruby-lint.yml +7 -0
- metadata +213 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 9a491b130004bcf71472edcc0f8fb1284fbf0bb7
|
4
|
+
data.tar.gz: 6e2e3e916fa05785ab34ab5841c01f3255f3157c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 54532b47360ddef55771548d145f6433c49b55a77ecb44e4ff43f5f2e9b0acc0b2130049e3d2a8b1eac65964b7badab26c69e7cfe707495640fb72fcb3ea6290
|
7
|
+
data.tar.gz: a5087c580ed46f456fb72f09f1a461b0066f318ca79125a19ffa44053f28551a840f976fe7b60f348ff8f6f1a9cacf56ac480192ec043c19e8622eb382c27c64
|
data/.config.reek
ADDED
data/.gitignore
ADDED
data/.overcommit.yml
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
# Use this file to configure the Overcommit hooks you wish to use. This will
|
2
|
+
# extend the default configuration defined in:
|
3
|
+
# https://github.com/brigade/overcommit/blob/master/config/default.yml
|
4
|
+
#
|
5
|
+
# At the topmost level of this YAML file is a key representing type of hook
|
6
|
+
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
|
7
|
+
# customize each hook, such as whether to only run it on certain files (via
|
8
|
+
# `include`), whether to only display output if it fails (via `quiet`), etc.
|
9
|
+
#
|
10
|
+
# For a complete list of hooks, see:
|
11
|
+
# https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
|
12
|
+
#
|
13
|
+
# For a complete list of options that you can use to customize hooks, see:
|
14
|
+
# https://github.com/brigade/overcommit#configuration
|
15
|
+
#
|
16
|
+
# Uncomment the following lines to make the configuration take effect.
|
17
|
+
|
18
|
+
PreCommit:
|
19
|
+
RuboCop:
|
20
|
+
enabled: true
|
21
|
+
on_warn: fail # Treat all warnings as failures
|
22
|
+
|
23
|
+
Reek:
|
24
|
+
enabled: true
|
25
|
+
|
26
|
+
RubyLint:
|
27
|
+
enabled: true
|
28
|
+
|
29
|
+
Flog:
|
30
|
+
enabled: true
|
31
|
+
|
32
|
+
TrailingWhitespace:
|
33
|
+
enabled: true
|
34
|
+
exclude:
|
35
|
+
- '**/db/structure.sql' # Ignore trailing whitespace in generated files
|
36
|
+
|
37
|
+
CommitMsg:
|
38
|
+
SpellCheck:
|
39
|
+
enabled: true
|
40
|
+
|
41
|
+
PostCheckout:
|
42
|
+
ALL: # Special hook name that customizes all hooks of this type
|
43
|
+
quiet: true # Change all post-checkout hooks to only display output on failure
|
44
|
+
|
45
|
+
IndexTags:
|
46
|
+
enabled: true # Generate a tags file with `ctags` each time HEAD changes
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2015-10-23 14:28:36 -0600 using RuboCop version 0.34.2.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
chef_helpers
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2.3
|
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
4
|
+
|
5
|
+
We are committed to making participation in this project a harassment-free experience for everyone, regardless of gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
|
6
|
+
|
7
|
+
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
8
|
+
|
9
|
+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
10
|
+
|
11
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
12
|
+
|
13
|
+
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
data/Gemfile
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in chef_helpers.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
group :development, :test do
|
7
|
+
gem 'rubocop', require: false
|
8
|
+
gem 'rubocop-rspec', require: false
|
9
|
+
end
|
10
|
+
|
11
|
+
group :local do
|
12
|
+
gem 'guard-rspec', require: false
|
13
|
+
gem 'simplecov', require: false
|
14
|
+
gem 'pry'
|
15
|
+
gem 'pry-theme'
|
16
|
+
gem 'colorize', require: false
|
17
|
+
gem 'reek', require: false
|
18
|
+
gem 'flog', require: false
|
19
|
+
gem 'overcommit'
|
20
|
+
gem 'guard-yard', require: false
|
21
|
+
gem 'rb-fsevent', require: false if RUBY_PLATFORM =~ /darwin/i
|
22
|
+
gem 'ruby-lint', require: false, github: 'baberthal/ruby-lint'
|
23
|
+
gem 'ruby_gntp'
|
24
|
+
gem 'rubycritic'
|
25
|
+
end
|
data/Guardfile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
notification :gntp, host: '127.0.0.1'
|
2
|
+
|
3
|
+
rspec_opts = {
|
4
|
+
cmd: 'rspec',
|
5
|
+
all_after_pass: false,
|
6
|
+
all_on_start: false,
|
7
|
+
failed_mode: :focus
|
8
|
+
}
|
9
|
+
|
10
|
+
guard :rspec, rspec_opts do
|
11
|
+
require 'guard/rspec/dsl'
|
12
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
13
|
+
|
14
|
+
# Feel free to open issues for suggestions and improvements
|
15
|
+
|
16
|
+
# RSpec files
|
17
|
+
rspec = dsl.rspec
|
18
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
19
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
20
|
+
watch(rspec.spec_files)
|
21
|
+
|
22
|
+
# Ruby files
|
23
|
+
ruby = dsl.ruby
|
24
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
25
|
+
end
|
26
|
+
|
27
|
+
guard 'yard' do
|
28
|
+
watch(%r{lib/.+\.rb})
|
29
|
+
end
|
30
|
+
# vim: set ts=8 sw=2 tw=0 ft=ruby et :
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Morgan Lieberthal
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# ChefHelpers
|
2
|
+
|
3
|
+
This gem provides a set of helper methods to use in chef recipies. Currently, the only implemented method is `#encrypt_password`, which takes a plain-text password and generates a shadow hash for use by the User resource.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'chef_helpers'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install chef_helpers
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
Include the gem in your chef cookbook:
|
24
|
+
|
25
|
+
In a recipe:
|
26
|
+
```ruby
|
27
|
+
extend ChefHelpers
|
28
|
+
```
|
29
|
+
|
30
|
+
In an LWRP:
|
31
|
+
```ruby
|
32
|
+
include ChefHelpers
|
33
|
+
```
|
34
|
+
|
35
|
+
In any ruby file:
|
36
|
+
```ruby
|
37
|
+
include ChefHelpers
|
38
|
+
```
|
39
|
+
|
40
|
+
Encrypt a password like this:
|
41
|
+
```ruby
|
42
|
+
password = 'shhitsasecret'
|
43
|
+
shadow_hash = encrypt_password(password)
|
44
|
+
```
|
45
|
+
|
46
|
+
Use it in a user recipe like this:
|
47
|
+
```ruby
|
48
|
+
password_hash = encrypt_password('shhitsasecret')
|
49
|
+
|
50
|
+
user 'my_user' do
|
51
|
+
password password_hash
|
52
|
+
...
|
53
|
+
end
|
54
|
+
```
|
55
|
+
|
56
|
+
## Development
|
57
|
+
|
58
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
59
|
+
|
60
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
61
|
+
|
62
|
+
## Contributing
|
63
|
+
|
64
|
+
1. Fork this repo
|
65
|
+
2. Create a new branch for your feature
|
66
|
+
3. Write specs for the feature / method
|
67
|
+
4. Implement the feature / method
|
68
|
+
5. Create a pull request
|
69
|
+
6. ???
|
70
|
+
7. Profit
|
71
|
+
|
72
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/baberthal/chef_helpers.
|
73
|
+
|
74
|
+
## License
|
75
|
+
|
76
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
require 'rubocop/rake_task'
|
4
|
+
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
desc 'Run RuboCop'
|
8
|
+
RuboCop::RakeTask.new(:rubocop) do |task|
|
9
|
+
task.patterns = %w(lib/**/*.rb)
|
10
|
+
task.formatters = %w(files fuubar)
|
11
|
+
task.fail_on_error = false
|
12
|
+
end
|
13
|
+
|
14
|
+
task default: [:spec, :rubocop]
|
data/bin/console
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'chef_helpers'
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
require 'pry'
|
11
|
+
Pry.start
|
data/bin/setup
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chef_helpers/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'chef_helpers'
|
8
|
+
spec.version = ChefHelpers::VERSION
|
9
|
+
spec.authors = ['Morgan Lieberthal']
|
10
|
+
spec.email = ['morgan@jmorgan.org']
|
11
|
+
|
12
|
+
spec.summary = 'Provides a set of helper methods for chef recipes.'
|
13
|
+
spec.description = File.read(File.expand_path('../README.md', __FILE__))
|
14
|
+
spec.homepage = 'https://github.com/baberthal/chef_helpers.git'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } # rubocop:disable Metrics/LineLength
|
18
|
+
spec.require_paths = ['lib']
|
19
|
+
|
20
|
+
spec.add_dependency 'unix-crypt', '~> 1.3'
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.3'
|
24
|
+
spec.add_development_dependency 'yard'
|
25
|
+
end
|
data/lib/chef_helpers.rb
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'chef_helpers/version'
|
2
|
+
require 'chef_helpers/exceptions'
|
3
|
+
require 'unix_crypt'
|
4
|
+
|
5
|
+
# The top-level namespace
|
6
|
+
module ChefHelpers
|
7
|
+
# Returns an encrypted, salted password hash for use in /etc/shadow and by
|
8
|
+
# the Chef user resource.
|
9
|
+
#
|
10
|
+
# @param [String] password the password to encrypt.
|
11
|
+
# @param [Symbol] hash_algo a symbol identifying the hashing algorithm to use.
|
12
|
+
# Valid options are:
|
13
|
+
# :sha512
|
14
|
+
# :sha256
|
15
|
+
# :md5
|
16
|
+
# :des
|
17
|
+
#
|
18
|
+
# @raise [InvalidPasswordError] if the generated hash does not match the
|
19
|
+
# password that was passed into the method.
|
20
|
+
#
|
21
|
+
# @return [String] the encrypted, salted password hash.
|
22
|
+
#
|
23
|
+
def encrypt_password(password, hash_algo = :sha512)
|
24
|
+
build_password(password, hash_algo).tap do |pw|
|
25
|
+
fail InvalidPasswordError unless UnixCrypt.valid?(password, pw)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def build_password(password, hash_algo = :sha512)
|
32
|
+
hashing_alogrithm = UnixCrypt.const_get(hash_algo.upcase)
|
33
|
+
hashing_alogrithm.build(password)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ChefHelpers
|
2
|
+
# Namespace for Exceptions raised by methods provided by [ChefHelpers]
|
3
|
+
module Exceptions
|
4
|
+
# This exception is raised if a password was generated, but for some reason
|
5
|
+
# does not match the password that was supposed to be encrypted.
|
6
|
+
#
|
7
|
+
class InvalidPasswordError < StandardError
|
8
|
+
# Error message specific to the InvalidPasswordError.
|
9
|
+
#
|
10
|
+
# @return [String] The error message.
|
11
|
+
def message
|
12
|
+
'The password hash generated did not match the password passed in.'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/ruby-lint.yml
ADDED
metadata
ADDED
@@ -0,0 +1,213 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef_helpers
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Morgan Lieberthal
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-10-23 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: unix-crypt
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.10'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.10'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '10.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '10.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.3'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.3'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: yard
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: |
|
84
|
+
# ChefHelpers
|
85
|
+
|
86
|
+
This gem provides a set of helper methods to use in chef recipies. Currently, the only implemented method is `#encrypt_password`, which takes a plain-text password and generates a shadow hash for use by the User resource.
|
87
|
+
|
88
|
+
## Installation
|
89
|
+
|
90
|
+
Add this line to your application's Gemfile:
|
91
|
+
|
92
|
+
```ruby
|
93
|
+
gem 'chef_helpers'
|
94
|
+
```
|
95
|
+
|
96
|
+
And then execute:
|
97
|
+
|
98
|
+
$ bundle
|
99
|
+
|
100
|
+
Or install it yourself as:
|
101
|
+
|
102
|
+
$ gem install chef_helpers
|
103
|
+
|
104
|
+
## Usage
|
105
|
+
|
106
|
+
Include the gem in your chef cookbook:
|
107
|
+
|
108
|
+
In a recipe:
|
109
|
+
```ruby
|
110
|
+
extend ChefHelpers
|
111
|
+
```
|
112
|
+
|
113
|
+
In an LWRP:
|
114
|
+
```ruby
|
115
|
+
include ChefHelpers
|
116
|
+
```
|
117
|
+
|
118
|
+
In any ruby file:
|
119
|
+
```ruby
|
120
|
+
include ChefHelpers
|
121
|
+
```
|
122
|
+
|
123
|
+
Encrypt a password like this:
|
124
|
+
```ruby
|
125
|
+
password = 'shhitsasecret'
|
126
|
+
shadow_hash = encrypt_password(password)
|
127
|
+
```
|
128
|
+
|
129
|
+
Use it in a user recipe like this:
|
130
|
+
```ruby
|
131
|
+
password_hash = encrypt_password('shhitsasecret')
|
132
|
+
|
133
|
+
user 'my_user' do
|
134
|
+
password password_hash
|
135
|
+
...
|
136
|
+
end
|
137
|
+
```
|
138
|
+
|
139
|
+
## Development
|
140
|
+
|
141
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
142
|
+
|
143
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
144
|
+
|
145
|
+
## Contributing
|
146
|
+
|
147
|
+
1. Fork this repo
|
148
|
+
2. Create a new branch for your feature
|
149
|
+
3. Write specs for the feature / method
|
150
|
+
4. Implement the feature / method
|
151
|
+
5. Create a pull request
|
152
|
+
6. ???
|
153
|
+
7. Profit
|
154
|
+
|
155
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/baberthal/chef_helpers.
|
156
|
+
|
157
|
+
## License
|
158
|
+
|
159
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
160
|
+
email:
|
161
|
+
- morgan@jmorgan.org
|
162
|
+
executables: []
|
163
|
+
extensions: []
|
164
|
+
extra_rdoc_files: []
|
165
|
+
files:
|
166
|
+
- ".config.reek"
|
167
|
+
- ".gitignore"
|
168
|
+
- ".overcommit.yml"
|
169
|
+
- ".rspec"
|
170
|
+
- ".rubocop.yml"
|
171
|
+
- ".rubocop_todo.yml"
|
172
|
+
- ".ruby-gemset"
|
173
|
+
- ".ruby-version"
|
174
|
+
- ".travis.yml"
|
175
|
+
- CODE_OF_CONDUCT.md
|
176
|
+
- Gemfile
|
177
|
+
- Guardfile
|
178
|
+
- LICENSE.txt
|
179
|
+
- README.md
|
180
|
+
- Rakefile
|
181
|
+
- bin/console
|
182
|
+
- bin/setup
|
183
|
+
- chef_helpers.gemspec
|
184
|
+
- lib/chef_helpers.rb
|
185
|
+
- lib/chef_helpers/exceptions.rb
|
186
|
+
- lib/chef_helpers/version.rb
|
187
|
+
- ruby-lint.yml
|
188
|
+
homepage: https://github.com/baberthal/chef_helpers.git
|
189
|
+
licenses:
|
190
|
+
- MIT
|
191
|
+
metadata: {}
|
192
|
+
post_install_message:
|
193
|
+
rdoc_options: []
|
194
|
+
require_paths:
|
195
|
+
- lib
|
196
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
|
+
requirements:
|
203
|
+
- - ">="
|
204
|
+
- !ruby/object:Gem::Version
|
205
|
+
version: '0'
|
206
|
+
requirements: []
|
207
|
+
rubyforge_project:
|
208
|
+
rubygems_version: 2.4.8
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: Provides a set of helper methods for chef recipes.
|
212
|
+
test_files: []
|
213
|
+
has_rdoc:
|