Skip to content

Commit 4b8352f

Browse files
committed
Initial commit on https provider
1 parent 2c5d7ee commit 4b8352f

File tree

14 files changed

+668
-119
lines changed

14 files changed

+668
-119
lines changed

.fixtures.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
---
22
fixtures:
3-
symlinks:
4-
'node_manager': "#{source_dir}"
53
repositories:
64
pe_gem:
75
repo: https://github.com/puppetlabs/puppetlabs-pe_gem
86
ref: 0.1.2
9-
forge_modules:
10-
7+
symlinks:
8+
node_manager: "#{source_dir}"

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ spec/fixtures/
44
pkg/*
55
*.travis*
66
*.old
7+
checksums.json

CHANGELOG.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
## 2017-03-30 - Release 0.4.0
2+
3+
### Summary
4+
5+
- Added `https` provider which doesn't need `puppeclassify` gem
6+
- Added deprecation notice for `puppetclassify` provider
7+
18
## 2016-10-26 - Release 0.3.0
29
### Summary
310

HTTPS.md

+136
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,136 @@
1+
# node_manager [![Build Status](https://travis-ci.org/WhatsARanjit/prosvcs-node_manager.svg)](https://travis-ci.org/WhatsARanjit/prosvcs-node_manager)
2+
3+
#### Table of Contents
4+
1. [Overview](#overview)
5+
1. [Requirements](#requirements)
6+
1. [node_group type](#node_group)
7+
1. [node_groups() function](#node_groups)
8+
9+
## Overview
10+
11+
Create and manage PE Console node groups as resources.
12+
The `https` provider is meant to erase the dependecy on
13+
the `puppetclassify` gem This helps will runtime issues
14+
when managing node_groups and installing the gem in the
15+
same agent run. To try it out:
16+
17+
```
18+
node_group { 'Test new provider':
19+
ensure => present,
20+
provider => 'https',
21+
}
22+
```
23+
24+
No changes need to be made. When the `puppetclassify`
25+
provider is dropped, the `https` provider will take over
26+
as a seamless swap-in.
27+
28+
## Requirements:
29+
30+
- *nix operating system
31+
- Puppet Enterprise >= 3.7.1
32+
33+
## Types
34+
35+
### Node_group
36+
37+
Node_groups will autorequire parent node_groups.
38+
39+
Enumerate all node groups:
40+
* `puppet resource node_group`<br />
41+
42+
Example output for `puppet resource node_group 'PE MCollective'`
43+
```
44+
node_group { 'PE MCollective':
45+
ensure => 'present',
46+
classes => {'puppet_enterprise::profile::mcollective::agent' => {}},
47+
environment => 'production',
48+
id => '4cdec347-20c6-46d7-9658-7189c1537ae9',
49+
override_environment => 'false',
50+
parent => 'PE Infrastructure',
51+
rule => ['and', ['~', ['fact', 'pe_version'], '.+']],
52+
}
53+
```
54+
55+
#### Node_group parameters
56+
57+
* `classes`<br />
58+
Classes that are assigned to the node in hash format. Elements of the hash
59+
are class parameters. Default (empty hash): `{}`
60+
61+
* `environment`<br />
62+
Environment selected for this node group. Default: `production`
63+
64+
* `name`<br />
65+
(namevar) Node group's name.
66+
67+
* `id`<br />
68+
Universal ID for the group. This attribute is read-only.
69+
70+
* `override_environment`<br />
71+
Whether or not this group's environment ment setting overrides
72+
all other other environments. Default: `false`
73+
74+
* `parent`<br />
75+
The UID for the data group. Can be specified by group name or
76+
UID. Default: `All Nodes`
77+
78+
* `rules`<br />
79+
An array of classification rules. Default (empty array): `[]`
80+
81+
## Functions
82+
83+
### node_groups()
84+
85+
Retrieve all or one node_group and its data.
86+
87+
`node_groups()` will return:
88+
89+
```
90+
{
91+
"All Nodes"=>{
92+
"environment_trumps"=>false,
93+
"parent"=>"00000000-0000-4000-8000-000000000000",
94+
"name"=>"All Nodes",
95+
"rule"=>["and", ["~", "name", ".*"]],
96+
"variables"=>{}, "id"=>"00000000-0000-4000-8000-000000000000",
97+
"environment"=>"production",
98+
"classes"=>{}
99+
},
100+
"Production environment"=>{
101+
"environment_trumps"=>false,
102+
"parent"=>"00000000-0000-4000-8000-000000000000",
103+
"name"=>"Production environment",
104+
"rule"=>["and", ["~", "name", ".*"]],
105+
"variables"=>{},
106+
"id"=>"7233f964-951e-4a7f-88ea-72676ed3104d",
107+
"environment"=>"production",
108+
"classes"=>{}
109+
},
110+
...
111+
}
112+
```
113+
114+
`node_groups('All Nodes')` will return:
115+
116+
```
117+
{
118+
"All Nodes"=>{
119+
"environment_trumps"=>false,
120+
"parent"=>"00000000-0000-4000-8000-000000000000",
121+
"name"=>"All Nodes",
122+
"rule"=>["and", ["~", "name", ".*"]],
123+
"variables"=>{}, "id"=>"00000000-0000-4000-8000-000000000000",
124+
"environment"=>"production",
125+
"classes"=>{}
126+
}
127+
}
128+
```
129+
130+
_Type:_ rvalue
131+
132+
## Maintainers
133+
This repositority is largely the work of some Puppet community members.
134+
It is not officially maintained by Puppet, or any individual in
135+
particular. Issues should be opened in Github. Questions should be directed
136+
at the individuals responsible for committing that particular code.

README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# node_manager [![Build Status](https://travis-ci.org/puppetlabs/prosvcs-node_manager.svg)](https://travis-ci.org/puppetlabs/prosvcs-node_manager)
1+
# node_manager [![Build Status](https://travis-ci.org/WhatsARanjit/prosvcs-node_manager.svg)](https://travis-ci.org/WhatsARanjit/prosvcs-node_manager)
22

33
#### Table of Contents
44
1. [Overview](#overview)
5-
1. [Requirements] (#requirements)
6-
1. [Types] (#types)
7-
* [Node_group] (#node_group)
8-
* [Puppet_environment] (#puppet_environment)
9-
1. [Functions] (#functions)
10-
* [node_groups()] (#node_groups)
5+
1. [Requirements](#requirements)
6+
1. [Types](#types)
7+
* [Node_group](#node_group)
8+
* [Puppet_environment](#puppet_environment)
9+
1. [Functions](#functions)
10+
* [node_groups()](#node_groups)
11+
1. [Things to do](#things-to-do)
1112

1213
## Overview
1314

@@ -24,6 +25,7 @@ It is not supported and may not function as expected.
2425
- Puppet >= 3.7.1
2526
- [puppetclassify](https://github.com/puppetlabs/puppet-classify) gem
2627
- [puppetlabs/pe_gem module](https://forge.puppetlabs.com/puppetlabs/pe_gem)
28+
- NOTE: new `https` provider which doesn't need gem dependency at [HTTPS.md](HTTPS.md)
2729

2830
## Classes
2931
### Node_manager
@@ -145,8 +147,12 @@ Retrieve all or one node_group and its data.
145147

146148
_Type:_ rvalue
147149

150+
## Things to do
151+
- Remove `puppetclassify` dependency
152+
- Get feedback on `https` provider, new [HTTPS.md](HTTPS.md)
153+
148154
## Maintainers
149-
This repositority is largely the work of the Puppet Labs Professional Services
150-
team. It is not officially maintained by Puppet Labs, or any individual in
151-
particular. Issues should be opened in github. Questions should be directed
155+
This repositority is largely the work of some Puppet community members.
156+
It is not officially maintained by Puppet, or any individual in
157+
particular. Issues should be opened in Github. Questions should be directed
152158
at the individuals responsible for committing that particular code.
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
begin
2-
require 'puppet/util/node_groups'
2+
require 'puppet/util/nc_https'
33
rescue LoadError
44
mod = Puppet::Module.find('node_manager', Puppet[:environment].to_s)
5-
require File.join mod.path, 'lib/puppet/util/node_groups'
5+
require File.join mod.path, 'lib/puppet/util/nc_https'
66
end
77

88
module Puppet::Parser::Functions
@@ -13,17 +13,17 @@ module Puppet::Parser::Functions
1313
( args.length == 1 and node_name.is_a?(String) )
1414
)
1515

16-
ng = Puppet::Util::Node_groups.new
17-
groups = ng.groups.get_groups
16+
ng = Puppet::Util::Nc_https.new
17+
groups = ng.get_groups
1818

1919
# When querying a specific group
2020
if args.length == 1
2121
# Assuming there is only one group by the name
22-
Puppet::Util::Node_groups.hashify_group_array(
22+
Puppet::Util::Nc_https.hashify_group_array(
2323
groups.select { |g| g['name'] == node_name }
2424
)
2525
else
26-
Puppet::Util::Node_groups.hashify_group_array(groups)
26+
Puppet::Util::Nc_https.hashify_group_array(groups)
2727
end
2828
end
2929
end

0 commit comments

Comments
 (0)