Merge "PEP8 on the doc and elements files"
This commit is contained in:
commit
4562892fcf
|
@ -1,45 +1,35 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#
|
#
|
||||||
# TripleO Image Elements documentation build configuration file, created by
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
# sphinx-quickstart on Fri Apr 18 09:19:09 2014.
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
#
|
#
|
||||||
# This file is execfile()d with the current directory set to its
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
# containing dir.
|
|
||||||
#
|
#
|
||||||
# Note that not all possible configuration values are present in this
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
# autogenerated file.
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
#
|
#
|
||||||
# All configuration values have a default; values that are commented out
|
|
||||||
# serve to show the default.
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
#sys.path.insert(0, os.path.abspath('.'))
|
# sys.path.insert(0, os.path.abspath('.'))
|
||||||
|
|
||||||
# -- General configuration ------------------------------------------------
|
# -- General configuration ------------------------------------------------
|
||||||
|
|
||||||
# If your documentation needs a minimal Sphinx version, state it here.
|
# If your documentation needs a minimal Sphinx version, state it here.
|
||||||
#needs_sphinx = '1.0'
|
# needs_sphinx = '1.0'
|
||||||
|
|
||||||
# Add any Sphinx extension module names here, as strings. They can be
|
# Add any Sphinx extension module names here, as strings. They can be
|
||||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||||
# ones.
|
# ones.
|
||||||
extensions = ['oslosphinx']
|
extensions = ['oslosphinx']
|
||||||
|
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
|
|
||||||
# The suffix of source filenames.
|
# The suffix of source filenames.
|
||||||
source_suffix = '.rst'
|
source_suffix = '.rst'
|
||||||
|
|
||||||
# The encoding of source files.
|
|
||||||
#source_encoding = 'utf-8-sig'
|
|
||||||
|
|
||||||
# The master toctree document.
|
|
||||||
master_doc = 'index'
|
master_doc = 'index'
|
||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
|
@ -57,13 +47,13 @@ release = '0.0'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
#language = None
|
# language = None
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
# non-false value, then it is used:
|
# non-false value, then it is used:
|
||||||
#today = ''
|
# today = ''
|
||||||
# Else, today_fmt is used as the format for a strftime call.
|
# Else, today_fmt is used as the format for a strftime call.
|
||||||
#today_fmt = '%B %d, %Y'
|
# today_fmt = '%B %d, %Y'
|
||||||
|
|
||||||
# List of patterns, relative to source directory, that match files and
|
# List of patterns, relative to source directory, that match files and
|
||||||
# directories to ignore when looking for source files.
|
# directories to ignore when looking for source files.
|
||||||
|
@ -71,27 +61,27 @@ exclude_patterns = ['_build']
|
||||||
|
|
||||||
# The reST default role (used for this markup: `text`) to use for all
|
# The reST default role (used for this markup: `text`) to use for all
|
||||||
# documents.
|
# documents.
|
||||||
#default_role = None
|
# default_role = None
|
||||||
|
|
||||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||||
#add_function_parentheses = True
|
# add_function_parentheses = True
|
||||||
|
|
||||||
# If true, the current module name will be prepended to all description
|
# If true, the current module name will be prepended to all description
|
||||||
# unit titles (such as .. function::).
|
# unit titles (such as .. function::).
|
||||||
#add_module_names = True
|
# add_module_names = True
|
||||||
|
|
||||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||||
# output. They are ignored by default.
|
# output. They are ignored by default.
|
||||||
#show_authors = False
|
# show_authors = False
|
||||||
|
|
||||||
# The name of the Pygments (syntax highlighting) style to use.
|
# The name of the Pygments (syntax highlighting) style to use.
|
||||||
pygments_style = 'sphinx'
|
pygments_style = 'sphinx'
|
||||||
|
|
||||||
# A list of ignored prefixes for module index sorting.
|
# A list of ignored prefixes for module index sorting.
|
||||||
#modindex_common_prefix = []
|
# modindex_common_prefix = []
|
||||||
|
|
||||||
# If true, keep warnings as "system message" paragraphs in the built documents.
|
# If true, keep warnings as "system message" paragraphs in the built documents.
|
||||||
#keep_warnings = False
|
# keep_warnings = False
|
||||||
|
|
||||||
|
|
||||||
# -- Options for HTML output ----------------------------------------------
|
# -- Options for HTML output ----------------------------------------------
|
||||||
|
@ -103,26 +93,26 @@ html_theme = 'default'
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
# documentation.
|
# documentation.
|
||||||
#html_theme_options = {}
|
# html_theme_options = {}
|
||||||
|
|
||||||
# Add any paths that contain custom themes here, relative to this directory.
|
# Add any paths that contain custom themes here, relative to this directory.
|
||||||
#html_theme_path = []
|
# html_theme_path = []
|
||||||
|
|
||||||
# The name for this set of Sphinx documents. If None, it defaults to
|
# The name for this set of Sphinx documents. If None, it defaults to
|
||||||
# "<project> v<release> documentation".
|
# "<project> v<release> documentation".
|
||||||
#html_title = None
|
# html_title = None
|
||||||
|
|
||||||
# A shorter title for the navigation bar. Default is the same as html_title.
|
# A shorter title for the navigation bar. Default is the same as html_title.
|
||||||
#html_short_title = None
|
# html_short_title = None
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top
|
# The name of an image file (relative to this directory) to place at the top
|
||||||
# of the sidebar.
|
# of the sidebar.
|
||||||
#html_logo = None
|
# html_logo = None
|
||||||
|
|
||||||
# The name of an image file (within the static path) to use as favicon of the
|
# The name of an image file (within the static path) to use as favicon of the
|
||||||
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
|
||||||
# pixels large.
|
# pixels large.
|
||||||
#html_favicon = None
|
# html_favicon = None
|
||||||
|
|
||||||
# Add any paths that contain custom static files (such as style sheets) here,
|
# Add any paths that contain custom static files (such as style sheets) here,
|
||||||
# relative to this directory. They are copied after the builtin static files,
|
# relative to this directory. They are copied after the builtin static files,
|
||||||
|
@ -132,48 +122,48 @@ html_static_path = ['_static']
|
||||||
# Add any extra paths that contain custom files (such as robots.txt or
|
# Add any extra paths that contain custom files (such as robots.txt or
|
||||||
# .htaccess) here, relative to this directory. These files are copied
|
# .htaccess) here, relative to this directory. These files are copied
|
||||||
# directly to the root of the documentation.
|
# directly to the root of the documentation.
|
||||||
#html_extra_path = []
|
# html_extra_path = []
|
||||||
|
|
||||||
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
|
||||||
# using the given strftime format.
|
# using the given strftime format.
|
||||||
#html_last_updated_fmt = '%b %d, %Y'
|
# html_last_updated_fmt = '%b %d, %Y'
|
||||||
|
|
||||||
# If true, SmartyPants will be used to convert quotes and dashes to
|
# If true, SmartyPants will be used to convert quotes and dashes to
|
||||||
# typographically correct entities.
|
# typographically correct entities.
|
||||||
#html_use_smartypants = True
|
# html_use_smartypants = True
|
||||||
|
|
||||||
# Custom sidebar templates, maps document names to template names.
|
# Custom sidebar templates, maps document names to template names.
|
||||||
#html_sidebars = {}
|
# html_sidebars = {}
|
||||||
|
|
||||||
# Additional templates that should be rendered to pages, maps page names to
|
# Additional templates that should be rendered to pages, maps page names to
|
||||||
# template names.
|
# template names.
|
||||||
#html_additional_pages = {}
|
# html_additional_pages = {}
|
||||||
|
|
||||||
# If false, no module index is generated.
|
# If false, no module index is generated.
|
||||||
#html_domain_indices = True
|
# html_domain_indices = True
|
||||||
|
|
||||||
# If false, no index is generated.
|
# If false, no index is generated.
|
||||||
#html_use_index = True
|
# html_use_index = True
|
||||||
|
|
||||||
# If true, the index is split into individual pages for each letter.
|
# If true, the index is split into individual pages for each letter.
|
||||||
#html_split_index = False
|
# html_split_index = False
|
||||||
|
|
||||||
# If true, links to the reST sources are added to the pages.
|
# If true, links to the reST sources are added to the pages.
|
||||||
#html_show_sourcelink = True
|
# html_show_sourcelink = True
|
||||||
|
|
||||||
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
|
||||||
#html_show_sphinx = True
|
# html_show_sphinx = True
|
||||||
|
|
||||||
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
|
||||||
#html_show_copyright = True
|
# html_show_copyright = True
|
||||||
|
|
||||||
# If true, an OpenSearch description file will be output, and all pages will
|
# If true, an OpenSearch description file will be output, and all pages will
|
||||||
# contain a <link> tag referring to it. The value of this option must be the
|
# contain a <link> tag referring to it. The value of this option must be the
|
||||||
# base URL from which the finished HTML is served.
|
# base URL from which the finished HTML is served.
|
||||||
#html_use_opensearch = ''
|
# html_use_opensearch = ''
|
||||||
|
|
||||||
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
# This is the file name suffix for HTML files (e.g. ".xhtml").
|
||||||
#html_file_suffix = None
|
# html_file_suffix = None
|
||||||
|
|
||||||
# Output file base name for HTML help builder.
|
# Output file base name for HTML help builder.
|
||||||
htmlhelp_basename = 'TripleOImageElementsdoc'
|
htmlhelp_basename = 'TripleOImageElementsdoc'
|
||||||
|
@ -181,44 +171,36 @@ htmlhelp_basename = 'TripleOImageElementsdoc'
|
||||||
|
|
||||||
# -- Options for LaTeX output ---------------------------------------------
|
# -- Options for LaTeX output ---------------------------------------------
|
||||||
|
|
||||||
latex_elements = {
|
latex_elements = {}
|
||||||
# The paper size ('letterpaper' or 'a4paper').
|
|
||||||
#'papersize': 'letterpaper',
|
|
||||||
|
|
||||||
# The font size ('10pt', '11pt' or '12pt').
|
|
||||||
#'pointsize': '10pt',
|
|
||||||
|
|
||||||
# Additional stuff for the LaTeX preamble.
|
|
||||||
#'preamble': '',
|
|
||||||
}
|
|
||||||
|
|
||||||
# Grouping the document tree into LaTeX files. List of tuples
|
# Grouping the document tree into LaTeX files. List of tuples
|
||||||
# (source start file, target name, title,
|
# (source start file, target name, title,
|
||||||
# author, documentclass [howto, manual, or own class]).
|
# author, documentclass [howto, manual, or own class]).
|
||||||
latex_documents = [
|
latex_documents = [
|
||||||
('index', 'TripleOImageElements.tex', u'TripleO Image Elements Documentation',
|
('index', 'TripleOImageElements.tex',
|
||||||
u'OpenStack Developers', 'manual'),
|
u'TripleO Image Elements Documentation',
|
||||||
|
u'OpenStack Developers', 'manual'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# The name of an image file (relative to this directory) to place at the top of
|
# The name of an image file (relative to this directory) to place at the top of
|
||||||
# the title page.
|
# the title page.
|
||||||
#latex_logo = None
|
# latex_logo = None
|
||||||
|
|
||||||
# For "manual" documents, if this is true, then toplevel headings are parts,
|
# For "manual" documents, if this is true, then toplevel headings are parts,
|
||||||
# not chapters.
|
# not chapters.
|
||||||
#latex_use_parts = False
|
# latex_use_parts = False
|
||||||
|
|
||||||
# If true, show page references after internal links.
|
# If true, show page references after internal links.
|
||||||
#latex_show_pagerefs = False
|
# latex_show_pagerefs = False
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
#latex_show_urls = False
|
# latex_show_urls = False
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
#latex_appendices = []
|
# latex_appendices = []
|
||||||
|
|
||||||
# If false, no module index is generated.
|
# If false, no module index is generated.
|
||||||
#latex_domain_indices = True
|
# latex_domain_indices = True
|
||||||
|
|
||||||
|
|
||||||
# -- Options for manual page output ---------------------------------------
|
# -- Options for manual page output ---------------------------------------
|
||||||
|
@ -231,7 +213,7 @@ man_pages = [
|
||||||
]
|
]
|
||||||
|
|
||||||
# If true, show URL addresses after external links.
|
# If true, show URL addresses after external links.
|
||||||
#man_show_urls = False
|
# man_show_urls = False
|
||||||
|
|
||||||
|
|
||||||
# -- Options for Texinfo output -------------------------------------------
|
# -- Options for Texinfo output -------------------------------------------
|
||||||
|
@ -240,19 +222,21 @@ man_pages = [
|
||||||
# (source start file, target name, title, author,
|
# (source start file, target name, title, author,
|
||||||
# dir menu entry, description, category)
|
# dir menu entry, description, category)
|
||||||
texinfo_documents = [
|
texinfo_documents = [
|
||||||
('index', 'TripleOImageElements', u'TripleO Image Elements Documentation',
|
('index', 'TripleOImageElements',
|
||||||
u'OpenStack Developers', 'TripleOImageElements', 'One line description of project.',
|
u'TripleO Image Elements Documentation',
|
||||||
'Miscellaneous'),
|
u'OpenStack Developers', 'TripleOImageElements',
|
||||||
|
'One line description of project.',
|
||||||
|
'Miscellaneous'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Documents to append as an appendix to all manuals.
|
# Documents to append as an appendix to all manuals.
|
||||||
#texinfo_appendices = []
|
# texinfo_appendices = []
|
||||||
|
|
||||||
# If false, no module index is generated.
|
# If false, no module index is generated.
|
||||||
#texinfo_domain_indices = True
|
# texinfo_domain_indices = True
|
||||||
|
|
||||||
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
# How to display URL addresses: 'footnote', 'no', or 'inline'.
|
||||||
#texinfo_show_urls = 'footnote'
|
# texinfo_show_urls = 'footnote'
|
||||||
|
|
||||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||||
#texinfo_no_detailmenu = False
|
# texinfo_no_detailmenu = False
|
||||||
|
|
|
@ -49,7 +49,7 @@ CACHES = {
|
||||||
{{#horizon.caches.memcached}}
|
{{#horizon.caches.memcached}}
|
||||||
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
|
||||||
'LOCATION': [{{#nodes}}'{{.}}',{{/nodes}}]
|
'LOCATION': [{{#nodes}}'{{.}}',{{/nodes}}]
|
||||||
{{/horizon.caches.memcached}}
|
{{/horizon.caches.memcached}} # flake8: noqa
|
||||||
{{^horizon.caches.memcached}}
|
{{^horizon.caches.memcached}}
|
||||||
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
|
||||||
{{/horizon.caches.memcached}}
|
{{/horizon.caches.memcached}}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Assert users that came from metadata config
|
# Assert users that came from metadata config
|
||||||
#
|
#
|
||||||
|
@ -18,26 +18,32 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
import subprocess
|
from __future__ import print_function
|
||||||
import MySQLdb
|
|
||||||
import logging
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import base64
|
||||||
import json
|
import json
|
||||||
from base64 import b64encode
|
import logging
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
import MySQLdb
|
||||||
|
|
||||||
logging.basicConfig()
|
logging.basicConfig()
|
||||||
logger = logging.getLogger('mysql-users')
|
logger = logging.getLogger('mysql-users')
|
||||||
|
|
||||||
# Try to connect with no password, ~/.my.cnf and /mnt/state/root/metadata.my.cnf
|
# Try to connect with no password, ~/.my.cnf and
|
||||||
|
# /mnt/state/root/metadata.my.cnf
|
||||||
# in that order. This should cover os-refresh-config post install and re-image
|
# in that order. This should cover os-refresh-config post install and re-image
|
||||||
try:
|
try:
|
||||||
conn = MySQLdb.Connect()
|
conn = MySQLdb.Connect()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
try:
|
try:
|
||||||
conn = MySQLdb.Connect(read_default_file=os.path.expanduser('~/.my.cnf'))
|
conn = MySQLdb.Connect(
|
||||||
|
read_default_file=os.path.expanduser('~/.my.cnf'))
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
conn = MySQLdb.Connect(read_default_file='/mnt/state/root/metadata.my.cnf')
|
conn = MySQLdb.Connect(
|
||||||
|
read_default_file='/mnt/state/root/metadata.my.cnf')
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
rows = cursor.execute("SELECT DISTINCT User FROM mysql.user WHERE user != ''")
|
rows = cursor.execute("SELECT DISTINCT User FROM mysql.user WHERE user != ''")
|
||||||
existing = set([x[0] for x in cursor.fetchmany(size=rows)])
|
existing = set([x[0] for x in cursor.fetchmany(size=rows)])
|
||||||
|
@ -75,25 +81,25 @@ for createuser in to_create:
|
||||||
if 'password' in dbvalue:
|
if 'password' in dbvalue:
|
||||||
password = dbvalue['password']
|
password = dbvalue['password']
|
||||||
else:
|
else:
|
||||||
password = b64encode(os.urandom(30))
|
password = base64.b64encode(os.urandom(30))
|
||||||
|
|
||||||
cmd = "GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@'%%' IDENTIFIED BY '%s'" % (
|
cmd = "GRANT ALL PRIVILEGES ON `%s`.* TO `%s`@'%%' IDENTIFIED BY '%s'" % (
|
||||||
dbvalue['database'], dbvalue['username'], password)
|
dbvalue['database'], dbvalue['username'], password)
|
||||||
if opts.noop:
|
if opts.noop:
|
||||||
print "%s" % (cmd)
|
print("%s" % (cmd))
|
||||||
else:
|
else:
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(cmd)
|
cursor.execute(cmd)
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
if 'userhandle' in dbvalue:
|
if 'userhandle' in dbvalue:
|
||||||
# Inform Heat of new password for this user
|
# Inform Heat of new password for this user
|
||||||
cmd = ['/opt/aws/bin/cfn-signal', '-i', dbvalue['username'],
|
cmd = ['/opt/aws/bin/cfn-signal', '-i', dbvalue['username'],
|
||||||
'-s', 'true', '--data', password, dbvalue['userhandle']]
|
'-s', 'true', '--data', password, dbvalue['userhandle']]
|
||||||
if opts.noop:
|
if opts.noop:
|
||||||
print cmd
|
print(cmd)
|
||||||
else:
|
else:
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
|
|
||||||
if to_delete:
|
if to_delete:
|
||||||
logger.warn('The following users are not accounted for: %s' % to_delete)
|
logger.warn('The following users are not accounted for: %s' % to_delete)
|
||||||
|
|
|
@ -42,15 +42,19 @@ def load_userfile(path, users):
|
||||||
|
|
||||||
|
|
||||||
def secure_installation(rootuser):
|
def secure_installation(rootuser):
|
||||||
# Try to connect with no password, ~/.my.cnf and /mnt/state/root/metadata.my.cnf
|
# Try to connect with no password, ~/.my.cnf and
|
||||||
# in that order. This should cover os-refresh-config post install and re-image
|
# /mnt/state/root/metadata.my.cnf in that order.
|
||||||
|
# This should cover os-refresh-config post install
|
||||||
|
# and re-image
|
||||||
try:
|
try:
|
||||||
conn = MySQLdb.Connect()
|
conn = MySQLdb.Connect()
|
||||||
except Exception as e:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
conn = MySQLdb.Connect(read_default_file=os.path.expanduser('~/.my.cnf'))
|
conn = MySQLdb.Connect(
|
||||||
except Exception as e:
|
read_default_file=os.path.expanduser('~/.my.cnf'))
|
||||||
conn = MySQLdb.Connect(read_default_file='/mnt/state/root/metadata.my.cnf')
|
except Exception:
|
||||||
|
conn = MySQLdb.Connect(
|
||||||
|
read_default_file='/mnt/state/root/metadata.my.cnf')
|
||||||
with conn:
|
with conn:
|
||||||
# Remove Anonymous Users
|
# Remove Anonymous Users
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
|
@ -72,7 +76,8 @@ def secure_installation(rootuser):
|
||||||
cursor.execute(cmd, (rootpwd, "root"))
|
cursor.execute(cmd, (rootpwd, "root"))
|
||||||
cursor.execute("FLUSH PRIVILEGES")
|
cursor.execute("FLUSH PRIVILEGES")
|
||||||
# As Above also sets root password .my.cnf with new password
|
# As Above also sets root password .my.cnf with new password
|
||||||
shutil.copy2('/mnt/state/root/metadata.my.cnf',os.path.expanduser('~/.my.cnf'))
|
shutil.copy2('/mnt/state/root/metadata.my.cnf',
|
||||||
|
os.path.expanduser('~/.my.cnf'))
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
users = {}
|
users = {}
|
||||||
|
|
|
@ -87,4 +87,4 @@ if errors:
|
||||||
|
|
||||||
if reload_nagios:
|
if reload_nagios:
|
||||||
sys.stderr.write("INFO: reloading nagios.")
|
sys.stderr.write("INFO: reloading nagios.")
|
||||||
subprocess.call(["service","nagios3","reload"])
|
subprocess.call(["service", "nagios3", "reload"])
|
||||||
|
|
|
@ -12,10 +12,10 @@
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from tests import base
|
import tests.base
|
||||||
|
|
||||||
|
|
||||||
class TestOsSvcDaemon(base.ScriptTestBase):
|
class TestOsSvcDaemon(tests.base.ScriptTestBase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestOsSvcDaemon, self).setUp()
|
super(TestOsSvcDaemon, self).setUp()
|
||||||
self._stub_script('map-services', 'echo $1')
|
self._stub_script('map-services', 'echo $1')
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
#
|
#
|
||||||
|
@ -15,18 +15,21 @@
|
||||||
# under the License.
|
# under the License.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import base64
|
import base64
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
logging.basicConfig(level='INFO',
|
logging.basicConfig(
|
||||||
format='[%(asctime)s] (%(name)s) [%(levelname)s] %(message)s')
|
level='INFO',
|
||||||
|
format='[%(asctime)s] (%(name)s) [%(levelname)s] %(message)s')
|
||||||
LOG = logging.getLogger(os.path.basename(sys.argv[0]))
|
LOG = logging.getLogger(os.path.basename(sys.argv[0]))
|
||||||
|
|
||||||
USERS_FILE='/etc/rabbitmq/heat_users.json'
|
USERS_FILE = '/etc/rabbitmq/heat_users.json'
|
||||||
HANDLE_FILE = '/etc/rabbitmq/heat_password_handle'
|
HANDLE_FILE = '/etc/rabbitmq/heat_password_handle'
|
||||||
|
|
||||||
# USERS_FILE can exist without any content, in which case it will just be an
|
# USERS_FILE can exist without any content, in which case it will just be an
|
||||||
|
@ -39,6 +42,7 @@ if os.path.exists(HANDLE_FILE):
|
||||||
with open(HANDLE_FILE) as hf:
|
with open(HANDLE_FILE) as hf:
|
||||||
PASSWORD_HANDLE = hf.read().rstrip()
|
PASSWORD_HANDLE = hf.read().rstrip()
|
||||||
|
|
||||||
|
|
||||||
def get_existing_users():
|
def get_existing_users():
|
||||||
list_users = subprocess.check_output(['rabbitmqctl', 'list_users'],
|
list_users = subprocess.check_output(['rabbitmqctl', 'list_users'],
|
||||||
stderr=subprocess.STDOUT)
|
stderr=subprocess.STDOUT)
|
||||||
|
@ -88,7 +92,7 @@ for need_user in need:
|
||||||
'--data', password,
|
'--data', password,
|
||||||
PASSWORD_HANDLE])
|
PASSWORD_HANDLE])
|
||||||
else:
|
else:
|
||||||
print '%s:%s' % (username, password)
|
print('%s:%s' % (username, password))
|
||||||
if 'permissions' in detail:
|
if 'permissions' in detail:
|
||||||
args = ['rabbitmqctl', 'set_permissions', username]
|
args = ['rabbitmqctl', 'set_permissions', username]
|
||||||
args.append(detail['permissions']['conf'])
|
args.append(detail['permissions']['conf'])
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
# Copyright 2013 Red Hat
|
# Copyright 2013 Red Hat
|
||||||
# All Rights Reserved.
|
# All Rights Reserved.
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/bin/bash
|
||||||
|
# Copyright 2014 eNovance <licensing@enovance.com>
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
# not use this file except in compliance with the License. You may obtain
|
||||||
|
# a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
# License for the specific language governing permissions and limitations
|
||||||
|
# under the License.
|
||||||
|
#
|
||||||
|
set -eu
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
flake8
|
||||||
|
|
||||||
|
extra_python_files=$(egrep -R --null-data --files-with-matches "^#!/usr/bin/env python" elements/)
|
||||||
|
echo $extra_python_files
|
||||||
|
flake8 ${extra_python_files}
|
4
tox.ini
4
tox.ini
|
@ -18,11 +18,11 @@ commands =
|
||||||
commands = {posargs}
|
commands = {posargs}
|
||||||
|
|
||||||
[testenv:pep8]
|
[testenv:pep8]
|
||||||
commands = flake8
|
commands = ./run-flake8
|
||||||
|
|
||||||
[flake8]
|
[flake8]
|
||||||
ignore = E125,H803
|
ignore = E125,H803
|
||||||
exclude = .venv,.tox,dist,doc,*.egg
|
exclude = .venv,.tox,dist,*.egg
|
||||||
show-source = true
|
show-source = true
|
||||||
|
|
||||||
[tox:jenkins]
|
[tox:jenkins]
|
||||||
|
|
Loading…
Reference in New Issue