Copy forgotten files from nailgun module to fuel
Before we remove nailgun module entirely we need to copy some files from nailgun module to the actual fuel module. Those files were forgotten to be copied. Change-Id: Ic1474afd82df6dc66644ce1301c599ce8574de10 Closes-Bug: #1544335
This commit is contained in:
parent
be717f4082
commit
cbc4286919
|
@ -0,0 +1,8 @@
|
|||
Origin: Mirantis
|
||||
Label: auxiliary
|
||||
Suite: auxiliary
|
||||
Codename: auxiliary
|
||||
Date: Mon, 15 Apr 2015 00:00:01 UTC
|
||||
Architectures: amd64
|
||||
Components: main restricted
|
||||
Description: Auxiliary
|
|
@ -0,0 +1,104 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import atexit
|
||||
import exceptions
|
||||
import pexpect
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.path.append("/usr/share/fence")
|
||||
from fencing import all_opt
|
||||
from fencing import atexit_handler
|
||||
from fencing import check_input
|
||||
from fencing import fence_action
|
||||
from fencing import fence_login
|
||||
from fencing import process_input
|
||||
from fencing import show_docs
|
||||
|
||||
# BEGIN_VERSION_GENERATION
|
||||
RELEASE_VERSION = "0.1.0"
|
||||
BUILD_DATE = "(built Wed Oct 31 11:20:18 UTC 2012)"
|
||||
MIRANTIS_COPYRIGHT = "Copyright (C) Mirantis, Inc. 2012 All rights reserved."
|
||||
# END_VERSION_GENERATION
|
||||
|
||||
|
||||
def get_power_status(conn, options):
|
||||
try:
|
||||
conn.sendline("/bin/echo 1")
|
||||
conn.log_expect(options, options["-c"], int(options["-Y"]))
|
||||
except Exception:
|
||||
return "off"
|
||||
return "on"
|
||||
|
||||
|
||||
def set_power_status(conn, options):
|
||||
if options["-o"] == "off":
|
||||
try:
|
||||
conn.sendline("sh -c '(sleep 1;/sbin/reboot -f)' &>/dev/null &")
|
||||
conn.log_expect(options, options["-c"], int(options["-g"]))
|
||||
time.sleep(2)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
device_opt = ["help", "version", "agent", "quiet", "verbose", "debug",
|
||||
"action", "ipaddr", "login", "passwd", "passwd_script",
|
||||
"secure", "identity_file", "test", "port", "separator",
|
||||
"inet4_only", "inet6_only", "ipport",
|
||||
"power_timeout", "shell_timeout",
|
||||
"login_timeout", "power_wait"]
|
||||
|
||||
atexit.register(atexit_handler)
|
||||
|
||||
all_opt["login_timeout"]["default"] = 60
|
||||
|
||||
pinput = process_input(device_opt)
|
||||
|
||||
# use ssh to manipulate node
|
||||
pinput["-x"] = 1
|
||||
|
||||
options = check_input(device_opt, pinput)
|
||||
|
||||
if options["-o"] != "off":
|
||||
sys.exit(0)
|
||||
|
||||
options["-c"] = "\[EXPECT\]#\ "
|
||||
|
||||
# this string will be appended to the end of ssh command
|
||||
strict = "-t -o 'StrictHostKeyChecking=no'"
|
||||
serveralive = "-o 'ServerAliveInterval 2'"
|
||||
no_stdin = "-n"
|
||||
bash = "/bin/bash --noprofile --norc"
|
||||
options["ssh_options"] = "{0} {1} {2} '/bin/bash -c " \
|
||||
"\"PS1={3} {4}\"'".format(
|
||||
strict, serveralive, no_stdin, options["-c"],
|
||||
bash)
|
||||
options["-X"] = "{0} {1} {2} '/bin/bash -c " \
|
||||
"\"PS1={3} {4}\"'".format(
|
||||
strict, serveralive, no_stdin, options["-c"], bash)
|
||||
|
||||
docs = {}
|
||||
docs["shortdesc"] = "Fence agent that can just reboot node via ssh"
|
||||
docs["longdesc"] = "fence_ssh is an I/O Fencing agent \
|
||||
which can be used to reboot nodes via ssh."
|
||||
show_docs(options, docs)
|
||||
|
||||
# Operate the fencing device
|
||||
|
||||
# this method will actually launch ssh command
|
||||
conn = fence_login(options)
|
||||
|
||||
result = fence_action(conn, options, set_power_status,
|
||||
get_power_status, None)
|
||||
|
||||
try:
|
||||
conn.close()
|
||||
except exceptions.OSError:
|
||||
pass
|
||||
except pexpect.ExceptionPexpect:
|
||||
pass
|
||||
|
||||
sys.exit(result)
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,105 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import atexit
|
||||
import exceptions
|
||||
import pexpect
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.path.append("/usr/share/fence")
|
||||
from fencing import all_opt
|
||||
from fencing import atexit_handler
|
||||
from fencing import check_input
|
||||
from fencing import fence_action
|
||||
from fencing import fence_login
|
||||
from fencing import process_input
|
||||
from fencing import show_docs
|
||||
|
||||
# BEGIN_VERSION_GENERATION
|
||||
RELEASE_VERSION = "0.1.0"
|
||||
BUILD_DATE = "(built Wed Oct 31 11:20:18 UTC 2012)"
|
||||
MIRANTIS_COPYRIGHT = "Copyright (C) Mirantis, Inc. 2012 All rights reserved."
|
||||
# END_VERSION_GENERATION
|
||||
|
||||
|
||||
def get_power_status(conn, options):
|
||||
try:
|
||||
conn.sendline("/bin/echo 1")
|
||||
conn.log_expect(options, options["--command-prompt"],
|
||||
int(options["--shell-timeout"]))
|
||||
except Exception:
|
||||
return "off"
|
||||
return "on"
|
||||
|
||||
|
||||
def set_power_status(conn, options):
|
||||
if options["--action"] == "off":
|
||||
try:
|
||||
conn.sendline("sh -c '(sleep 1;/sbin/reboot -f)' &>/dev/null &")
|
||||
conn.log_expect(options, options["--command-prompt"],
|
||||
int(options["--power-timeout"]))
|
||||
time.sleep(2)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
def main():
|
||||
device_opt = ["help", "version", "agent", "verbose", "debug",
|
||||
"action", "ipaddr", "login", "passwd", "passwd_script",
|
||||
"secure", "identity_file", "port", "separator",
|
||||
"inet4_only", "inet6_only", "ipport",
|
||||
"power_timeout", "shell_timeout",
|
||||
"login_timeout", "power_wait"]
|
||||
|
||||
atexit.register(atexit_handler)
|
||||
|
||||
all_opt["login_timeout"]["default"] = 60
|
||||
|
||||
pinput = process_input(device_opt)
|
||||
|
||||
# use ssh to manipulate node
|
||||
pinput["--ssh"] = 1
|
||||
pinput["--command-prompt"] = ".*"
|
||||
|
||||
options = check_input(device_opt, pinput)
|
||||
|
||||
if options["--action"] != "off":
|
||||
sys.exit(0)
|
||||
|
||||
options["-c"] = "\[EXPECT\]#\ "
|
||||
|
||||
# this string will be appended to the end of ssh command
|
||||
strict = "-t -o 'StrictHostKeyChecking=no'"
|
||||
serveralive = "-o 'ServerAliveInterval 2'"
|
||||
no_stdin = "-n"
|
||||
options["ssh_options"] = "{0} {1} {2} '/bin/bash -c \"PS1={3} /bin/bash " \
|
||||
"--noprofile --norc\"'".format(
|
||||
strict, serveralive, no_stdin, options["-c"])
|
||||
options["-X"] = "{0} {1} {2} '/bin/bash -c \"PS1={3} /bin/bash " \
|
||||
"--noprofile --norc\"'".format(
|
||||
strict, serveralive, no_stdin, options["-c"])
|
||||
|
||||
docs = {}
|
||||
docs["shortdesc"] = "Fence agent that can just reboot node via ssh"
|
||||
docs["longdesc"] = "fence_ssh is an I/O Fencing agent " \
|
||||
"which can be used to reboot nodes via ssh."
|
||||
show_docs(options, docs)
|
||||
|
||||
# Operate the fencing device
|
||||
|
||||
# this method will actually launch ssh command
|
||||
conn = fence_login(options)
|
||||
|
||||
result = fence_action(conn, options, set_power_status,
|
||||
get_power_status, None)
|
||||
|
||||
try:
|
||||
conn.close()
|
||||
except exceptions.OSError:
|
||||
pass
|
||||
except pexpect.ExceptionPexpect:
|
||||
pass
|
||||
|
||||
sys.exit(result)
|
||||
if __name__ == "__main__":
|
||||
main()
|
|
@ -0,0 +1,41 @@
|
|||
require 'yaml'
|
||||
|
||||
Puppet::Type.type(:merge_yaml_settings).provide(:ruby) do
|
||||
desc "Support for merging yaml configuration files."
|
||||
|
||||
def create
|
||||
merged_settings = get_merged_settings
|
||||
write_to_file(@resource[:name], merged_settings.to_yaml) if not (merged_settings.empty?)
|
||||
end
|
||||
|
||||
def destroy
|
||||
File.unlink(@resource[:name])
|
||||
end
|
||||
|
||||
def exists?
|
||||
get_dict(@resource[:sample_settings]) == get_merged_settings
|
||||
end
|
||||
|
||||
def get_merged_settings
|
||||
sample_settings = get_dict(@resource[:sample_settings])
|
||||
override_settings = get_dict(@resource[:override_settings])
|
||||
sample_settings.merge(override_settings)
|
||||
end
|
||||
|
||||
def write_to_file(filename, content)
|
||||
debug "writing content #{content} to the file #{filename}"
|
||||
begin
|
||||
File.open(filename, "w") { |f| f.puts content }
|
||||
rescue
|
||||
raise Puppet::Error, "merge_yaml_settings: the file #{filename} can not be written!"
|
||||
end
|
||||
end
|
||||
|
||||
def get_dict(obj)
|
||||
return obj if obj.is_a?(Hash)
|
||||
YAML.load_file(obj) rescue {}
|
||||
end
|
||||
|
||||
private :get_merged_settings, :get_dict, :write_to_file
|
||||
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
Puppet::Type.newtype(:merge_yaml_settings) do
|
||||
|
||||
desc = "Type to merge yaml configuration files"
|
||||
|
||||
ensurable
|
||||
|
||||
newparam(:name) do
|
||||
desc "Path for destination settings file"
|
||||
end
|
||||
|
||||
newparam(:sample_settings) do
|
||||
desc "Path or Hash containing source settings"
|
||||
end
|
||||
|
||||
newparam(:override_settings) do
|
||||
desc "Path or Hash containing custom settings"
|
||||
end
|
||||
|
||||
end
|
|
@ -62,7 +62,7 @@ class fuel::auxiliaryrepos(
|
|||
file { $release_files:
|
||||
ensure => file,
|
||||
replace => false,
|
||||
source => 'puppet:///modules/nailgun/Release-auxiliary',
|
||||
source => 'puppet:///modules/fuel/Release-auxiliary',
|
||||
mode => '0644',
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
|
|
|
@ -36,13 +36,13 @@ class fuel::cobbler(
|
|||
if $::osfamily == 'RedHat' {
|
||||
case $operatingsystemmajrelease {
|
||||
'6': {
|
||||
$fence_ssh_source = 'puppet:///modules/nailgun/cobbler/fence_ssh.centos6.py'
|
||||
$fence_ssh_source = 'puppet:///modules/fuel/cobbler/fence_ssh.centos6.py'
|
||||
}
|
||||
'7': {
|
||||
$fence_ssh_source = 'puppet:///modules/nailgun/cobbler/fence_ssh.centos7.py'
|
||||
$fence_ssh_source = 'puppet:///modules/fuel/cobbler/fence_ssh.centos7.py'
|
||||
}
|
||||
default: {
|
||||
$fence_ssh_source = 'puppet:///modules/nailgun/cobbler/fence_ssh.centos6.py'
|
||||
$fence_ssh_source = 'puppet:///modules/fuel/cobbler/fence_ssh.centos6.py'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ class fuel::nailgun::server (
|
|||
sysctl::value{'net.core.somaxconn': value => $somaxconn}
|
||||
|
||||
file { '/etc/nailgun/uwsgi_nailgun.yaml':
|
||||
content => template('nailgun/uwsgi_nailgun.yaml.erb'),
|
||||
content => template('fuel/nailgun/uwsgi_nailgun.yaml.erb'),
|
||||
ensure => present,
|
||||
owner => 'root',
|
||||
group => 'root',
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
# Warning! If you restart container, this file will be return
|
||||
# to original state by puppet. If you do not want it, please comment
|
||||
# `puppet apply -v /etc/puppet/modules/nailgun/examples/astute-only.pp`
|
||||
# in /usr/local/bin/start.sh
|
||||
|
||||
broker_host: '<%= @rabbitmq_host %>'
|
||||
broker_port: 5672
|
||||
broker_username: '<%= @rabbitmq_astute_user %>'
|
||||
|
|
Loading…
Reference in New Issue