示例#1
0
    is_str,
    is_str_opt,
    is_time,
    log_dir,
    state_dir,
)

LOGGER = logging.getLogger(__name__)

# flake8: noqa: H904

#############################
# Database
#############################

db_host = Option("database", "host", "localhost",
                 "Hostname or IP of the postgresql server", is_str)
db_port = Option("database", "port", 5432, "The port of the postgresql server",
                 is_int)
db_name = Option("database", "name", "inmanta",
                 "The name of the database on the postgresql server", is_str)
db_username = Option(
    "database", "username", "postgres",
    "The username to access the database in the PostgreSQL server", is_str)
db_password = Option("database", "password", None,
                     "The password that belong to the database user", is_str)
db_connection_pool_min_size = Option(
    "database", "connection_pool_min_size", 10,
    "Number of connections the pool will be initialized with", is_int)
db_connection_pool_max_size = Option("database", "connection_pool_max_size",
                                     10,
                                     "Max number of connections in the pool",
示例#2
0
from inmanta.ast.entity import Entity
from inmanta.config import Option, is_list, is_str, is_uuid_opt
from inmanta.const import ResourceState
from inmanta.data.model import ResourceVersionIdStr
from inmanta.execute.proxy import DynamicProxy, UnknownException
from inmanta.execute.runtime import Instance, ResultVariable
from inmanta.execute.util import NoneValue, Unknown
from inmanta.resources import Id, IgnoreResourceException, Resource, resource, to_id
from inmanta.stable_api import stable_api
from inmanta.util import get_compiler_version, groupby, hash_file

LOGGER = logging.getLogger(__name__)

unknown_parameters: List[Dict[str, str]] = []

cfg_env = Option("config", "environment", None,
                 "The environment this model is associated with", is_uuid_opt)
cfg_export = Option(
    "config",
    "export",
    "",
    "The list of exporters to use. This option is ignored when the --export-plugin option is used.",
    is_list,
)
cfg_unknown_handler = Option("unknown_handler", "default", "prune-agent",
                             "default method to handle unknown values ",
                             is_str)

ModelDict = Dict[str, Entity]
ResourceDict = Dict[Id, Resource]
ProxiedType = Dict[str, Sequence[Union[str, tuple, int, float, bool,
                                       "DynamicProxy"]]]
示例#3
0
from inmanta import protocol, const
from inmanta.agent.handler import Commander
from inmanta.execute.util import Unknown
from inmanta.resources import resource, Resource, to_id, IgnoreResourceException
from inmanta.config import Option, is_uuid_opt, is_list, is_str
from inmanta.execute.proxy import DynamicProxy, UnknownException
from inmanta.ast import RuntimeException
from tornado.ioloop import IOLoop
from tornado import gen

LOGGER = logging.getLogger(__name__)

unknown_parameters = []

cfg_env = Option("config", "environment", None,
                 "The environment this model is associated with", is_uuid_opt)
cfg_export = Option("config", "export", "", "The list of exporters to use",
                    is_list)
cfg_unknown_handler = Option("unknown_handler", "default", "prune-agent",
                             "default method to handle unknown values ",
                             is_str)


class DependencyCycleException(Exception):
    def __init__(self, start):
        super().__init__()
        self.start = start
        self.cycle = [start]
        self.running = True

    def add_to_cycle(self, node):
示例#4
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.

    Contact: [email protected]
"""

from inmanta.config import Option, is_bool, is_str

datatrace_enable: Option[bool] = Option(
    "compiler",
    "datatrace_enable",
    False,
    "Enables the experimental datatrace application on top of the compiler."
    " The application should help in identifying the cause of compilation errors"
    " during the development process.",
    is_bool,
)

dataflow_graphic_enable: Option[bool] = Option(
    "compiler",
    "dataflow_graphic_enable",
    False,
    "Enables graphic visualization of the data flow in the model. Requires the datatrace_enable option. Requires graphviz.",
    is_bool,
)


def track_dataflow() -> bool:
示例#5
0
def test_options():
    configa = Option("test", "a", "markerA", "test a docs")
    configb = Option("test", "B", option_as_default(configa), "test b docs")

    assert "test.a" in configb.get_default_desc()

    Config.load_config()

    assert configb.get() == "markerA"
    configa.set("MA2")
    assert configb.get() == "MA2"
    configb.set("MB2")
    assert configb.get() == "MB2"
示例#6
0
def test_option_is_list_empty():
    option: Option = Option("test", "list", "default,values", "documentation",
                            cfg.is_list)
    option.set("")
    assert option.get() == []
示例#7
0
def test_option_is_list():
    option: Option = Option("test", "list", "default,values", "documentation",
                            cfg.is_list)
    option.set("some,values")
    assert option.get() == ["some", "values"]
示例#8
0
    Contact: [email protected]
"""

from inmanta.config import Option, is_int, is_bool, is_time, is_list, is_str_opt
from inmanta.config import state_dir, log_dir
import logging

LOGGER = logging.getLogger(__name__)

# flake8: noqa: H904

#############################
# Database
#############################

db_host = Option("database", "host", "localhost",
                 "Hostname or IP of the mongo server")
db_port = Option("database", "port", 27017, "The port of the mongo server",
                 is_int)
db_name = Option("database", "name", "inmanta",
                 "The name of the database on the mongo server")

#############################
# server_rest_transport
#############################
transport_port = Option(
    "server_rest_transport", "port", 8888,
    "The port on which the server listens for connections")

#############################
# server
#############################