Add entropy_repos fact
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
## UNRELEASED
|
## UNRELEASED
|
||||||
|
|
||||||
- Add `entropy_repo` type to enable/disable repositories
|
- Add `entropy_repo` type to enable/disable repositories
|
||||||
|
- Add `entropy_repos` fact
|
||||||
|
|
||||||
## 2016-10-13 Release 0.2.0
|
## 2016-10-13 Release 0.2.0
|
||||||
|
|
||||||
|
|||||||
28
README.md
28
README.md
@@ -102,10 +102,12 @@ entropy_repo { 'sabayon-limbo':
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
To disable a repository, use:
|
To disable a repository (only if present), use:
|
||||||
```puppet
|
```puppet
|
||||||
entropy_repo { 'sabayon-limbo':
|
if 'sabayon-limbo' in $facts['entropy_repos'] {
|
||||||
enabled => 'false',
|
entropy_repo { 'sabayon-limbo':
|
||||||
|
enabled => 'false',
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -275,6 +277,26 @@ For more info on package keywords, see https://wiki.gentoo.org/wiki/KEYWORDS
|
|||||||
|
|
||||||
### Facts
|
### Facts
|
||||||
|
|
||||||
|
#### `entropy_repos`
|
||||||
|
|
||||||
|
Provides a structured fact identifying the entropy repos present on the system
|
||||||
|
including their enabled/disabled state, and whether they are enman or entropy
|
||||||
|
repositories.
|
||||||
|
|
||||||
|
Example (in yaml format for readability):
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
sabayonlinux.org:
|
||||||
|
repo_type: "entropy"
|
||||||
|
enabled: "true"
|
||||||
|
sabayon-limbo:
|
||||||
|
repo_type: "entropy"
|
||||||
|
enabled: "false"
|
||||||
|
community:
|
||||||
|
repo_type: "enman"
|
||||||
|
enabled: "true"
|
||||||
|
```
|
||||||
|
|
||||||
#### `locale`
|
#### `locale`
|
||||||
|
|
||||||
Identifies the system-wide default locale, as set by `eselect`.
|
Identifies the system-wide default locale, as set by `eselect`.
|
||||||
|
|||||||
22
lib/facter/entropy_repos.rb
Normal file
22
lib/facter/entropy_repos.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
Facter.add('entropy_repos') do
|
||||||
|
|
||||||
|
confine :operatingsystem => :Sabayon
|
||||||
|
|
||||||
|
setcode do
|
||||||
|
# Use the types/providers to do the heavy lifting here
|
||||||
|
repos = {}
|
||||||
|
|
||||||
|
Puppet::Type.type(:entropy_repo).provider(:file).instances().each do |repo|
|
||||||
|
Facter.debug(repo.enabled)
|
||||||
|
r = {
|
||||||
|
:repo_type => repo.repo_type,
|
||||||
|
:enabled => repo.enabled,
|
||||||
|
}
|
||||||
|
|
||||||
|
repos[repo.name] = r
|
||||||
|
end
|
||||||
|
|
||||||
|
repos
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
Reference in New Issue
Block a user