Compare commits
44 Commits
88f864cd2a
...
pkg/dev/ri
Author | SHA1 | Date | |
---|---|---|---|
0970eee14e | |||
5add91082f | |||
e9596c2e2a | |||
1c7e2b9f0b | |||
42b67ce575 | |||
17e7f4caa0 | |||
2a77093187 | |||
db69df3b86 | |||
2b2cc4cf20 | |||
20de4443ae | |||
1e6c9060b5 | |||
e66a462710 | |||
9eb6a67ac6 | |||
d895c46729 | |||
63e679036b | |||
12acf2a3f4 | |||
fc686e9b7f | |||
6a12504e8c | |||
e11105db32 | |||
55c3021a5d | |||
5eeaaedded | |||
b049cb9324 | |||
cbd1081371 | |||
af8f0bfc9a | |||
651d89dd04 | |||
f4538004c7 | |||
83156863da | |||
7eb78e5346 | |||
11553e6f09 | |||
0722e76fcc | |||
adaafde2e5 | |||
19d9fdc705 | |||
11294fdd61 | |||
4351662f2e | |||
5bf8d69e91 | |||
a9c74d68ff | |||
48d190d39b | |||
f474edd8ae | |||
61fc9b15e5 | |||
79312cc8c8 | |||
0da8b868ac | |||
a2e8b5dad4 | |||
58b3880e9b | |||
413ab6dbb0 |
662
debian/agpl-3
vendored
Normal file
662
debian/agpl-3
vendored
Normal file
@ -0,0 +1,662 @@
|
|||||||
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works, specifically designed to ensure
|
||||||
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
Developers that use our General Public Licenses protect your rights
|
||||||
|
with two steps: (1) assert copyright on the software, and (2) offer
|
||||||
|
you this License which gives you legal permission to copy, distribute
|
||||||
|
and/or modify the software.
|
||||||
|
|
||||||
|
A secondary benefit of defending all users' freedom is that
|
||||||
|
improvements made in alternate versions of the program, if they
|
||||||
|
receive widespread use, become available for other developers to
|
||||||
|
incorporate. Many developers of free software are heartened and
|
||||||
|
encouraged by the resulting cooperation. However, in the case of
|
||||||
|
software used on network servers, this result may fail to come about.
|
||||||
|
The GNU General Public License permits making a modified version and
|
||||||
|
letting the public access it on a server without ever releasing its
|
||||||
|
source code to the public.
|
||||||
|
|
||||||
|
The GNU Affero General Public License is designed specifically to
|
||||||
|
ensure that, in such cases, the modified source code becomes available
|
||||||
|
to the community. It requires the operator of a network server to
|
||||||
|
provide the source code of the modified version running there to the
|
||||||
|
users of that server. Therefore, public use of a modified version, on
|
||||||
|
a publicly accessible server, gives the public access to the source
|
||||||
|
code of the modified version.
|
||||||
|
|
||||||
|
An older license, called the Affero General Public License and
|
||||||
|
published by Affero, was designed to accomplish similar goals. This is
|
||||||
|
a different license, not a version of the Affero GPL, but Affero has
|
||||||
|
released a new version of the Affero GPL which permits relicensing under
|
||||||
|
this license.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Remote Network Interaction; Use with the GNU General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, if you modify the
|
||||||
|
Program, your modified version must prominently offer all users
|
||||||
|
interacting with it remotely through a computer network (if your version
|
||||||
|
supports such interaction) an opportunity to receive the Corresponding
|
||||||
|
Source of your version by providing access to the Corresponding Source
|
||||||
|
from a network server at no charge, through some standard or customary
|
||||||
|
means of facilitating copying of software. This Corresponding Source
|
||||||
|
shall include the Corresponding Source for any work covered by version 3
|
||||||
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
|
following paragraph.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the work with which it is combined will remain governed by version
|
||||||
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If your software can interact with users remotely through a computer
|
||||||
|
network, you should also make sure that it provides a way for users to
|
||||||
|
get its source. For example, if your program is a web application, its
|
||||||
|
interface could display a "Source" link that leads users to an archive
|
||||||
|
of the code. There are many ways you could offer source, and different
|
||||||
|
solutions will be better for different programs; see section 13 for the
|
||||||
|
specific requirements.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
|
<https://www.gnu.org/licenses/>.
|
||||||
|
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
11
|
14
debian/control
vendored
Normal file
14
debian/control
vendored
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
Source: rougail
|
||||||
|
Section: admin
|
||||||
|
Priority: extra
|
||||||
|
Maintainer: Cadoles <contact@cadoles.com>
|
||||||
|
Build-depends: debhelper (>=11), python3-all, python3-setuptools, dh-python
|
||||||
|
Standards-Version: 3.9.4
|
||||||
|
Homepage: https://forge.cadoles.com/Infra/rougail
|
||||||
|
|
||||||
|
Package: python3-rougail
|
||||||
|
Architecture: any
|
||||||
|
Pre-Depends: dpkg, python3, ${misc:Pre-Depends}
|
||||||
|
Depends: ${python:Depends}, ${misc:Depends}, python3-cheetah, python3-tiramisu3
|
||||||
|
Description: configuration manager
|
||||||
|
|
22
debian/copyright
vendored
Normal file
22
debian/copyright
vendored
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||||
|
Upstream-Name: risotto
|
||||||
|
Upstream-Contact: Cadoles <contact@cadoles.com>
|
||||||
|
Source: https://forge.cadoles.com/Infra/rougail
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2019-2020 Cadoles <contact@cadoles.com>
|
||||||
|
License: AGPL-3+
|
||||||
|
|
||||||
|
License: AGPL-3+
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
.
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU Affero General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU Affero General Public License
|
||||||
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
3
debian/rougail.dirs
vendored
Normal file
3
debian/rougail.dirs
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/var/rougail/patches
|
||||||
|
/var/rougail/templates
|
||||||
|
/var/rougail/manifests
|
10
debian/rules
vendored
Normal file
10
debian/rules
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
# See debhelper(7) (uncomment to enable)
|
||||||
|
# output every command that modifies files on the build system.
|
||||||
|
#DH_VERBOSE = 1
|
||||||
|
|
||||||
|
export PYBUILD_NAME = rougail
|
||||||
|
export PYBUILD_DISABLE_python3 = test
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@ --with python3 --buildsystem=pybuild
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
3.0 (quilt)
|
@ -1,6 +1,8 @@
|
|||||||
# Paramètre de type information
|
# Paramètre de type information
|
||||||
|
|
||||||
Le paramètre peut être la valeur est issue d'une information de la configuration.
|
## Les informations de la configuration
|
||||||
|
|
||||||
|
Le paramètre peut être la valeur est issue d'une information de la configuration :
|
||||||
|
|
||||||
```
|
```
|
||||||
<param type="information">server_name</param>
|
<param type="information">server_name</param>
|
||||||
@ -8,3 +10,15 @@ Le paramètre peut être la valeur est issue d'une information de la configurati
|
|||||||
|
|
||||||
Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur du paramètre.
|
Dans ce cas, l'information de la configuration "server_name" sera utilisé comme valeur du paramètre.
|
||||||
Si l'information n'existe pas, la paramètre aura la valeur "None".
|
Si l'information n'existe pas, la paramètre aura la valeur "None".
|
||||||
|
|
||||||
|
## Les informations de la cible
|
||||||
|
|
||||||
|
Le paramètre peut être la valeur est issue d'une information de la cible du calcul :
|
||||||
|
|
||||||
|
```
|
||||||
|
<param type="target_information">test</param>
|
||||||
|
<param type="target_information">help</param>
|
||||||
|
```
|
||||||
|
|
||||||
|
Dans ce cas, l'information de la configuration "test" ou "help" sera utilisé comme valeur du paramètre.
|
||||||
|
Si l'information n'existe pas, la paramètre aura la valeur "None".
|
||||||
|
@ -29,6 +29,8 @@ En plus de la description, il est possible de préciser une aide complémentaire
|
|||||||
<variable name="my_variable" help="This is a greate variable"/>
|
<variable name="my_variable" help="This is a greate variable"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Cette aide peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md).
|
||||||
|
|
||||||
## Le type de la variable
|
## Le type de la variable
|
||||||
|
|
||||||
Une variable a un type. Ce type permet de définir les valeurs acceptées par cette variable :
|
Une variable a un type. Ce type permet de définir les valeurs acceptées par cette variable :
|
||||||
@ -234,6 +236,8 @@ Il est possible de préciser plusieurs valeurs avec le séparateur "|" :
|
|||||||
<variable name="my_variable" test="yes|no"/>
|
<variable name="my_variable" test="yes|no"/>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Cette valeur peut être utilisé à tout moment comme valeur [d'un paramètre](../param/information.md).
|
||||||
|
|
||||||
## Mode de la variable
|
## Mode de la variable
|
||||||
|
|
||||||
Le [mode](../mode.md) par défaut d'une variable correspond au [mode](../mode.md) de la [famille](../family/README.md).
|
Le [mode](../mode.md) par défaut d'une variable correspond au [mode](../mode.md) de la [famille](../family/README.md).
|
||||||
|
@ -27,5 +27,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
from .convert import RougailConvert
|
from .convert import RougailConvert
|
||||||
from .template.systemd import RougailSystemdTemplate
|
from .template.systemd import RougailSystemdTemplate
|
||||||
from .config import RougailConfig
|
from .config import RougailConfig
|
||||||
|
from rougail.update import RougailUpgrade
|
||||||
|
|
||||||
__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig')
|
__ALL__ = ('RougailConvert', 'RougailSystemdTemplate', 'RougailConfig', 'RougailUpgrade')
|
||||||
|
@ -52,6 +52,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
self.functions.extend(INTERNAL_FUNCTIONS)
|
self.functions.extend(INTERNAL_FUNCTIONS)
|
||||||
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
|
self.allow_function = True
|
||||||
self.convert_target(self.objectspace.space.constraints.check)
|
self.convert_target(self.objectspace.space.constraints.check)
|
||||||
self.convert_param(self.objectspace.space.constraints.check)
|
self.convert_param(self.objectspace.space.constraints.check)
|
||||||
self.check_check()
|
self.check_check()
|
||||||
@ -132,11 +133,23 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
has_variable = False
|
has_variable = False
|
||||||
values = []
|
values = []
|
||||||
has_nil = False
|
has_nil = False
|
||||||
|
is_function = False
|
||||||
for param in check.param:
|
for param in check.param:
|
||||||
if has_variable:
|
if has_variable:
|
||||||
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
msg = _(f'only one "variable" parameter is allowed for valid_enum '
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 5, param.xmlfiles)
|
raise DictConsistencyError(msg, 5, param.xmlfiles)
|
||||||
|
if param.type == 'function':
|
||||||
|
is_function = True
|
||||||
|
choice = self.objectspace.choice(variable.xmlfiles)
|
||||||
|
choice.name = param.text
|
||||||
|
choice.type = 'function'
|
||||||
|
choice.param = []
|
||||||
|
variable.values.append(choice)
|
||||||
|
continue
|
||||||
|
if is_function:
|
||||||
|
variable.values[0].param.append(param)
|
||||||
|
continue
|
||||||
param_type = variable.ori_type
|
param_type = variable.ori_type
|
||||||
if param.type == 'variable':
|
if param.type == 'variable':
|
||||||
has_variable = True
|
has_variable = True
|
||||||
@ -148,7 +161,7 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
msg = _(f'only multi "variable" parameter is allowed for valid_enum '
|
msg = _(f'only multi "variable" parameter is allowed for valid_enum '
|
||||||
f'of variable "{variable.name}"')
|
f'of variable "{variable.name}"')
|
||||||
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
raise DictConsistencyError(msg, 6, param.xmlfiles)
|
||||||
param_type = 'calculation'
|
param_type = 'variable'
|
||||||
elif param.type == 'nil':
|
elif param.type == 'nil':
|
||||||
has_nil = True
|
has_nil = True
|
||||||
values.append(param.text)
|
values.append(param.text)
|
||||||
@ -156,6 +169,8 @@ class CheckAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
choice.name = param.text
|
choice.name = param.text
|
||||||
choice.type = param_type
|
choice.type = param_type
|
||||||
variable.values.append(choice)
|
variable.values.append(choice)
|
||||||
|
if is_function:
|
||||||
|
return None
|
||||||
if 'mandatory' not in vars(variable):
|
if 'mandatory' not in vars(variable):
|
||||||
variable.mandatory = not has_nil
|
variable.mandatory = not has_nil
|
||||||
elif variable.mandatory is False:
|
elif variable.mandatory is False:
|
||||||
|
@ -50,6 +50,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
|||||||
return
|
return
|
||||||
self.target_is_uniq = False
|
self.target_is_uniq = False
|
||||||
self.only_variable = False
|
self.only_variable = False
|
||||||
|
self.allow_function = False
|
||||||
self.convert_target(self.objectspace.space.constraints.condition)
|
self.convert_target(self.objectspace.space.constraints.condition)
|
||||||
self.check_condition_optional()
|
self.check_condition_optional()
|
||||||
self.convert_condition_source()
|
self.convert_condition_source()
|
||||||
@ -74,14 +75,14 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
|||||||
for variable in self.get_variables():
|
for variable in self.get_variables():
|
||||||
if not variable.auto_freeze and not variable.auto_save:
|
if not variable.auto_freeze and not variable.auto_save:
|
||||||
continue
|
continue
|
||||||
if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
|
#if variable.namespace != self.objectspace.rougailconfig['variable_namespace']:
|
||||||
msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
|
# msg = _(f'auto_freeze is not allowed in extra "{variable.namespace}"')
|
||||||
raise DictConsistencyError(msg, 49, variable.xmlfiles)
|
# raise DictConsistencyError(msg, 49, variable.xmlfiles)
|
||||||
variable.force_store_value = True
|
variable.force_store_value = True
|
||||||
if variable.auto_save:
|
if variable.auto_save:
|
||||||
continue
|
continue
|
||||||
new_condition = self.objectspace.condition(variable.xmlfiles)
|
new_condition = self.objectspace.condition(variable.xmlfiles)
|
||||||
new_condition.name = 'auto_frozen_if_not_in'
|
new_condition.name = 'auto_frozen_if_in'
|
||||||
new_condition.namespace = variable.namespace
|
new_condition.namespace = variable.namespace
|
||||||
new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable']
|
new_condition.source = self.objectspace.rougailconfig['auto_freeze_variable']
|
||||||
new_param = self.objectspace.param(variable.xmlfiles)
|
new_param = self.objectspace.param(variable.xmlfiles)
|
||||||
@ -89,7 +90,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
|||||||
new_condition.param = [new_param]
|
new_condition.param = [new_param]
|
||||||
new_target = self.objectspace.target(variable.xmlfiles)
|
new_target = self.objectspace.target(variable.xmlfiles)
|
||||||
new_target.type = 'variable'
|
new_target.type = 'variable'
|
||||||
new_target.name = variable.name
|
new_target.name = variable.path
|
||||||
new_condition.target = [new_target]
|
new_condition.target = [new_target]
|
||||||
if not hasattr(self.objectspace.space, 'constraints'):
|
if not hasattr(self.objectspace.space, 'constraints'):
|
||||||
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)
|
self.objectspace.space.constraints = self.objectspace.constraints(variable.xmlfiles)
|
||||||
@ -149,7 +150,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
|||||||
"""
|
"""
|
||||||
if condition_name.startswith('hidden_if_'):
|
if condition_name.startswith('hidden_if_'):
|
||||||
return ['hidden', 'frozen', 'force_default_on_freeze']
|
return ['hidden', 'frozen', 'force_default_on_freeze']
|
||||||
if condition_name == 'auto_frozen_if_not_in':
|
if condition_name == 'auto_frozen_if_in':
|
||||||
return ['frozen']
|
return ['frozen']
|
||||||
return [condition_name.split('_', 1)[0]]
|
return [condition_name.split('_', 1)[0]]
|
||||||
|
|
||||||
@ -250,6 +251,7 @@ class ConditionAnnotator(TargetAnnotator, ParamAnnotator, Walk):
|
|||||||
param3.name = f'condition_{fill.index}'
|
param3.name = f'condition_{fill.index}'
|
||||||
param3.type = 'variable'
|
param3.type = 'variable'
|
||||||
param3.text = condition.source.path
|
param3.text = condition.source.path
|
||||||
|
param3.propertyerror = False
|
||||||
fill.param.append(param3)
|
fill.param.append(param3)
|
||||||
param4 = self.objectspace.param(target.xmlfiles)
|
param4 = self.objectspace.param(target.xmlfiles)
|
||||||
param4.name = f'expected_{fill.index}'
|
param4.name = f'expected_{fill.index}'
|
||||||
|
@ -26,7 +26,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
from ..utils import normalize_family
|
|
||||||
from .variable import Walk
|
from .variable import Walk
|
||||||
|
|
||||||
|
|
||||||
@ -91,7 +90,6 @@ class FamilyAnnotator(Walk):
|
|||||||
family.description = family.name
|
family.description = family.name
|
||||||
family.doc = family.description
|
family.doc = family.description
|
||||||
del family.description
|
del family.description
|
||||||
family.name = normalize_family(family.name)
|
|
||||||
|
|
||||||
def change_modes(self):
|
def change_modes(self):
|
||||||
"""change the mode of variables
|
"""change the mode of variables
|
||||||
|
@ -32,6 +32,9 @@ from .target import TargetAnnotator
|
|||||||
from .param import ParamAnnotator
|
from .param import ParamAnnotator
|
||||||
|
|
||||||
|
|
||||||
|
CALC_MULTI = ('calc_value', 'calc_list', 'get_range', 'calc_val_first_value', 'unbound_filename')
|
||||||
|
|
||||||
|
|
||||||
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
||||||
"""Fill annotator
|
"""Fill annotator
|
||||||
"""
|
"""
|
||||||
@ -44,13 +47,23 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
not hasattr(self.objectspace.space.constraints, 'fill'):
|
not hasattr(self.objectspace.space.constraints, 'fill'):
|
||||||
return
|
return
|
||||||
self.functions = dir(load_modules(eosfunc_file))
|
self.functions = dir(load_modules(eosfunc_file))
|
||||||
|
self.functions.extend(self.objectspace.rougailconfig['internal_functions'])
|
||||||
self.target_is_uniq = True
|
self.target_is_uniq = True
|
||||||
self.only_variable = True
|
self.only_variable = True
|
||||||
|
self.allow_function = False
|
||||||
self.convert_target(self.objectspace.space.constraints.fill)
|
self.convert_target(self.objectspace.space.constraints.fill)
|
||||||
self.convert_param(self.objectspace.space.constraints.fill)
|
self.convert_param(self.objectspace.space.constraints.fill)
|
||||||
self.fill_to_value()
|
self.fill_to_value()
|
||||||
del self.objectspace.space.constraints.fill
|
del self.objectspace.space.constraints.fill
|
||||||
|
|
||||||
|
def calc_is_multi(self, variable: 'self.objectspace.variable') -> bool:
|
||||||
|
multi = variable.multi
|
||||||
|
if multi is False:
|
||||||
|
return multi
|
||||||
|
if multi == 'submulti':
|
||||||
|
return True
|
||||||
|
return not self.objectspace.paths.is_follower(variable.path)
|
||||||
|
|
||||||
def fill_to_value(self) -> None:
|
def fill_to_value(self) -> None:
|
||||||
"""valid and manage <fill>
|
"""valid and manage <fill>
|
||||||
"""
|
"""
|
||||||
@ -65,6 +78,11 @@ class FillAnnotator(TargetAnnotator, ParamAnnotator):
|
|||||||
value = self.objectspace.value(fill.xmlfiles)
|
value = self.objectspace.value(fill.xmlfiles)
|
||||||
value.type = 'calculation'
|
value.type = 'calculation'
|
||||||
value.name = fill.name
|
value.name = fill.name
|
||||||
|
if fill.name not in CALC_MULTI:
|
||||||
|
is_calc_multi = self.calc_is_multi(target.name)
|
||||||
|
else:
|
||||||
|
is_calc_multi = False
|
||||||
|
value.calc_multi = is_calc_multi
|
||||||
if target.name.namespace == 'services':
|
if target.name.namespace == 'services':
|
||||||
target.name.default = value
|
target.name.default = value
|
||||||
else:
|
else:
|
||||||
|
@ -50,7 +50,7 @@ class GroupAnnotator:
|
|||||||
if group.leader in cache_paths:
|
if group.leader in cache_paths:
|
||||||
leader_fam_path = cache_paths[group.leader]
|
leader_fam_path = cache_paths[group.leader]
|
||||||
else:
|
else:
|
||||||
leader_fam_path = self.objectspace.paths.get_variable_family_path(group.leader)
|
leader_fam_path = self.objectspace.paths.get_variable_family_path(group.leader, group.xmlfiles)
|
||||||
cache_paths[group.leader] = leader_fam_path
|
cache_paths[group.leader] = leader_fam_path
|
||||||
follower_names = list(group.follower.keys())
|
follower_names = list(group.follower.keys())
|
||||||
leader = self.objectspace.paths.get_variable(group.leader)
|
leader = self.objectspace.paths.get_variable(group.leader)
|
||||||
|
@ -24,7 +24,10 @@ You should have received a copy of the GNU General Public License
|
|||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
import tiramisu
|
try:
|
||||||
|
import tiramisu3 as tiramisu
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
import tiramisu
|
||||||
|
|
||||||
from .variable import CONVERT_OPTION
|
from .variable import CONVERT_OPTION
|
||||||
|
|
||||||
@ -82,6 +85,16 @@ class ParamAnnotator:
|
|||||||
if err.errno != 42 or not param.optional:
|
if err.errno != 42 or not param.optional:
|
||||||
raise err
|
raise err
|
||||||
param_to_delete.append(param_idx)
|
param_to_delete.append(param_idx)
|
||||||
|
elif param.type == 'function':
|
||||||
|
if not self.allow_function:
|
||||||
|
msg = _(f'cannot use "function" type')
|
||||||
|
raise DictConsistencyError(msg, 74, param.xmlfiles)
|
||||||
|
if not param.text in self.functions:
|
||||||
|
msg = _(f'cannot find function "{param.text}"')
|
||||||
|
raise DictConsistencyError(msg, 67, param.xmlfiles)
|
||||||
|
if param_idx != 0:
|
||||||
|
msg = _(f'function "{param.text}" must only set has first parameter')
|
||||||
|
raise DictConsistencyError(msg, 75, param.xmlfiles)
|
||||||
elif variable_type:
|
elif variable_type:
|
||||||
self._convert_with_variable_type(variable_type, param)
|
self._convert_with_variable_type(variable_type, param)
|
||||||
continue
|
continue
|
||||||
|
@ -50,7 +50,8 @@ class PropertyAnnotator(Walk):
|
|||||||
"""convert properties
|
"""convert properties
|
||||||
"""
|
"""
|
||||||
# hidden variable is also frozen
|
# hidden variable is also frozen
|
||||||
if isinstance(variable, self.objectspace.variable) and variable.hidden is True:
|
if isinstance(variable, self.objectspace.variable) and variable.hidden is True and \
|
||||||
|
variable.name != self.objectspace.rougailconfig['auto_freeze_variable']:
|
||||||
if not variable.auto_freeze:
|
if not variable.auto_freeze:
|
||||||
variable.frozen = True
|
variable.frozen = True
|
||||||
if not variable.auto_save and \
|
if not variable.auto_save and \
|
||||||
|
@ -297,7 +297,7 @@ class ServiceAnnotator:
|
|||||||
msg = _(f'ip with ip_type "{variable.type}" must have netmask')
|
msg = _(f'ip with ip_type "{variable.type}" must have netmask')
|
||||||
raise DictConsistencyError(msg, 64, ip.xmlfiles)
|
raise DictConsistencyError(msg, 64, ip.xmlfiles)
|
||||||
if hasattr(ip, 'netmask'):
|
if hasattr(ip, 'netmask'):
|
||||||
netmask = self.objectspace.paths.get_variable(ip.netmask)
|
netmask = self.objectspace.paths.get_variable(ip.netmask, ip.xmlfiles)
|
||||||
if netmask.type != 'netmask':
|
if netmask.type != 'netmask':
|
||||||
msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"')
|
msg = _(f'netmask in ip must have type "netmask", not "{netmask.type}"')
|
||||||
raise DictConsistencyError(msg, 65, ip.xmlfiles)
|
raise DictConsistencyError(msg, 65, ip.xmlfiles)
|
||||||
|
@ -28,7 +28,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import DictConsistencyError
|
from ..error import DictConsistencyError
|
||||||
from ..objspace import convert_boolean
|
from ..objspace import convert_boolean
|
||||||
from ..utils import normalize_family
|
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
||||||
@ -50,7 +49,7 @@ CONVERT_OPTION = {'number': dict(opttype="IntOption", func=int),
|
|||||||
'broadcast': dict(opttype="BroadcastOption"),
|
'broadcast': dict(opttype="BroadcastOption"),
|
||||||
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios',
|
'netbios': dict(opttype="DomainnameOption", initkwargs={'type': 'netbios',
|
||||||
'warnings_only': True}),
|
'warnings_only': True}),
|
||||||
'domain': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
|
'domainname': dict(opttype="DomainnameOption", initkwargs={'type': 'domainname',
|
||||||
'allow_ip': False}),
|
'allow_ip': False}),
|
||||||
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname',
|
'hostname': dict(opttype="DomainnameOption", initkwargs={'type': 'hostname',
|
||||||
'allow_ip': False}),
|
'allow_ip': False}),
|
||||||
@ -171,7 +170,6 @@ class VariableAnnotator(Walk): # pylint: disable=R0903
|
|||||||
if not variable.value:
|
if not variable.value:
|
||||||
del variable.value
|
del variable.value
|
||||||
variable.doc = variable.description
|
variable.doc = variable.description
|
||||||
variable.name = normalize_family(variable.name)
|
|
||||||
del variable.description
|
del variable.description
|
||||||
if variable_type == 'follower':
|
if variable_type == 'follower':
|
||||||
if variable.multi is True:
|
if variable.multi is True:
|
||||||
|
@ -67,7 +67,7 @@
|
|||||||
<!ATTLIST file group CDATA "root">
|
<!ATTLIST file group CDATA "root">
|
||||||
<!ATTLIST file filelist CDATA #IMPLIED>
|
<!ATTLIST file filelist CDATA #IMPLIED>
|
||||||
<!ATTLIST file redefine (True|False) "False">
|
<!ATTLIST file redefine (True|False) "False">
|
||||||
<!ATTLIST file engine (none|creole|jinja2) #IMPLIED>
|
<!ATTLIST file engine (none|creole|jinja2|creole_legacy) #IMPLIED>
|
||||||
<!ATTLIST file included (no|name|content) "no">
|
<!ATTLIST file included (no|name|content) "no">
|
||||||
|
|
||||||
<!ELEMENT override EMPTY>
|
<!ELEMENT override EMPTY>
|
||||||
@ -86,7 +86,7 @@
|
|||||||
|
|
||||||
<!ELEMENT variable (value*)>
|
<!ELEMENT variable (value*)>
|
||||||
<!ATTLIST variable name CDATA #REQUIRED>
|
<!ATTLIST variable name CDATA #REQUIRED>
|
||||||
<!ATTLIST variable type (number|float|string|password|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domain|hostname|web_address|port|mac|cidr|network_cidr|schedule|schedulemod) "string">
|
<!ATTLIST variable type (number|float|string|password|mail|boolean|filename|date|unix_user|ip|local_ip|netmask|network|broadcast|netbios|domainname|hostname|web_address|port|mac|cidr|network_cidr|schedule|schedulemod) "string">
|
||||||
<!ATTLIST variable description CDATA #IMPLIED>
|
<!ATTLIST variable description CDATA #IMPLIED>
|
||||||
<!ATTLIST variable help CDATA #IMPLIED>
|
<!ATTLIST variable help CDATA #IMPLIED>
|
||||||
<!ATTLIST variable hidden (True|False) "False">
|
<!ATTLIST variable hidden (True|False) "False">
|
||||||
@ -121,7 +121,7 @@
|
|||||||
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
<!ATTLIST condition apply_on_fallback (True|False) #IMPLIED>
|
||||||
|
|
||||||
<!ELEMENT param (#PCDATA)>
|
<!ELEMENT param (#PCDATA)>
|
||||||
<!ATTLIST param type (string|number|nil|boolean|variable|information|suffix|index) "string">
|
<!ATTLIST param type (string|number|nil|boolean|variable|function|information|target_information|suffix|index) "string">
|
||||||
<!ATTLIST param name CDATA #IMPLIED>
|
<!ATTLIST param name CDATA #IMPLIED>
|
||||||
<!ATTLIST param propertyerror (True|False) "True">
|
<!ATTLIST param propertyerror (True|False) "True">
|
||||||
<!ATTLIST param optional (True|False) "False">
|
<!ATTLIST param optional (True|False) "False">
|
||||||
|
@ -70,3 +70,8 @@ class DictConsistencyError(Exception):
|
|||||||
msg = _(f'{msg} in {display_xmlfiles(xmlfiles)}')
|
msg = _(f'{msg} in {display_xmlfiles(xmlfiles)}')
|
||||||
super().__init__(msg)
|
super().__init__(msg)
|
||||||
self.errno = errno
|
self.errno = errno
|
||||||
|
|
||||||
|
|
||||||
|
class UpgradeError(Exception):
|
||||||
|
"""Error during XML upgrade
|
||||||
|
"""
|
||||||
|
@ -29,7 +29,7 @@ from typing import Optional
|
|||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
from .xmlreflector import XMLReflector
|
from .xmlreflector import XMLReflector
|
||||||
from .utils import normalize_family
|
from .utils import valid_variable_family_name
|
||||||
from .error import SpaceObjShallNotBeUpdated, DictConsistencyError
|
from .error import SpaceObjShallNotBeUpdated, DictConsistencyError
|
||||||
from .path import Path
|
from .path import Path
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ class RougailObjSpace:
|
|||||||
if child.tag == 'family':
|
if child.tag == 'family':
|
||||||
if child.attrib['name'] in family_names:
|
if child.attrib['name'] in family_names:
|
||||||
msg = _(f'Family "{child.attrib["name"]}" is set several times')
|
msg = _(f'Family "{child.attrib["name"]}" is set several times')
|
||||||
raise DictConsistencyError(msg, 44, xmlfile)
|
raise DictConsistencyError(msg, 44, [xmlfile])
|
||||||
family_names.append(child.attrib['name'])
|
family_names.append(child.attrib['name'])
|
||||||
try:
|
try:
|
||||||
# variable objects creation
|
# variable objects creation
|
||||||
@ -296,6 +296,7 @@ class RougailObjSpace:
|
|||||||
"""A redefinable object could be created or updated
|
"""A redefinable object could be created or updated
|
||||||
"""
|
"""
|
||||||
existed_var = self.get_existed_obj(name,
|
existed_var = self.get_existed_obj(name,
|
||||||
|
xmlfile,
|
||||||
space,
|
space,
|
||||||
child,
|
child,
|
||||||
namespace,
|
namespace,
|
||||||
@ -337,6 +338,7 @@ class RougailObjSpace:
|
|||||||
|
|
||||||
def get_existed_obj(self,
|
def get_existed_obj(self,
|
||||||
name: str,
|
name: str,
|
||||||
|
xmlfile: str,
|
||||||
space: str,
|
space: str,
|
||||||
child,
|
child,
|
||||||
namespace: str,
|
namespace: str,
|
||||||
@ -344,7 +346,7 @@ class RougailObjSpace:
|
|||||||
"""if an object exists, return it
|
"""if an object exists, return it
|
||||||
"""
|
"""
|
||||||
if child.tag in ['variable', 'family']:
|
if child.tag in ['variable', 'family']:
|
||||||
name = normalize_family(name)
|
valid_variable_family_name(name, [xmlfile])
|
||||||
if child.tag == 'variable': # pylint: disable=E1101
|
if child.tag == 'variable': # pylint: disable=E1101
|
||||||
if namespace != self.rougailconfig['variable_namespace']:
|
if namespace != self.rougailconfig['variable_namespace']:
|
||||||
name = space.path + '.' + name
|
name = space.path + '.' + name
|
||||||
@ -468,18 +470,18 @@ class RougailObjSpace:
|
|||||||
"""
|
"""
|
||||||
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
if isinstance(variableobj, self.variable): # pylint: disable=E1101
|
||||||
if 'name' in document.attrib:
|
if 'name' in document.attrib:
|
||||||
family_name = normalize_family(document.attrib['name'])
|
family_name = document.attrib['name']
|
||||||
else:
|
else:
|
||||||
family_name = namespace
|
family_name = namespace
|
||||||
|
|
||||||
self.paths.add_variable(namespace,
|
self.paths.add_variable(namespace,
|
||||||
normalize_family(variableobj.name),
|
variableobj.name,
|
||||||
space.path,
|
space.path,
|
||||||
document.attrib.get('dynamic') is not None,
|
document.attrib.get('dynamic') is not None,
|
||||||
variableobj,
|
variableobj,
|
||||||
)
|
)
|
||||||
elif isinstance(variableobj, self.family): # pylint: disable=E1101
|
elif isinstance(variableobj, self.family): # pylint: disable=E1101
|
||||||
family_name = normalize_family(variableobj.name)
|
family_name = variableobj.name
|
||||||
if namespace != self.rougailconfig['variable_namespace']:
|
if namespace != self.rougailconfig['variable_namespace']:
|
||||||
family_name = namespace + '.' + family_name
|
family_name = namespace + '.' + family_name
|
||||||
self.paths.add_family(namespace,
|
self.paths.add_family(namespace,
|
||||||
@ -502,8 +504,6 @@ class RougailObjSpace:
|
|||||||
if isinstance(variableobj, Redefinable):
|
if isinstance(variableobj, Redefinable):
|
||||||
name = variableobj.name
|
name = variableobj.name
|
||||||
tag = FORCE_TAG.get(child.tag, child.tag)
|
tag = FORCE_TAG.get(child.tag, child.tag)
|
||||||
if child.tag in ['family', 'variable']:
|
|
||||||
name = normalize_family(name)
|
|
||||||
getattr(space, tag)[name] = variableobj
|
getattr(space, tag)[name] = variableobj
|
||||||
elif isinstance(variableobj, UnRedefinable):
|
elif isinstance(variableobj, UnRedefinable):
|
||||||
getattr(space, child.tag).append(variableobj)
|
getattr(space, child.tag).append(variableobj)
|
||||||
|
@ -187,10 +187,11 @@ class Path:
|
|||||||
|
|
||||||
def get_variable_family_path(self,
|
def get_variable_family_path(self,
|
||||||
name: str,
|
name: str,
|
||||||
|
xmlfiles: List[str]=False,
|
||||||
) -> str: # pylint: disable=C0111
|
) -> str: # pylint: disable=C0111
|
||||||
"""Get the full path of a family
|
"""Get the full path of a family
|
||||||
"""
|
"""
|
||||||
return self._get_variable(name)['family']
|
return self._get_variable(name, xmlfiles=xmlfiles)['family']
|
||||||
|
|
||||||
def get_variable_path(self,
|
def get_variable_path(self,
|
||||||
name: str,
|
name: str,
|
||||||
|
@ -166,11 +166,14 @@ class RougailExtra:
|
|||||||
try:
|
try:
|
||||||
return self.suboption[key]
|
return self.suboption[key]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
raise AttributeError
|
raise AttributeError(f'unable to find extra "{key}"')
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
return iter(self.suboption.values())
|
return iter(self.suboption.values())
|
||||||
|
|
||||||
|
def items(self):
|
||||||
|
return self.suboption.items()
|
||||||
|
|
||||||
|
|
||||||
class RougailBaseTemplate:
|
class RougailBaseTemplate:
|
||||||
"""Engine to process Creole cheetah template
|
"""Engine to process Creole cheetah template
|
||||||
@ -231,7 +234,7 @@ class RougailBaseTemplate:
|
|||||||
|
|
||||||
def instance_file(self,
|
def instance_file(self,
|
||||||
filevar: Dict,
|
filevar: Dict,
|
||||||
type: str,
|
type_: str,
|
||||||
service_name: str,
|
service_name: str,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Run templatisation on one file
|
"""Run templatisation on one file
|
||||||
@ -241,7 +244,7 @@ class RougailBaseTemplate:
|
|||||||
variable = filevar['variable']
|
variable = filevar['variable']
|
||||||
else:
|
else:
|
||||||
variable = None
|
variable = None
|
||||||
filenames = filevar['name']
|
filenames = filevar.get('name')
|
||||||
if not isinstance(filenames, list):
|
if not isinstance(filenames, list):
|
||||||
filenames = [filenames]
|
filenames = [filenames]
|
||||||
if variable and not isinstance(variable, list):
|
if variable and not isinstance(variable, list):
|
||||||
@ -253,7 +256,7 @@ class RougailBaseTemplate:
|
|||||||
var = variable[idx]
|
var = variable[idx]
|
||||||
else:
|
else:
|
||||||
var = None
|
var = None
|
||||||
func = f'_instance_{type}'
|
func = f'_instance_{type_}'
|
||||||
data = getattr(self, func)(filevar,
|
data = getattr(self, func)(filevar,
|
||||||
filename,
|
filename,
|
||||||
service_name,
|
service_name,
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
from . import none, creole, jinja2
|
from . import none, creole, jinja2, creole_legacy
|
||||||
|
|
||||||
|
|
||||||
__all__ = ('none', 'creole', 'jinja2')
|
__all__ = ('none', 'creole', 'jinja2', 'creole_legacy')
|
||||||
|
@ -63,15 +63,13 @@ class CheetahTemplate(Template): # pylint: disable=W0223
|
|||||||
"""Initialize Creole CheetahTemplate
|
"""Initialize Creole CheetahTemplate
|
||||||
"""
|
"""
|
||||||
if filename is not None:
|
if filename is not None:
|
||||||
Template.__init__(self,
|
super().__init__(file=filename,
|
||||||
file=filename,
|
searchList=[context, eosfunc, extra_context],
|
||||||
searchList=[context, eosfunc, extra_context],
|
)
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
Template.__init__(self,
|
super().__init__(source=source,
|
||||||
source=source,
|
searchList=[context, eosfunc, extra_context],
|
||||||
searchList=[context, eosfunc, extra_context],
|
)
|
||||||
)
|
|
||||||
|
|
||||||
# FORK of Cheetah function, do not replace '\\' by '/'
|
# FORK of Cheetah function, do not replace '\\' by '/'
|
||||||
def serverSidePath(self,
|
def serverSidePath(self,
|
||||||
@ -92,6 +90,7 @@ class CheetahTemplate(Template): # pylint: disable=W0223
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
# Sync to creole_legacy.py
|
||||||
def process(filename: str,
|
def process(filename: str,
|
||||||
source: str,
|
source: str,
|
||||||
true_destfilename: str,
|
true_destfilename: str,
|
||||||
|
157
src/rougail/template/engine/creole_legacy.py
Normal file
157
src/rougail/template/engine/creole_legacy.py
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
"""Legacy Creole engine
|
||||||
|
|
||||||
|
Created by:
|
||||||
|
EOLE (http://eole.orion.education.fr)
|
||||||
|
Copyright (C) 2005-2018
|
||||||
|
|
||||||
|
Forked by:
|
||||||
|
Cadoles (http://www.cadoles.com)
|
||||||
|
Copyright (C) 2021
|
||||||
|
|
||||||
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
from typing import Dict, Any
|
||||||
|
from Cheetah.NameMapper import NotFound
|
||||||
|
|
||||||
|
from .creole import CheetahTemplate as oriCheetahTemplate
|
||||||
|
from ...i18n import _
|
||||||
|
from ...utils import normalize_family
|
||||||
|
from ...error import TemplateError
|
||||||
|
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def cl_compile(kls, *args, **kwargs):
|
||||||
|
"""Rewrite compile methode to force some settings
|
||||||
|
"""
|
||||||
|
kwargs['compilerSettings'] = {'directiveStartToken' : u'%',
|
||||||
|
'cheetahVarStartToken' : u'%%',
|
||||||
|
'EOLSlurpToken' : u'%',
|
||||||
|
'PSPStartToken' : u'µ' * 10,
|
||||||
|
'PSPEndToken' : u'µ' * 10,
|
||||||
|
'commentStartToken' : u'µ' * 10,
|
||||||
|
'commentEndToken' : u'µ' * 10,
|
||||||
|
'multiLineCommentStartToken' : u'µ' * 10,
|
||||||
|
'multiLineCommentEndToken' : u'µ' * 10}
|
||||||
|
return kls.old_compile(*args, **kwargs) # pylint: disable=E1101
|
||||||
|
oriCheetahTemplate.compile = cl_compile
|
||||||
|
|
||||||
|
|
||||||
|
class IsDefined:
|
||||||
|
"""
|
||||||
|
filtre permettant de ne pas lever d'exception au cas où
|
||||||
|
la variable Creole n'est pas définie
|
||||||
|
"""
|
||||||
|
def __init__(self, context):
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
def __call__(self, varname):
|
||||||
|
if '.' in varname:
|
||||||
|
splitted_var = varname.split('.')
|
||||||
|
if len(splitted_var) != 2:
|
||||||
|
msg = u"Group variables must be of type master.slave"
|
||||||
|
raise KeyError(msg)
|
||||||
|
master, slave = splitted_var
|
||||||
|
if master in self.context:
|
||||||
|
return slave in self.context[master].slave.keys()
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return varname in self.context
|
||||||
|
|
||||||
|
|
||||||
|
class CreoleClient():
|
||||||
|
def get(self, path):
|
||||||
|
path = path.replace('/', '.')
|
||||||
|
if path.startswith('.'):
|
||||||
|
path = path[1:]
|
||||||
|
if '.' not in path:
|
||||||
|
return self.context[path]
|
||||||
|
else:
|
||||||
|
root, path = path.split('.', 1)
|
||||||
|
obj = self.context[root]
|
||||||
|
for var in path.split('.'):
|
||||||
|
obj = getattr(obj, var)
|
||||||
|
return obj
|
||||||
|
|
||||||
|
|
||||||
|
def is_empty(data):
|
||||||
|
if str(data) in ['', '""', "''", "[]", "['']", '[""]', "None"]:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class CheetahTemplate(oriCheetahTemplate):
|
||||||
|
def __init__(self,
|
||||||
|
filename: str,
|
||||||
|
source: str,
|
||||||
|
context,
|
||||||
|
eosfunc: Dict,
|
||||||
|
extra_context: Dict,
|
||||||
|
):
|
||||||
|
creole_client = CreoleClient()
|
||||||
|
creole_client.context=context
|
||||||
|
extra_context['is_defined'] = IsDefined(context)
|
||||||
|
extra_context['creole_client'] = creole_client
|
||||||
|
extra_context['is_empty'] = is_empty
|
||||||
|
extra_context['_creole_filename'] = extra_context['rougail_filename']
|
||||||
|
super().__init__(filename, source, context, eosfunc, extra_context)
|
||||||
|
|
||||||
|
|
||||||
|
# Sync to creole.py
|
||||||
|
def process(filename: str,
|
||||||
|
source: str,
|
||||||
|
true_destfilename: str,
|
||||||
|
destfilename: str,
|
||||||
|
destdir: str,
|
||||||
|
variable: Any,
|
||||||
|
rougail_variables_dict: Dict,
|
||||||
|
eosfunc: Dict,
|
||||||
|
):
|
||||||
|
"""Process a cheetah template
|
||||||
|
"""
|
||||||
|
# full path of the destination file
|
||||||
|
try:
|
||||||
|
extra_context = {'normalize_family': normalize_family,
|
||||||
|
'rougail_filename': true_destfilename,
|
||||||
|
'rougail_destination_dir': destdir,
|
||||||
|
}
|
||||||
|
if variable is not None:
|
||||||
|
extra_context['rougail_variable'] = variable
|
||||||
|
cheetah_template = CheetahTemplate(filename,
|
||||||
|
source,
|
||||||
|
rougail_variables_dict,
|
||||||
|
eosfunc,
|
||||||
|
extra_context,
|
||||||
|
)
|
||||||
|
data = str(cheetah_template)
|
||||||
|
except NotFound as err: # pragma: no cover
|
||||||
|
varname = err.args[0][13:-1]
|
||||||
|
if filename:
|
||||||
|
msg = f"Error: unknown variable used in template {filename} to {destfilename}: {varname}"
|
||||||
|
else:
|
||||||
|
msg = f"Error: unknown variable used in file {destfilename}: {varname}"
|
||||||
|
raise TemplateError(_(msg)) from err
|
||||||
|
except Exception as err: # pragma: no cover
|
||||||
|
if filename:
|
||||||
|
msg = _(f"Error while instantiating template {filename} to {destfilename}: {err}")
|
||||||
|
else:
|
||||||
|
msg = _(f"Error while instantiating filename {destfilename}: {err}")
|
||||||
|
raise TemplateError(msg) from err
|
||||||
|
|
||||||
|
with open(destfilename, 'w') as file_h:
|
||||||
|
file_h.write(data)
|
@ -58,7 +58,8 @@ z %%filename - - - - -
|
|||||||
%end if
|
%end if
|
||||||
%end for
|
%end for
|
||||||
%end if
|
%end if
|
||||||
%end for"""
|
%end for
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
class RougailSystemdTemplate(RougailBaseTemplate):
|
class RougailSystemdTemplate(RougailBaseTemplate):
|
||||||
|
@ -219,7 +219,7 @@ class Common:
|
|||||||
"""Populate properties
|
"""Populate properties
|
||||||
"""
|
"""
|
||||||
option_name = child.source.reflector_object.get()
|
option_name = child.source.reflector_object.get()
|
||||||
kwargs = (f"'condition': ParamOption({option_name}, todict=True), "
|
kwargs = (f"'condition': ParamOption({option_name}, todict=True, notraisepropertyerror=True), "
|
||||||
f"'expected': {self.populate_param(child.expected)}")
|
f"'expected': {self.populate_param(child.expected)}")
|
||||||
if child.inverse:
|
if child.inverse:
|
||||||
kwargs += ", 'reverse_condition': ParamValue(True)"
|
kwargs += ", 'reverse_condition': ParamValue(True)"
|
||||||
@ -252,6 +252,8 @@ class Common:
|
|||||||
return self.build_option_param(param)
|
return self.build_option_param(param)
|
||||||
if param.type == 'information':
|
if param.type == 'information':
|
||||||
return f'ParamInformation("{param.text}", None)'
|
return f'ParamInformation("{param.text}", None)'
|
||||||
|
if param.type == 'target_information':
|
||||||
|
return f'ParamSelfInformation("{param.text}", None)'
|
||||||
if param.type == 'suffix':
|
if param.type == 'suffix':
|
||||||
return 'ParamSuffix()'
|
return 'ParamSuffix()'
|
||||||
if param.type == 'index':
|
if param.type == 'index':
|
||||||
@ -267,7 +269,8 @@ class Common:
|
|||||||
params = [f'{option_name}']
|
params = [f'{option_name}']
|
||||||
if hasattr(param, 'suffix'):
|
if hasattr(param, 'suffix'):
|
||||||
param_type = 'ParamDynOption'
|
param_type = 'ParamDynOption'
|
||||||
params.extend([f"'{param.suffix}'", f'{param.family.reflector_name}'])
|
family = param.family.reflector_object.get()
|
||||||
|
params.extend([f"'{param.suffix}'", f'{family}'])
|
||||||
else:
|
else:
|
||||||
param_type = 'ParamOption'
|
param_type = 'ParamOption'
|
||||||
if not param.propertyerror:
|
if not param.propertyerror:
|
||||||
@ -293,9 +296,11 @@ class Variable(Common):
|
|||||||
keys['opt'] = self.elt.opt.reflector_object.get()
|
keys['opt'] = self.elt.opt.reflector_object.get()
|
||||||
if hasattr(self.elt, 'values'):
|
if hasattr(self.elt, 'values'):
|
||||||
values = self.elt.values
|
values = self.elt.values
|
||||||
if values[0].type == 'calculation':
|
if values[0].type == 'variable':
|
||||||
value = values[0].name.reflector_object.get()
|
value = values[0].name.reflector_object.get()
|
||||||
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
keys['values'] = f"Calculation(func.calc_value, Params((ParamOption({value}))))"
|
||||||
|
elif values[0].type == 'function':
|
||||||
|
keys['values'] = self.calculation_value(self.elt.values[0], [])
|
||||||
else:
|
else:
|
||||||
keys['values'] = str(tuple([val.name for val in values]))
|
keys['values'] = str(tuple([val.name for val in values]))
|
||||||
if hasattr(self.elt, 'multi') and self.elt.multi:
|
if hasattr(self.elt, 'multi') and self.elt.multi:
|
||||||
@ -306,11 +311,11 @@ class Variable(Common):
|
|||||||
if isinstance(value, str):
|
if isinstance(value, str):
|
||||||
value = self.convert_str(value)
|
value = self.convert_str(value)
|
||||||
elif isinstance(value, self.objectspace.value):
|
elif isinstance(value, self.objectspace.value):
|
||||||
value = self.calculation_value(value, [])
|
value = self.calculation_value(value, [], calc_multi=value.calc_multi)
|
||||||
keys[key] = value
|
keys[key] = value
|
||||||
if hasattr(self.elt, 'validators'):
|
if hasattr(self.elt, 'validators'):
|
||||||
keys['validators'] = '[' + ', '.join([self.calculation_value(val,
|
keys['validators'] = '[' + ', '.join([self.calculation_value(val,
|
||||||
['ParamSelfOption()']) for val in self.elt.validators]) + ']'
|
['ParamSelfOption(whole=False)']) for val in self.elt.validators]) + ']'
|
||||||
for key in ['min_number', 'max_number']:
|
for key in ['min_number', 'max_number']:
|
||||||
if hasattr(self.elt, key):
|
if hasattr(self.elt, key):
|
||||||
keys[key] = getattr(self.elt, key)
|
keys[key] = getattr(self.elt, key)
|
||||||
@ -322,26 +327,36 @@ class Variable(Common):
|
|||||||
def calculation_value(self,
|
def calculation_value(self,
|
||||||
child,
|
child,
|
||||||
args,
|
args,
|
||||||
|
calc_multi=False,
|
||||||
) -> str:
|
) -> str:
|
||||||
"""Generate calculated value
|
"""Generate calculated value
|
||||||
"""
|
"""
|
||||||
kwargs = []
|
kwargs = []
|
||||||
# has parameters
|
# has parameters
|
||||||
function = child.name
|
function = child.name
|
||||||
|
new_args = []
|
||||||
if hasattr(child, 'param'):
|
if hasattr(child, 'param'):
|
||||||
for param in child.param:
|
for param in child.param:
|
||||||
value = self.populate_param(param)
|
value = self.populate_param(param)
|
||||||
if not hasattr(param, 'name'):
|
if not hasattr(param, 'name'):
|
||||||
args.append(str(value))
|
new_args.append(str(value))
|
||||||
else:
|
else:
|
||||||
kwargs.append(f"'{param.name}': " + value)
|
kwargs.append(f"'{param.name}': " + value)
|
||||||
ret = f'Calculation(func.{function}, Params((' + ', '.join(args) + ')'
|
if function == 'valid_network_netmask':
|
||||||
|
new_args.extend(args)
|
||||||
|
else:
|
||||||
|
args.extend(new_args)
|
||||||
|
new_args = args
|
||||||
|
ret = f'Calculation(func.{function}, Params((' + ', '.join(new_args) + ')'
|
||||||
if kwargs:
|
if kwargs:
|
||||||
ret += ', kwargs={' + ', '.join(kwargs) + '}'
|
ret += ', kwargs={' + ', '.join(kwargs) + '}'
|
||||||
ret += ')'
|
ret += ')'
|
||||||
if hasattr(child, 'warnings_only'):
|
if hasattr(child, 'warnings_only'):
|
||||||
ret += f', warnings_only={child.warnings_only}'
|
ret += f', warnings_only={child.warnings_only}'
|
||||||
return ret + ')'
|
ret = ret + ')'
|
||||||
|
if calc_multi:
|
||||||
|
ret = '[' + ret + ']'
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class Family(Common):
|
class Family(Common):
|
||||||
@ -372,5 +387,5 @@ class Family(Common):
|
|||||||
) -> None:
|
) -> None:
|
||||||
if hasattr(self.elt, 'suffixes'):
|
if hasattr(self.elt, 'suffixes'):
|
||||||
dyn = self.elt.suffixes.reflector_object.get()
|
dyn = self.elt.suffixes.reflector_object.get()
|
||||||
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}))))"
|
keys['suffixes'] = f"Calculation(func.calc_value, Params((ParamOption({dyn}, notraisepropertyerror=True))))"
|
||||||
keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']'
|
keys['children'] = '[' + ', '.join([child.get() for child in self.children]) + ']'
|
||||||
|
573
src/rougail/update.py
Normal file
573
src/rougail/update.py
Normal file
@ -0,0 +1,573 @@
|
|||||||
|
"""Update Rougail XML file to new version
|
||||||
|
|
||||||
|
Cadoles (http://www.cadoles.com)
|
||||||
|
Copyright (C) 2021
|
||||||
|
|
||||||
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
This program is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program; if not, write to the Free Software
|
||||||
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
|
"""
|
||||||
|
|
||||||
|
from typing import List
|
||||||
|
from os.path import join, isfile, basename
|
||||||
|
from os import listdir
|
||||||
|
from lxml.etree import DTD, parse, XMLParser, XMLSyntaxError # pylint: disable=E0611
|
||||||
|
from lxml.etree import Element, SubElement, tostring
|
||||||
|
from ast import parse as ast_parse
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
|
from .error import UpgradeError
|
||||||
|
|
||||||
|
from .utils import normalize_family
|
||||||
|
|
||||||
|
|
||||||
|
VERSIONS = {'creole': ['1'],
|
||||||
|
'rougail': ['0.9'],
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_function_name(root, version):
|
||||||
|
version = version.replace('.', '_')
|
||||||
|
return f'update_{root}_{version}'
|
||||||
|
|
||||||
|
|
||||||
|
FUNCTION_VERSIONS = [(root, version, get_function_name(root, version)) for root, versions in VERSIONS.items() for version in versions]
|
||||||
|
|
||||||
|
|
||||||
|
class RougailUpgrade:
|
||||||
|
def __init__(self, test=False, upgrade_help=None):
|
||||||
|
self.test = test
|
||||||
|
if upgrade_help is None:
|
||||||
|
upgrade_help = {}
|
||||||
|
self.upgrade_help = upgrade_help
|
||||||
|
|
||||||
|
def load_xml_from_folders(self,
|
||||||
|
srcfolder: str,
|
||||||
|
dstfolder: str,
|
||||||
|
namespace: str,
|
||||||
|
):
|
||||||
|
"""Loads all the XML files located in the xmlfolders' list
|
||||||
|
|
||||||
|
:param xmlfolders: list of full folder's name
|
||||||
|
"""
|
||||||
|
filenames = [filename for filename in listdir(srcfolder) if filename.endswith('.xml')]
|
||||||
|
filenames.sort()
|
||||||
|
for filename in filenames:
|
||||||
|
xmlsrc = join(srcfolder, filename)
|
||||||
|
xmldst = join(dstfolder, filename)
|
||||||
|
try:
|
||||||
|
parser = XMLParser(remove_blank_text=True)
|
||||||
|
document = parse(xmlsrc, parser)
|
||||||
|
except XMLSyntaxError as err:
|
||||||
|
raise Exception(_(f'not a XML file: {err}')) from err
|
||||||
|
root = document.getroot()
|
||||||
|
search_function_name = get_function_name(root.tag, root.attrib.get('version', '1'))
|
||||||
|
function_found = False
|
||||||
|
for root_name, version, function_version in FUNCTION_VERSIONS:
|
||||||
|
if function_found and hasattr(self, function_version):
|
||||||
|
print(f' - convert {filename} to version {version}')
|
||||||
|
upgrade_help = self.upgrade_help.get(function_version, {}).get(filename, {})
|
||||||
|
if upgrade_help.get('remove') is True:
|
||||||
|
continue
|
||||||
|
root = getattr(self, function_version)(root, upgrade_help, namespace)
|
||||||
|
if function_version == search_function_name:
|
||||||
|
function_found = True
|
||||||
|
with open(xmldst, 'wb') as xmlfh:
|
||||||
|
xmlfh.write(tostring(root, pretty_print=True, encoding="UTF-8", xml_declaration=True))
|
||||||
|
# if
|
||||||
|
# if not self.dtd.validate(document):
|
||||||
|
# dtd_error = self.dtd.error_log.filter_from_errors()[0]
|
||||||
|
# msg = _(f'not a valid XML file: {dtd_error}')
|
||||||
|
# raise DictConsistencyError(msg, 43, [xmlfile])
|
||||||
|
# yield xmlfile, document.getroot()
|
||||||
|
|
||||||
|
|
||||||
|
def update_rougail_0_9(self,
|
||||||
|
root: 'Element',
|
||||||
|
upgrade_help: dict,
|
||||||
|
namespace: str,
|
||||||
|
) -> 'Element':
|
||||||
|
# rename root
|
||||||
|
root.tag = 'rougail'
|
||||||
|
root.attrib['version'] = '0.9'
|
||||||
|
variables_auto_valid_enum = {}
|
||||||
|
variables_help = {}
|
||||||
|
families_help = {}
|
||||||
|
variables = {}
|
||||||
|
families = {}
|
||||||
|
valid_enums = {}
|
||||||
|
current_service = upgrade_help.get('services', {}).get('default', 'unknown')
|
||||||
|
files = {current_service: {}}
|
||||||
|
ips = {current_service: []}
|
||||||
|
servicelists = {}
|
||||||
|
test_unknowns_variables = set()
|
||||||
|
autos = []
|
||||||
|
constraints_obj = None
|
||||||
|
for subelement in root:
|
||||||
|
if not isinstance(subelement.tag, str):
|
||||||
|
# XML comment
|
||||||
|
continue
|
||||||
|
if subelement.tag == 'family_action':
|
||||||
|
root.remove(subelement)
|
||||||
|
continue
|
||||||
|
for subsubelement in subelement:
|
||||||
|
if not isinstance(subsubelement.tag, str):
|
||||||
|
# XML comment
|
||||||
|
continue
|
||||||
|
for subsubsubelement in subsubelement:
|
||||||
|
if not isinstance(subsubsubelement.tag, str):
|
||||||
|
# XML comment
|
||||||
|
continue
|
||||||
|
if subsubsubelement.tag == 'variable':
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
continue
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}):
|
||||||
|
subsubsubelement.attrib['type'] = upgrade_help['variables']['type'][subsubsubelement.attrib['name']]
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('add', []):
|
||||||
|
subsubsubelement.attrib['hidden'] = 'True'
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('hidden', {}).get('remove', []):
|
||||||
|
self.remove(subsubsubelement, 'hidden', optional=True)
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('remove', []):
|
||||||
|
self.remove(subsubsubelement, 'mandatory')
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mandatory', {}).get('add', []):
|
||||||
|
subsubsubelement.attrib['mandatory'] = 'True'
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}):
|
||||||
|
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {})[subsubsubelement.attrib['name']]
|
||||||
|
if namespace == 'configuration':
|
||||||
|
path = subsubsubelement.attrib['name']
|
||||||
|
npath = normalize_family(subsubsubelement.attrib['name'])
|
||||||
|
else:
|
||||||
|
path = namespace + '.' + subsubelement.attrib['name'] + '.' + subsubsubelement.attrib['name']
|
||||||
|
npath = normalize_family(namespace) + '.' + normalize_family(subsubelement.attrib['name']) + '.' + normalize_family(subsubsubelement.attrib['name'])
|
||||||
|
variables[path] = subsubsubelement
|
||||||
|
variables[npath] = subsubsubelement
|
||||||
|
type = subsubsubelement.attrib.get('type')
|
||||||
|
if type in ['oui/non', 'yes/no', 'on/off']:
|
||||||
|
variables_auto_valid_enum.setdefault(subsubsubelement.attrib['type'], []).append(path)
|
||||||
|
del subsubsubelement.attrib['type']
|
||||||
|
elif type == 'hostname_strict':
|
||||||
|
subsubsubelement.attrib['type'] = 'hostname'
|
||||||
|
elif type in ['domain', 'domain_strict']:
|
||||||
|
subsubsubelement.attrib['type'] = 'domainname'
|
||||||
|
elif type == 'string':
|
||||||
|
del subsubsubelement.attrib['type']
|
||||||
|
if self.test and subsubsubelement.attrib.get('auto_freeze') == 'True':
|
||||||
|
del subsubsubelement.attrib['auto_freeze']
|
||||||
|
#if self.test and subsubsubelement.attrib.get('redefine') == 'True':
|
||||||
|
# subsubsubelement.attrib['exists'] = 'False'
|
||||||
|
# del subsubsubelement.attrib['redefine']
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('redefine', {}).get('remove', {}):
|
||||||
|
del subsubsubelement.attrib['redefine']
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_check', []):
|
||||||
|
subsubsubelement.attrib['remove_check'] = 'True'
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('mode', {}).get('modify', {}):
|
||||||
|
subsubsubelement.attrib['mode'] = upgrade_help.get('variables', {}).get('mode', {}).get('modify', {})[subsubsubelement.attrib['name']]
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('type', {}).get('modify', {}):
|
||||||
|
subsubsubelement.attrib['type'] = upgrade_help.get('variables', {}).get('type', {}).get('modify', {})[subsubsubelement.attrib['name']]
|
||||||
|
type = subsubsubelement.attrib['type']
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('test', {}):
|
||||||
|
subsubsubelement.attrib['test'] = upgrade_help.get('variables', {}).get('test', {})[subsubsubelement.attrib['name']]
|
||||||
|
if subsubsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove_value', []):
|
||||||
|
for value in subsubsubelement:
|
||||||
|
subsubsubelement.remove(value)
|
||||||
|
if subsubsubelement.attrib['name'] != normalize_family(subsubsubelement.attrib['name']):
|
||||||
|
if "description" not in subsubsubelement.attrib:
|
||||||
|
subsubsubelement.attrib['description'] = subsubsubelement.attrib['name']
|
||||||
|
subsubsubelement.attrib['name'] = normalize_family(subsubsubelement.attrib['name'])
|
||||||
|
elif subsubsubelement.tag == 'param':
|
||||||
|
if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []):
|
||||||
|
continue
|
||||||
|
type = subsubsubelement.attrib.get('type')
|
||||||
|
if type == 'eole':
|
||||||
|
subsubsubelement.attrib['type'] = 'variable'
|
||||||
|
type = 'variable'
|
||||||
|
if type == 'python':
|
||||||
|
subsubsubelement.attrib['type'] = 'function'
|
||||||
|
if subsubsubelement.text.startswith('range('):
|
||||||
|
func_ast = ast_parse(subsubsubelement.text)
|
||||||
|
subsubsubelement.text = 'range'
|
||||||
|
for arg in func_ast.body[0].value.args:
|
||||||
|
SubElement(subsubelement, 'param', type='number').text = str(arg.value)
|
||||||
|
else:
|
||||||
|
raise Exception(f'{subsubsubelement.text} is not a supported function')
|
||||||
|
type = 'function'
|
||||||
|
elif type in ('container', 'context'):
|
||||||
|
raise UpgradeError(_(f'cannot convert param with type "{type}"'))
|
||||||
|
if subsubelement.attrib['name'] == 'valid_entier' and not 'type' in subsubsubelement.attrib:
|
||||||
|
subsubsubelement.attrib['type'] = 'number'
|
||||||
|
if (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.attrib['name'] == 'valid_enum' and not type:
|
||||||
|
if subsubsubelement.attrib.get('name') == 'checkval':
|
||||||
|
if subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('valid_enums', {}).get('checkval', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
continue
|
||||||
|
raise UpgradeError(_('checkval in valid_enum is no more supported'))
|
||||||
|
if subsubsubelement.text.startswith('['):
|
||||||
|
for val in eval(subsubsubelement.text):
|
||||||
|
SubElement(subsubelement, 'param').text = str(val)
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
self.move(subsubsubelement, 'hidden', 'propertyerror', optional=True)
|
||||||
|
if type == 'variable' and subsubsubelement.text in upgrade_help.get('variables', {}).get('rename', []):
|
||||||
|
subsubsubelement.text = upgrade_help.get('variables', {}).get('rename', [])[subsubsubelement.text]
|
||||||
|
up = upgrade_help.get('params', {}).get(subsubsubelement.text)
|
||||||
|
if up:
|
||||||
|
if 'text' in up:
|
||||||
|
subsubsubelement.text = up['text']
|
||||||
|
if 'type' in up:
|
||||||
|
subsubsubelement.attrib['type'] = up['type']
|
||||||
|
elif subsubsubelement.tag == 'target':
|
||||||
|
type = subsubsubelement.attrib.get('type')
|
||||||
|
if type in ['service_accesslist', 'service_restrictionlist', 'interfacelist', 'hostlist']:
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
elif (not type or type == 'variable') and subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
elif type == 'family' and subsubsubelement.text in upgrade_help.get('families', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
elif type == 'actionlist':
|
||||||
|
# for family in root.find('variables'):
|
||||||
|
# family_list = SubElement(subsubelement, 'target')
|
||||||
|
# family_list.attrib['type'] = 'family'
|
||||||
|
# family_list.text = namespace + '.' + family.attrib['name']
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
if upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional'):
|
||||||
|
subsubsubelement.attrib['optional'] = upgrade_help.get('targets', {}).get(subsubsubelement.text, {}).get('optional')
|
||||||
|
has_target = False
|
||||||
|
for target in subsubelement:
|
||||||
|
if target.tag == 'target':
|
||||||
|
has_target = True
|
||||||
|
break
|
||||||
|
if not has_target:
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
elif subsubsubelement.tag == 'slave':
|
||||||
|
if subsubsubelement.text in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
continue
|
||||||
|
subsubsubelement.tag = 'follower'
|
||||||
|
subsubsubelement.text = normalize_family(subsubsubelement.text)
|
||||||
|
if subelement.tag == 'containers':
|
||||||
|
current_service = self.upgrade_container(subsubsubelement, current_service, files, ips, servicelists, upgrade_help)
|
||||||
|
subsubelement.remove(subsubsubelement)
|
||||||
|
if subelement.tag == 'help':
|
||||||
|
if subsubelement.tag == 'variable':
|
||||||
|
if not subsubelement.attrib['name'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
variables_help[subsubelement.attrib['name']] = subsubelement.text
|
||||||
|
elif subsubelement.tag == 'family':
|
||||||
|
if subsubelement.attrib['name'] not in upgrade_help.get('families', {}).get('remove', []):
|
||||||
|
families_help[subsubelement.attrib['name']] = subsubelement.text
|
||||||
|
else:
|
||||||
|
raise Exception(f'unknown help tag {subsubelement.tag}')
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.tag == 'auto':
|
||||||
|
if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
autos.append(subsubelement.attrib['target'])
|
||||||
|
subsubelement.tag = 'fill'
|
||||||
|
if subsubelement.tag in ['fill', 'check']:
|
||||||
|
if subsubelement.tag == 'check' and subsubelement.attrib['name'] == 'valid_enum':
|
||||||
|
if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
params = []
|
||||||
|
for param in subsubelement:
|
||||||
|
if param.tag == 'param':
|
||||||
|
params.append(param.text)
|
||||||
|
key = '~'.join(params)
|
||||||
|
if key in valid_enums:
|
||||||
|
SubElement(valid_enums[key], 'target').text = subsubelement.attrib['target']
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
valid_enums['~'.join(params)] = subsubelement
|
||||||
|
if subsubelement.tag == 'fill' and subsubelement.attrib['target'] in upgrade_help.get('fills', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.tag == 'check' and subsubelement.attrib['target'] in upgrade_help.get('check', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.attrib['target'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.attrib['name'] == 'valid_networknetmask':
|
||||||
|
subsubelement.attrib['name'] = 'valid_network_netmask'
|
||||||
|
target = SubElement(subsubelement, 'target')
|
||||||
|
target.text = subsubelement.attrib['target']
|
||||||
|
if self.test:
|
||||||
|
target.attrib['optional'] = 'True'
|
||||||
|
del subsubelement.attrib['target']
|
||||||
|
elif subsubelement.tag == 'separators':
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
elif subsubelement.tag == 'condition':
|
||||||
|
if subsubelement.attrib['source'] in upgrade_help.get('variables', {}).get('remove', []):
|
||||||
|
try:
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
if subsubelement.attrib['name'] == 'hidden_if_not_in':
|
||||||
|
subsubelement.attrib['name'] = 'disabled_if_not_in'
|
||||||
|
if subsubelement.attrib['name'] == 'hidden_if_in':
|
||||||
|
subsubelement.attrib['name'] = 'disabled_if_in'
|
||||||
|
if subsubelement.attrib['name'] == 'frozen_if_in':
|
||||||
|
subsubelement.attrib['name'] = 'hidden_if_in'
|
||||||
|
self.move(subsubelement, 'fallback', 'optional', optional='True')
|
||||||
|
if subsubelement.attrib['source'] in upgrade_help.get('variables', {}).get('rename', []):
|
||||||
|
subsubelement.attrib['source'] = upgrade_help.get('variables', {}).get('rename', [])[subsubelement.attrib['source']]
|
||||||
|
elif subsubelement.tag == 'group':
|
||||||
|
if subsubelement.attrib['master'] in upgrade_help.get('groups', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
else:
|
||||||
|
self.move(subsubelement, 'master', 'leader')
|
||||||
|
for follower in subsubelement:
|
||||||
|
if '.' in subsubelement.attrib['leader']:
|
||||||
|
path = subsubelement.attrib['leader'].rsplit('.', 1)[0] + '.' + follower.text
|
||||||
|
else:
|
||||||
|
path = follower.text
|
||||||
|
self.remove(variables[path], 'multi', optional=True)
|
||||||
|
if subsubelement.attrib['leader'] in upgrade_help.get('groups', {}).get('reorder', {}):
|
||||||
|
for follower in subsubelement:
|
||||||
|
subsubelement.remove(follower)
|
||||||
|
for follower in upgrade_help.get('groups', {}).get('reorder', {})[subsubelement.attrib['leader']]:
|
||||||
|
SubElement(subsubelement, 'follower').text = follower
|
||||||
|
if subelement.tag == 'files':
|
||||||
|
current_service = self.upgrade_container(subsubelement, current_service, files, ips, servicelists, upgrade_help)
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
if subsubelement.tag == 'family':
|
||||||
|
self.remove(subsubelement, 'icon', optional=True)
|
||||||
|
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('mode', {}).get('remove', []) and 'mode' in subsubelement.attrib:
|
||||||
|
del subsubelement.attrib['mode']
|
||||||
|
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('rename', {}):
|
||||||
|
subsubelement.attrib['name'] = upgrade_help.get('families', {}).get('rename', {})[subsubelement.attrib['name']]
|
||||||
|
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('remove', []):
|
||||||
|
subelement.remove(subsubelement)
|
||||||
|
continue
|
||||||
|
if subsubelement.attrib['name'] in upgrade_help.get('families', {}).get('hidden', {}).get('add', []):
|
||||||
|
subsubelement.attrib['hidden'] = 'True'
|
||||||
|
if subsubelement.attrib['name'] != normalize_family(subsubelement.attrib['name']):
|
||||||
|
if "description" not in subsubelement.attrib:
|
||||||
|
subsubelement.attrib['description'] = subsubelement.attrib['name']
|
||||||
|
subsubelement.attrib['name'] = normalize_family(subsubelement.attrib['name'])
|
||||||
|
families[subsubelement.attrib['name']] = subsubelement
|
||||||
|
# if empty, remove
|
||||||
|
if is_empty(subelement) or subelement.tag in ['containers', 'files', 'help']:
|
||||||
|
root.remove(subelement)
|
||||||
|
continue
|
||||||
|
# copy subelement
|
||||||
|
if subelement.tag == 'constraints':
|
||||||
|
constraints_obj = subelement
|
||||||
|
services = None
|
||||||
|
service_elt = {}
|
||||||
|
for variable, obj in upgrade_help.get('variables', {}).get('add', {}).items():
|
||||||
|
family = next(iter(families.values()))
|
||||||
|
variables[variable] = SubElement(family, 'variable', name=variable)
|
||||||
|
if 'value' in obj:
|
||||||
|
SubElement(variables[variable], 'value').text = obj['value']
|
||||||
|
for name in ['hidden', 'exists']:
|
||||||
|
if name in obj:
|
||||||
|
variables[variable].attrib[name] = obj[name]
|
||||||
|
files_is_empty = True
|
||||||
|
for lst in files.values():
|
||||||
|
if len(lst):
|
||||||
|
files_is_empty = False
|
||||||
|
break
|
||||||
|
if not files_is_empty:
|
||||||
|
services = Element('services')
|
||||||
|
root.insert(0, services)
|
||||||
|
for service_name, lst in files.items():
|
||||||
|
service = self.create_service(services, service_name, service_elt, servicelists, upgrade_help)
|
||||||
|
for file_ in lst.values():
|
||||||
|
self.move(file_, 'name_type', 'file_type', optional=True)
|
||||||
|
if 'file_type' in file_.attrib and file_.attrib['file_type'] == 'SymLinkOption':
|
||||||
|
file_.attrib['file_type'] = 'variable'
|
||||||
|
if variables[file_.text].attrib['type'] == 'string':
|
||||||
|
variables[file_.text].attrib['type'] = 'filename'
|
||||||
|
self.remove(file_, 'rm', optional=True)
|
||||||
|
self.remove(file_, 'mkdir', optional=True)
|
||||||
|
service.append(file_)
|
||||||
|
ips_is_empty = True
|
||||||
|
for lst in ips.values():
|
||||||
|
if len(lst):
|
||||||
|
ips_is_empty = False
|
||||||
|
break
|
||||||
|
if not ips_is_empty:
|
||||||
|
if services is None:
|
||||||
|
services = Element('services')
|
||||||
|
root.insert(0, services)
|
||||||
|
for service_name, lst in ips.items():
|
||||||
|
service = self.create_service(services, service_name, service_elt, servicelists, upgrade_help)
|
||||||
|
for ip in lst:
|
||||||
|
if ip.text in upgrade_help.get('ips', {}).get('remove', []):
|
||||||
|
continue
|
||||||
|
for type in ['ip_type', 'netmask_type']:
|
||||||
|
if type in ip.attrib and ip.attrib[type] == 'SymLinkOption':
|
||||||
|
ip.attrib[type] = 'variable'
|
||||||
|
if 'netmask' in ip.attrib:
|
||||||
|
if ip.attrib['netmask'] == '255.255.255.255':
|
||||||
|
del ip.attrib['netmask']
|
||||||
|
if ip.text in variables and 'type' not in variables[ip.text].attrib:
|
||||||
|
variables[ip.text].attrib['type'] = 'ip'
|
||||||
|
else:
|
||||||
|
if ip.text in variables and 'type' not in variables[ip.text].attrib:
|
||||||
|
variables[ip.text].attrib['type'] = 'network'
|
||||||
|
if ip.attrib['netmask'] in variables and 'type' not in variables[ip.attrib['netmask']].attrib:
|
||||||
|
variables[ip.attrib['netmask']].attrib['type'] = 'netmask'
|
||||||
|
elif ip.text in variables and 'type' not in variables[ip.text].attrib:
|
||||||
|
variables[ip.text].attrib['type'] = 'ip'
|
||||||
|
self.remove(ip, 'interface')
|
||||||
|
self.remove(ip, 'interface_type', optional=True)
|
||||||
|
self.remove(ip, 'service_restrictionlist', optional=True)
|
||||||
|
service.append(ip)
|
||||||
|
if ips_is_empty and files_is_empty:
|
||||||
|
for service_name in files:
|
||||||
|
if services is None:
|
||||||
|
services = Element('services')
|
||||||
|
root.insert(0, services)
|
||||||
|
if service_name != 'unknown':
|
||||||
|
self.create_service(services, service_name, service_elt, servicelists, upgrade_help)
|
||||||
|
if constraints_obj is None:
|
||||||
|
constraints_obj = SubElement(root, 'constraints')
|
||||||
|
if variables_auto_valid_enum:
|
||||||
|
for type, variables_valid_enum in variables_auto_valid_enum.items():
|
||||||
|
valid_enum = SubElement(constraints_obj, 'check')
|
||||||
|
valid_enum.attrib['name'] = 'valid_enum'
|
||||||
|
for val in type.split('/'):
|
||||||
|
param = SubElement(valid_enum, 'param')
|
||||||
|
param.text = val
|
||||||
|
for variable in variables_valid_enum:
|
||||||
|
target = SubElement(valid_enum, 'target')
|
||||||
|
target.text = variable
|
||||||
|
for name, text in variables_help.items():
|
||||||
|
variables[name].attrib['help'] = text
|
||||||
|
for name, text in families_help.items():
|
||||||
|
if name in upgrade_help.get('families', {}).get('rename', {}):
|
||||||
|
name = upgrade_help.get('families', {}).get('rename', {})[name]
|
||||||
|
families[normalize_family(name)].attrib['help'] = text
|
||||||
|
for auto in autos:
|
||||||
|
if auto in variables:
|
||||||
|
variables[auto].attrib['hidden'] = 'True'
|
||||||
|
else:
|
||||||
|
# redefine value in first family
|
||||||
|
family = next(iter(families.values()))
|
||||||
|
variable = SubElement(family, 'variable', name=auto, redefine="True", hidden="True")
|
||||||
|
if self.test:
|
||||||
|
del variable.attrib['redefine']
|
||||||
|
return root
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def move(elt, src, dst, optional=False):
|
||||||
|
if src == 'text':
|
||||||
|
value = elt.text
|
||||||
|
elt.text = None
|
||||||
|
else:
|
||||||
|
if optional and src not in elt.attrib:
|
||||||
|
return
|
||||||
|
value = elt.attrib[src]
|
||||||
|
del elt.attrib[src]
|
||||||
|
#
|
||||||
|
if dst == 'text':
|
||||||
|
elt.text = value
|
||||||
|
else:
|
||||||
|
elt.attrib[dst] = value
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def remove(elt, src, optional=False):
|
||||||
|
if optional and src not in elt.attrib:
|
||||||
|
return
|
||||||
|
del elt.attrib[src]
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def create_service(services, service_name, service_elt, servicelists, upgrade_help):
|
||||||
|
if service_name in service_elt:
|
||||||
|
return service_elt[service_name]
|
||||||
|
service = SubElement(services, 'service')
|
||||||
|
service.attrib['name'] = service_name
|
||||||
|
if service_name == 'unknown':
|
||||||
|
service.attrib['manage'] = 'False'
|
||||||
|
if service_name in upgrade_help.get('services', {}).get('unmanage', []):
|
||||||
|
service.attrib['manage'] = 'False'
|
||||||
|
service_elt[service_name] = service
|
||||||
|
if upgrade_help.get('servicelists', {}).get(service_name):
|
||||||
|
service.attrib['servicelist'] = upgrade_help.get('servicelists', {}).get(service_name)
|
||||||
|
elif service_name in servicelists:
|
||||||
|
service.attrib['servicelist'] = servicelists[service_name]
|
||||||
|
return service
|
||||||
|
|
||||||
|
def upgrade_container(self, elt, current_service, files, ips, servicelists, upgrade_help):
|
||||||
|
if elt.tag == 'file':
|
||||||
|
self.move(elt, 'name', 'text')
|
||||||
|
self.remove(elt, 'del_comment', optional=True)
|
||||||
|
elt.attrib['engine'] = 'creole_legacy'
|
||||||
|
if (not 'instance_mode' in elt.attrib or elt.attrib['instance_mode'] != 'when_container') and \
|
||||||
|
elt.text not in upgrade_help.get('files', {}).get('remove', {}):
|
||||||
|
if elt.attrib.get('filelist') in upgrade_help.get('services', {}).get('filelist_service', {}):
|
||||||
|
elt_service = upgrade_help.get('services', {}).get('filelist_service', {})[elt.attrib['filelist']]
|
||||||
|
if elt_service in files:
|
||||||
|
service = elt_service
|
||||||
|
else:
|
||||||
|
service = current_service
|
||||||
|
else:
|
||||||
|
service = current_service
|
||||||
|
files[service][elt.text] = elt
|
||||||
|
elif elt.tag in ['host', 'disknod', 'fstab', 'interface', 'package', 'service_access']:
|
||||||
|
pass
|
||||||
|
elif elt.tag == 'service_restriction':
|
||||||
|
for restriction in elt:
|
||||||
|
if restriction.tag == 'ip' and restriction.text != '0.0.0.0':
|
||||||
|
self.remove(restriction, 'ip_type', optional=True)
|
||||||
|
self.remove(restriction, 'netmask_type', optional=True)
|
||||||
|
if elt.attrib['service'] in upgrade_help.get('services', {}).get('rename', {}):
|
||||||
|
elt_service = upgrade_help.get('services', {}).get('rename', {})[elt.attrib['service']]
|
||||||
|
else:
|
||||||
|
elt_service = elt.attrib['service']
|
||||||
|
if elt_service in ips:
|
||||||
|
service = elt_service
|
||||||
|
else:
|
||||||
|
service = current_service
|
||||||
|
ips[service].append(restriction)
|
||||||
|
elif elt.tag == 'service':
|
||||||
|
new_name = elt.text
|
||||||
|
if current_service == 'unknown':
|
||||||
|
if new_name in files:
|
||||||
|
raise Exception('hu?')
|
||||||
|
files[new_name] = files[current_service]
|
||||||
|
del files[current_service]
|
||||||
|
ips[new_name] = ips[current_service]
|
||||||
|
del ips[current_service]
|
||||||
|
elif new_name not in files:
|
||||||
|
files[new_name] = {}
|
||||||
|
ips[new_name] = []
|
||||||
|
current_service = new_name
|
||||||
|
if 'servicelist' in elt.attrib:
|
||||||
|
servicelists[current_service] = elt.attrib['servicelist']
|
||||||
|
else:
|
||||||
|
raise Exception(f'unknown containers tag {elt.tag}')
|
||||||
|
return current_service
|
||||||
|
|
||||||
|
|
||||||
|
def is_empty(elt, not_check_attrib=False):
|
||||||
|
if not not_check_attrib and elt.attrib:
|
||||||
|
return False
|
||||||
|
empty = True
|
||||||
|
for file_ in elt:
|
||||||
|
empty = False
|
||||||
|
return empty
|
||||||
|
|
||||||
|
|
||||||
|
def update_creole_1():
|
||||||
|
print('pfff')
|
@ -26,10 +26,26 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
from typing import List
|
from typing import List
|
||||||
from unicodedata import normalize, combining
|
from unicodedata import normalize, combining
|
||||||
|
import re
|
||||||
|
|
||||||
from importlib.machinery import SourceFileLoader
|
from importlib.machinery import SourceFileLoader
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
|
from .error import DictConsistencyError
|
||||||
|
|
||||||
|
NAME_REGEXP = re.compile(r"^[a-z0-9_]*$")
|
||||||
|
|
||||||
|
|
||||||
|
def valid_variable_family_name(name: str,
|
||||||
|
xmlfiles: List[str],
|
||||||
|
) -> None:
|
||||||
|
match = NAME_REGEXP.search(name)
|
||||||
|
if not match:
|
||||||
|
msg = _(f'invalid variable or family name "{name}" must only contains '
|
||||||
|
'lowercase ascii character, number or _')
|
||||||
|
raise DictConsistencyError(msg, 76, xmlfiles)
|
||||||
|
|
||||||
|
|
||||||
def normalize_family(family_name: str) -> str:
|
def normalize_family(family_name: str) -> str:
|
||||||
"""replace space, accent, uppercase, ... by valid character
|
"""replace space, accent, uppercase, ... by valid character
|
||||||
|
@ -12,6 +12,6 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))}))
|
option_2 = StrOption(name="myvar", doc="myvar", default="no", properties=frozenset({"basic", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -12,6 +12,6 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
option_3 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))}))
|
option_2 = StrOption(name="my_var", doc="my_var", default="no", properties=frozenset({"expert", "force_store_value", "mandatory", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<variable name="server_deployed" type="boolean"/>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<variable name="server_deployed" type="boolean"/>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True" mode="expert">
|
<variable name="mode_conteneur_actif" type="string" description="No change" auto_save="True" mode="expert">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<!-- this is a comment -->
|
<!-- this is a comment -->
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name='général'>
|
<family name="general" description="général">
|
||||||
<variable name='mode_conteneur_actif1' type='string' description="No change" hidden="True">
|
<variable name='mode_conteneur_actif1' type='string' description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -12,6 +12,6 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))}))
|
option_3 = StrOption(name="my_variable", doc="my_variable", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", "hidden", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="general">
|
<family name="general">
|
||||||
<variable name="domain" type="domain" description="Description">
|
<variable name="domain" type="domainname" description="Description">
|
||||||
<value>my.domain.name</value>
|
<value>my.domain.name</value>
|
||||||
</variable>
|
</variable>
|
||||||
</family>
|
</family>
|
||||||
|
@ -13,6 +13,6 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
option_4 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))}))
|
option_2 = StrOption(name="my_var1", doc="my_var1", default=Calculation(func.calc_val, Params((ParamOption(option_3)))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general.mode_conteneur_actif1": "non"
|
|
||||||
}
|
|
@ -12,6 +12,6 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=False, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True), 'expected': ParamValue(True), 'reverse_condition': ParamValue(True)}))}))
|
option_3 = StrOption(name="my_var", doc="my_var", default=Calculation(func.calc_val, Params((ParamValue("yes")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue(True)}))}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<variable name="server_deployed" type="boolean"/>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
option_2 = BoolOption(name="server_deployed", doc="server_deployed", default=True, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("oui")}))}))
|
option_5 = StrOption(name="autosavevar", doc="autosave variable", default=Calculation(func.calc_val, Params((ParamValue("oui")))), properties=frozenset({"basic", "force_store_value", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
|
||||||
option_3 = OptionDescription(name="general", doc="général", children=[option_4, option_5], properties=frozenset({"basic"}))
|
option_3 = OptionDescription(name="general", doc="général", children=[option_4, option_5], properties=frozenset({"basic"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
19
tests/dictionaries/02fill_multi_calc_val/00-base.xml
Normal file
19
tests/dictionaries/02fill_multi_calc_val/00-base.xml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.9">
|
||||||
|
<variables>
|
||||||
|
<variable name="var1">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="var2" multi='True'/>
|
||||||
|
</variables>
|
||||||
|
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_value">
|
||||||
|
<param type="variable">var1</param>
|
||||||
|
<param type="boolean" name="multi">True</param>
|
||||||
|
<target>var2</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
12
tests/dictionaries/02fill_multi_calc_val/makedict/after.json
Normal file
12
tests/dictionaries/02fill_multi_calc_val/makedict/after.json
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": "no",
|
||||||
|
"rougail.var2": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
17
tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py
Normal file
17
tests/dictionaries/02fill_multi_calc_val/tiramisu/base.py
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
spec = spec_from_loader(loader.name, loader)
|
||||||
|
func = module_from_spec(spec)
|
||||||
|
loader.exec_module(func)
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_2 = StrOption(name="var1", doc="var1", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
|
option_3 = StrOption(name="var2", doc="var2", multi=True, default=Calculation(func.calc_value, Params((ParamOption(option_2)), kwargs={'multi': ParamValue(True)})), properties=frozenset({"normal"}))
|
||||||
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
20
tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml
Normal file
20
tests/dictionaries/02fill_multi_calc_val_multi/00-base.xml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.9">
|
||||||
|
<variables>
|
||||||
|
<variable name="var1" multi='True'>
|
||||||
|
<value>no</value>
|
||||||
|
<value>yes</value>
|
||||||
|
<value>maybe</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="var2" multi='True'/>
|
||||||
|
</variables>
|
||||||
|
|
||||||
|
<constraints>
|
||||||
|
<fill name="calc_value">
|
||||||
|
<param type="variable">var1</param>
|
||||||
|
<target>var2</target>
|
||||||
|
</fill>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
],
|
||||||
|
"rougail.var2": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"no",
|
||||||
|
"yes",
|
||||||
|
"maybe"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,17 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
spec = spec_from_loader(loader.name, loader)
|
||||||
|
func = module_from_spec(spec)
|
||||||
|
loader.exec_module(func)
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_2 = StrOption(name="var1", doc="var1", multi=True, default=['no', 'yes', 'maybe'], default_multi="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
|
option_3 = StrOption(name="var2", doc="var2", multi=True, default=Calculation(func.calc_value, Params((ParamOption(option_2)))), properties=frozenset({"normal"}))
|
||||||
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3])
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
@ -2,7 +2,7 @@
|
|||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<variable name="server_deployed" type="boolean"/>
|
<variable name="server_deployed" type="boolean"/>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>non</value>
|
<value>non</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -12,7 +12,7 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption())), warnings_only=False)], properties=frozenset({"normal"}))
|
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False))), warnings_only=False)], properties=frozenset({"normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"}))
|
option_4 = IntOption(name="int2", doc="No change", default=100, properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption()), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"}))
|
option_5 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_lower, Params((ParamSelfOption(whole=False)), kwargs={'mini': ParamValue(0), 'maxi': ParamOption(option_4)}), warnings_only=False)], properties=frozenset({"normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="b", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = IntOption(name="int2", doc="No change", properties=frozenset({"normal"}))
|
option_5 = IntOption(name="int2", doc="No change", properties=frozenset({"normal"}))
|
||||||
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"}))
|
option_4 = IntOption(name="int", doc="No change", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -12,7 +12,7 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -14,7 +14,7 @@ except:
|
|||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -14,7 +14,7 @@ except:
|
|||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="mode_conteneur_actif1", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
option_6 = StrOption(name="mode_conteneur_actif3", doc="No change", default="oui", validators=[Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=False), Calculation(func.valid_differ, Params((ParamSelfOption(whole=False), ParamOption(option_5))), warnings_only=False)], properties=frozenset({"mandatory", "normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -14,7 +14,7 @@ except:
|
|||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
||||||
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", properties=frozenset({"basic", "mandatory"}))
|
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", properties=frozenset({"basic", "mandatory"}))
|
||||||
option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
option_6 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4), ParamOption(option_5))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"basic"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5, option_6], properties=frozenset({"basic"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", cidr=True, properties=frozenset({"basic", "mandatory"}))
|
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", cidr=True, properties=frozenset({"basic", "mandatory"}))
|
||||||
option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
option_5 = IPOption(name="adresse_ip", doc="IP", validators=[Calculation(func.valid_in_network, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
option_4 = IPOption(name="adresse_ip_eth0", doc="Adresse IP de la carte", private_only=True, warnings_only=True, properties=frozenset({"basic", "mandatory"}))
|
||||||
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"}))
|
option_5 = NetmaskOption(name="adresse_netmask_eth0", doc="Masque de sous réseau de la carte", validators=[Calculation(func.valid_ipnetmask, Params((ParamSelfOption(whole=False), ParamOption(option_4))), warnings_only=True)], properties=frozenset({"basic", "mandatory"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"basic"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general1.leader.leader": []
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
|
||||||
spec = spec_from_loader(loader.name, loader)
|
|
||||||
func = module_from_spec(spec)
|
|
||||||
loader.exec_module(func)
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
|
||||||
option_6 = StrOption(name="leader", doc="leader", multi=True)
|
|
||||||
option_7 = StrOption(name="follower1", doc="Followér1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
|
|
||||||
option_8 = StrOption(name="follower2", doc="Followér2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"}))
|
|
||||||
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
|
|
||||||
option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"}))
|
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general1.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,22 +0,0 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
|
||||||
spec = spec_from_loader(loader.name, loader)
|
|
||||||
func = module_from_spec(spec)
|
|
||||||
loader.exec_module(func)
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"normal"}))
|
|
||||||
option_6 = StrOption(name="leader", doc="Léader", multi=True)
|
|
||||||
option_7 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
|
|
||||||
option_8 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_7)))), properties=frozenset({"normal"}))
|
|
||||||
option_5 = Leadership(name="leader", doc="Léader", children=[option_6, option_7, option_8], properties=frozenset({"normal"}))
|
|
||||||
option_4 = OptionDescription(name="general1", doc="general1", children=[option_5], properties=frozenset({"normal"}))
|
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": "non",
|
|
||||||
"rougail.general.leader.leader": []
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"rougail.general.mode_conteneur_actif": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": "non"
|
|
||||||
},
|
|
||||||
"rougail.general.leader.leader": {
|
|
||||||
"owner": "default",
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general.leader.follower1": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
},
|
|
||||||
"rougail.general.leader.follower2": {
|
|
||||||
"owner": [],
|
|
||||||
"value": []
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,21 +0,0 @@
|
|||||||
from importlib.machinery import SourceFileLoader
|
|
||||||
from importlib.util import spec_from_loader, module_from_spec
|
|
||||||
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
|
||||||
spec = spec_from_loader(loader.name, loader)
|
|
||||||
func = module_from_spec(spec)
|
|
||||||
loader.exec_module(func)
|
|
||||||
for key, value in dict(locals()).items():
|
|
||||||
if key != ['SourceFileLoader', 'func']:
|
|
||||||
setattr(func, key, value)
|
|
||||||
try:
|
|
||||||
from tiramisu3 import *
|
|
||||||
except:
|
|
||||||
from tiramisu import *
|
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
|
||||||
option_5 = StrOption(name="leader", doc="leader", multi=True)
|
|
||||||
option_6 = StrOption(name="follower1", doc="follower1", multi=True, default=Calculation(func.calc_val, Params((), kwargs={'valeur': ParamValue("valfill")})), properties=frozenset({"normal"}))
|
|
||||||
option_7 = StrOption(name="follower2", doc="follower2", multi=True, default=Calculation(func.calc_val, Params((ParamOption(option_6)))), properties=frozenset({"normal"}))
|
|
||||||
option_4 = Leadership(name="leader", doc="leader", children=[option_5, option_6, option_7], properties=frozenset({"normal"}))
|
|
||||||
option_2 = OptionDescription(name="general", doc="Général", children=[option_3, option_4], properties=frozenset({"normal"}))
|
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -13,10 +13,10 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
|
||||||
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_5 = Leadership(name="leader", doc="leader", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
|
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -13,10 +13,10 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
|
option_3 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"expert", "mandatory"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3], properties=frozenset({"expert"}))
|
||||||
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_6 = StrOption(name="leader", doc="leader", multi=True, properties=frozenset({Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_7 = StrOption(name="follower1", doc="follower1", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_8 = StrOption(name="follower2", doc="follower2", multi=True, properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('frozen'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")})), Calculation(func.calc_value, Params(ParamValue('force_default_on_freeze'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_5 = Leadership(name="other", doc="other", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("non")}))}))
|
option_5 = Leadership(name="other", doc="other", children=[option_6, option_7, option_8], properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('hidden'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("non")}))}))
|
||||||
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
|
option_4 = OptionDescription(name="leadermode", doc="leadermode", children=[option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_4])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<rougail version="0.9">
|
<rougail version="0.9">
|
||||||
<variables>
|
<variables>
|
||||||
<family name="général">
|
<family name="general" description="général">
|
||||||
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
<variable name="mode_conteneur_actif" type="string" description="No change" hidden="True">
|
||||||
<value>oui</value>
|
<value>oui</value>
|
||||||
</variable>
|
</variable>
|
||||||
|
@ -12,8 +12,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")}))}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
@ -12,7 +12,7 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="condition", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("no")}))}))
|
option_4 = StrOption(name="variable1", doc="variable1", properties=frozenset({"normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))}))
|
||||||
option_5 = StrOption(name="variable2", doc="variable2", default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=True)))), properties=frozenset({"normal"}))
|
option_5 = StrOption(name="variable2", doc="variable2", default=Calculation(func.calc_val, Params((ParamOption(option_4, notraisepropertyerror=True)))), properties=frozenset({"normal"}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
|
@ -12,8 +12,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="condition2", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -13,7 +13,7 @@ except:
|
|||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
option_4 = StrOption(name="condition2", doc="No change", default="yes", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="test_variable", doc="No change", default="no", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe"), 'reverse_condition': ParamValue(True)})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("yes")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_4, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4), 'expected_1': ParamValue(["yes", "maybe"])})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["yes", "maybe"]), 'reverse_condition_0': ParamValue(True), 'condition_operator': ParamValue("OR"), 'condition_1': ParamOption(option_4, notraisepropertyerror=True), 'expected_1': ParamValue(["yes", "maybe"])})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -12,8 +12,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="oui", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue("maybe")}))}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("oui")})), Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("maybe")}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
option_10 = StrOption(name="engine", doc="engine", default="creole")
|
||||||
@ -23,7 +23,7 @@ option_13 = StrOption(name="mode", doc="mode", default="0644")
|
|||||||
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
option_14 = FilenameOption(name="name", doc="name", default="/tmp/file1")
|
||||||
option_15 = StrOption(name="owner", doc="owner", default="root")
|
option_15 = StrOption(name="owner", doc="owner", default="root")
|
||||||
option_16 = StrOption(name="source", doc="source", default="file1")
|
option_16 = StrOption(name="source", doc="source", default="file1")
|
||||||
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")})))
|
option_17 = BoolOption(name="activate", doc="activate", default=Calculation(func.calc_value, Params((ParamValue(False)), kwargs={'default': ParamValue(True), 'condition_0': ParamOption(option_3, notraisepropertyerror=True), 'expected_0': ParamValue(["oui", "maybe"]), 'condition_operator': ParamValue("OR")})))
|
||||||
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
option_9 = OptionDescription(name="file1", doc="file1", children=[option_10, option_11, option_12, option_13, option_14, option_15, option_16, option_17])
|
||||||
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
option_8 = OptionDescription(name="files", doc="files", children=[option_9])
|
||||||
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
option_18 = BoolOption(name="activate", doc="activate", default=True)
|
||||||
|
@ -12,8 +12,8 @@ try:
|
|||||||
except:
|
except:
|
||||||
from tiramisu import *
|
from tiramisu import *
|
||||||
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
option_3 = StrOption(name="condition", doc="No change", default="non", properties=frozenset({"mandatory", "normal"}))
|
||||||
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))}))
|
option_4 = StrOption(name="mode_conteneur_actif", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(None)}))}))
|
||||||
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True), 'expected': ParamValue(None)}))}))
|
option_5 = StrOption(name="mode_conteneur_actif2", doc="No change", default="non", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue(None)}))}))
|
||||||
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
option_2 = OptionDescription(name="general", doc="general", children=[option_3, option_4, option_5], properties=frozenset({"normal"}))
|
||||||
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2])
|
||||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||||
|
27
tests/dictionaries/10load_disabled_if_in_twice/00-base.xml
Normal file
27
tests/dictionaries/10load_disabled_if_in_twice/00-base.xml
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<rougail version="0.9">
|
||||||
|
<variables>
|
||||||
|
<variable name="my_var1">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="my_var2">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
<variable name="my_var3">
|
||||||
|
<value>no</value>
|
||||||
|
</variable>
|
||||||
|
</variables>
|
||||||
|
|
||||||
|
<constraints>
|
||||||
|
<condition name="disabled_if_in" source="my_var1">
|
||||||
|
<param>no</param>
|
||||||
|
<target type="variable">my_var2</target>
|
||||||
|
</condition>
|
||||||
|
<condition name="disabled_if_in" source="my_var2">
|
||||||
|
<param>no</param>
|
||||||
|
<target type="variable">my_var3</target>
|
||||||
|
</condition>
|
||||||
|
</constraints>
|
||||||
|
</rougail>
|
||||||
|
<!-- vim: ts=4 sw=4 expandtab
|
||||||
|
-->
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"rougail.my_var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"rougail.my_var1": "no"
|
||||||
|
}
|
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"rougail.my_var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
from importlib.machinery import SourceFileLoader
|
||||||
|
from importlib.util import spec_from_loader, module_from_spec
|
||||||
|
loader = SourceFileLoader('func', 'tests/dictionaries/../eosfunc/test.py')
|
||||||
|
spec = spec_from_loader(loader.name, loader)
|
||||||
|
func = module_from_spec(spec)
|
||||||
|
loader.exec_module(func)
|
||||||
|
for key, value in dict(locals()).items():
|
||||||
|
if key != ['SourceFileLoader', 'func']:
|
||||||
|
setattr(func, key, value)
|
||||||
|
try:
|
||||||
|
from tiramisu3 import *
|
||||||
|
except:
|
||||||
|
from tiramisu import *
|
||||||
|
option_2 = StrOption(name="my_var1", doc="my_var1", default="no", properties=frozenset({"mandatory", "normal"}))
|
||||||
|
option_3 = StrOption(name="my_var2", doc="my_var2", default="no", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_2, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))}))
|
||||||
|
option_4 = StrOption(name="my_var3", doc="my_var3", default="no", properties=frozenset({"mandatory", "normal", Calculation(func.calc_value, Params(ParamValue('disabled'), kwargs={'condition': ParamOption(option_3, todict=True, notraisepropertyerror=True), 'expected': ParamValue("no")}))}))
|
||||||
|
option_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4])
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user