Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Installers and its templates, more facts
- Loading branch information
Suszyński Krzysztof
committed
Jul 11, 2017
1 parent
32b61d4
commit 4a333f6
Showing
30 changed files
with
389 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! dpkg -l 'puppet-agent' | grep -q ii; then | ||
set -e | ||
sudo apt-get install -y puppet-agent | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! dpkg -l 'puppetserver' | grep -q ii; then | ||
set -e | ||
sudo apt-get install -y puppetserver | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! rpm -q 'puppet-agent'; then | ||
set -e | ||
sudo yum install -y puppet-agent | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! rpm -q 'puppetserver'; then | ||
set -e | ||
sudo yum install -y puppetserver | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! dpkg -l 'puppetlabs-release-pc1' | grep -q ii; then | ||
set -e | ||
cd /tmp | ||
wget "https://apt.puppetlabs.com/puppetlabs-release-pc1-@{codename}.deb" | ||
sudo dpkg -i "puppetlabs-release-pc1-@{codename}.deb" | ||
rm "puppetlabs-release-pc1-@{codename}.deb" | ||
sudo apt-get update | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -x | ||
set +e | ||
|
||
if ! rpm -q puppetlabs-release-pc1; then | ||
set -e | ||
sudo rpm -Uvh "https://yum.puppetlabs.com/puppetlabs-release-pc1-el-@{major}.noarch.rpm" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from __future__ import absolute_import | ||
from six import with_metaclass | ||
from abc import ABCMeta, abstractmethod | ||
|
||
from puppeter.domain.model.configurer import Configurer | ||
from puppeter.domain.model import Installer | ||
|
||
|
||
class InstallerGateway(with_metaclass(ABCMeta, object)): | ||
def produce_commands(self, installer): | ||
# type: (Installer) -> [str] | ||
return self._provide_configurer(installer)\ | ||
.produce_commands() | ||
|
||
@abstractmethod | ||
def _provide_configurer(self, installer): | ||
# type: (Installer) -> Configurer | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from abc import ABCMeta, abstractmethod | ||
from six import with_metaclass | ||
|
||
|
||
class Configurer(with_metaclass(ABCMeta, object)): | ||
@abstractmethod | ||
def produce_commands(self): | ||
# type: () -> [str] | ||
raise NotImplementedError() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
from enum import Enum | ||
|
||
import re | ||
|
||
|
||
class OsFamily(Enum): | ||
Unknown = 1 | ||
RedHat = 2 | ||
Debian = 3 | ||
Suse = 4 | ||
|
||
|
||
class OperatingSystem(Enum): | ||
Unknown = 1 | ||
RedHat = 2 | ||
CentOS = 3 | ||
Scientific = 4 | ||
OracleLinux = 5 | ||
Debian = 6 | ||
Ubuntu = 7 | ||
OpenSuse = 8 | ||
|
||
|
||
class OperatingSystemRelease(str): | ||
VERSION_RE = re.compile('^(\d+)(?:\.(\d+))*$') | ||
|
||
def __init__(self, version): | ||
super(OperatingSystemRelease, self).__init__() | ||
self.__version = str(version) | ||
|
||
def __str__(self): | ||
return self.__version | ||
|
||
def major(self): | ||
return self.VERSION_RE\ | ||
.match(self)\ | ||
.group(1) | ||
|
||
def minor(self): | ||
return self.VERSION_RE\ | ||
.match(self)\ | ||
.group(2) | ||
|
||
|
||
class OperatingSystemCodename(str): | ||
def __init__(self, codename): | ||
super(OperatingSystemCodename, self).__init__() | ||
self.__codename = str(codename) | ||
|
||
def __str__(self): | ||
return self.__codename |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from puppeter import container | ||
from puppeter.domain.model.configurer import Configurer | ||
from puppeter.persistence.gateway.installer.linux import RubyGemConfigurer | ||
|
||
container.bind(Configurer, RubyGemConfigurer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from puppeter import container | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
from puppeter.domain.gateway.installer import InstallerGateway | ||
from puppeter.persistence.gateway.installer.debian.pc3x import PC3xConfigurer | ||
from puppeter.persistence.gateway.installer.debian.pc4x import PC4xConfigurer | ||
from puppeter.persistence.gateway.installer.debian.pc5x import PC5xConfigurer | ||
|
||
|
||
@Named('debian') | ||
class DebianInstallerGateway(InstallerGateway): | ||
|
||
def _provide_configurer(self, installer): | ||
name = installer.bean_name() | ||
if name == 'gem': | ||
return container.get_named(Configurer, 'gem', installer=installer) | ||
name += '-debian' | ||
return container.get_named(Configurer, name, installer=installer) | ||
|
||
|
||
container.bind(InstallerGateway, DebianInstallerGateway) | ||
container.bind(Configurer, PC3xConfigurer) | ||
container.bind(Configurer, PC4xConfigurer) | ||
container.bind(Configurer, PC5xConfigurer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('pc3x-debian') | ||
class PC3xConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.installer = installer | ||
|
||
def produce_commands(self): | ||
raise NotImplementedError('Not yet implemented!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.facter import Facter | ||
from puppeter.domain.model.osfacts import OperatingSystemCodename | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('pc4x-debian') | ||
class PC4xConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.__installer = installer | ||
|
||
def produce_commands(self): | ||
codename = Facter.get(OperatingSystemCodename) | ||
cmds = [] | ||
cmds.append("") | ||
raise NotImplementedError('Not yet implemented! %s' % codename) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('pc5x-debian') | ||
class PC5xConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.installer = installer | ||
|
||
def produce_commands(self): | ||
raise NotImplementedError('Not yet implemented!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('gem') | ||
class RubyGemConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.installer = installer | ||
|
||
def produce_commands(self): | ||
raise NotImplementedError('Not yet implemented!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from puppeter import container | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
from puppeter.domain.gateway.installer import InstallerGateway | ||
from puppeter.persistence.gateway.installer.redhat.pc3x import PC3xConfigurer | ||
from puppeter.persistence.gateway.installer.redhat.pc4x import PC4xConfigurer | ||
from puppeter.persistence.gateway.installer.redhat.pc5x import PC5xConfigurer | ||
|
||
|
||
@Named('redhat') | ||
class RedHatInstallerGateway(InstallerGateway): | ||
|
||
def _provide_configurer(self, installer): | ||
name = installer.bean_name() | ||
if name == 'gem': | ||
return container.get_named(Configurer, 'gem', installer=installer) | ||
name += '-redhat' | ||
return container.get_named(Configurer, name, installer=installer) | ||
|
||
|
||
container.bind(InstallerGateway, RedHatInstallerGateway) | ||
container.bind(Configurer, PC3xConfigurer) | ||
container.bind(Configurer, PC4xConfigurer) | ||
container.bind(Configurer, PC5xConfigurer) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('pc3x-redhat') | ||
class PC3xConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.installer = installer | ||
|
||
def produce_commands(self): | ||
raise NotImplementedError('Not yet implemented!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from puppeter.container import Named | ||
from puppeter.domain.model.configurer import Configurer | ||
|
||
|
||
@Named('pc4x-redhat') | ||
class PC4xConfigurer(Configurer): | ||
def __init__(self, installer): | ||
self.__installer = installer | ||
|
||
def produce_commands(self): | ||
raise NotImplementedError('Not yet implemented!') |
Oops, something went wrong.