diff --git a/.gitignore b/.gitignore index 125f29e2944245d582501c47eb416a3017307922..dc49845e4983d320c85fc322d5c4271feaacf0e8 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ /parts/ /slapos.core.egg-info/ /master/bt5/bt5list +/master/Products +/master/product/__init__.py diff --git a/CHANGES.txt b/CHANGES.txt index 4ed214c1455b42a056b454d5d2a7db060e8fc316..438363e5db400d8f85c9f23be62fb5a900ca4418 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,10 +1,75 @@ Changes ======= -0.26 (Unreleased) +0.28.2 (2012-08-17) +------------------- + + * Resolved path problem in register [Cédric Le Ninivin] + + +0.28.1 (2012-08-17) +------------------- + + * Resolved critical naming conflict + +0.28 (2012-08-17) ----------------- - * No change yet. + * Introduce "slapos node register" command, that will register computer to + SlapOS Master (vifib.net by default) for you. [Cédric Le Ninivin] + * Set .timestamp in partitions ONLY after slapgrid thinks it's okay (promises, + ...). [Cedric de Saint Martin] + * slapgrid-ur: when destroying (not reporting), only care about instances to + destroy, completely ignore others. [Cedric de Saint Martin] + +0.27 (2012-08-08) +----------------- + + * slapformat: Raise correct error when no IPv6 is available on selected + interface. [Cedric de Saint Martin] + * slapgrid: Introduce --only_sr and --only_cp. + - only_sr filter and force the run of a single SR, and uses url_md5 + (folder_id) + - only_cp filter which computer patition, will be runned. it can be a + list, splited by comman (slappartX,slappartY ...) [Rafael Monnerat] + * slapgrid: Cleanup unused option (--usage-report-periodicity). [Cedric de + Saint Martin] + * slapgrid: --develop will work also for Computer Partitions. [Cedric de Saint + Martin] + * slaplib: setConnectionDict won't call Master if parameters haven't changed. + [Cedric de Saint Martin] + +0.26.2 (2012-07-09) +------------------- + + * Define UTF-8 encoding in SlapOS Node codebase, as defined in PEP-263. + +0.26.1 (2012-07-06) +------------------- + + * slapgrid-sr: Add --develop option to make it ignore .completed files. + * SLAP library: it is now possible to fetch whole dict of connection + parameters. + * SLAP library: it is now possible to fetch single instance parameter. + * SLAP library: change Computer and ComputerPartition behavior to have proper + caching of computer partition parameters. + +0.26 (2012-07-05) +----------------- + + * slapformat: no_bridge option becomes 'not create_tap'. + create_tap is true by default. So a bridge is used and tap will be created by + default. [Cedric de Saint Martin] + * Add delay for slapformat. [Cedric Le Ninivin] + * If no software_type is given, use default one (i.e fix "error 500" when + requesting new instance). [Cedric de Saint Martin] + * slapgrid: promise based software release, new api to fetch full computer + information from server. [Yingjie Xu] + * slapproxy: new api to mock full computer information [Yingjie Xu] + * slapgrid: minor fix randomise delay feature. [Yingjie Xu] + * slapgrid: optimise slapgrid-cp, run buildout only if there is an update + on server side. [Yingjie Xu] + * libslap: Allow accessing ServerError. [Vincent Pelletier] 0.25 (2012-05-16) ----------------- diff --git a/bootstrap.py b/bootstrap.py new file mode 100644 index 0000000000000000000000000000000000000000..7647cbbe10e7638d71079fd8f6ca295e89941a51 --- /dev/null +++ b/bootstrap.py @@ -0,0 +1,262 @@ +############################################################################## +# +# Copyright (c) 2006 Zope Foundation and Contributors. +# All Rights Reserved. +# +# This software is subject to the provisions of the Zope Public License, +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS +# FOR A PARTICULAR PURPOSE. +# +############################################################################## +"""Bootstrap a buildout-based project + +Simply run this script in a directory containing a buildout.cfg. +The script accepts buildout command-line options, so you can +use the -c option to specify an alternate configuration file. +""" + +import os, shutil, sys, tempfile, urllib, urllib2, subprocess +from optparse import OptionParser + +if sys.platform == 'win32': + def quote(c): + if ' ' in c: + return '"%s"' % c # work around spawn lamosity on windows + else: + return c +else: + quote = str + +# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments. +stdout, stderr = subprocess.Popen( + [sys.executable, '-Sc', + 'try:\n' + ' import ConfigParser\n' + 'except ImportError:\n' + ' print 1\n' + 'else:\n' + ' print 0\n'], + stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() +has_broken_dash_S = bool(int(stdout.strip())) + +# In order to be more robust in the face of system Pythons, we want to +# run without site-packages loaded. This is somewhat tricky, in +# particular because Python 2.6's distutils imports site, so starting +# with the -S flag is not sufficient. However, we'll start with that: +if not has_broken_dash_S and 'site' in sys.modules: + # We will restart with python -S. + args = sys.argv[:] + args[0:0] = [sys.executable, '-S'] + args = map(quote, args) + os.execv(sys.executable, args) +# Now we are running with -S. We'll get the clean sys.path, import site +# because distutils will do it later, and then reset the path and clean +# out any namespace packages from site-packages that might have been +# loaded by .pth files. +clean_path = sys.path[:] +import site # imported because of its side effects +sys.path[:] = clean_path +for k, v in sys.modules.items(): + if k in ('setuptools', 'pkg_resources') or ( + hasattr(v, '__path__') and + len(v.__path__) == 1 and + not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))): + # This is a namespace package. Remove it. + sys.modules.pop(k) + +is_jython = sys.platform.startswith('java') + +setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py' +distribute_source = 'http://python-distribute.org/distribute_setup.py' + + +# parsing arguments +def normalize_to_url(option, opt_str, value, parser): + if value: + if '://' not in value: # It doesn't smell like a URL. + value = 'file://%s' % ( + urllib.pathname2url( + os.path.abspath(os.path.expanduser(value))),) + if opt_str == '--download-base' and not value.endswith('/'): + # Download base needs a trailing slash to make the world happy. + value += '/' + else: + value = None + name = opt_str[2:].replace('-', '_') + setattr(parser.values, name, value) + +usage = '''\ +[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] + +Bootstraps a buildout-based project. + +Simply run this script in a directory containing a buildout.cfg, using the +Python that you want bin/buildout to use. + +Note that by using --setup-source and --download-base to point to +local resources, you can keep this script from going over the network. +''' + +parser = OptionParser(usage=usage) +parser.add_option("-v", "--version", dest="version", + help="use a specific zc.buildout version") +parser.add_option("-d", "--distribute", + action="store_true", dest="use_distribute", default=False, + help="Use Distribute rather than Setuptools.") +parser.add_option("--setup-source", action="callback", dest="setup_source", + callback=normalize_to_url, nargs=1, type="string", + help=("Specify a URL or file location for the setup file. " + "If you use Setuptools, this will default to " + + setuptools_source + "; if you use Distribute, this " + "will default to " + distribute_source + ".")) +parser.add_option("--download-base", action="callback", dest="download_base", + callback=normalize_to_url, nargs=1, type="string", + help=("Specify a URL or directory for downloading " + "zc.buildout and either Setuptools or Distribute. " + "Defaults to PyPI.")) +parser.add_option("--eggs", + help=("Specify a directory for storing eggs. Defaults to " + "a temporary directory that is deleted when the " + "bootstrap script completes.")) +parser.add_option("-t", "--accept-buildout-test-releases", + dest='accept_buildout_test_releases', + action="store_true", default=False, + help=("Normally, if you do not specify a --version, the " + "bootstrap script and buildout gets the newest " + "*final* versions of zc.buildout and its recipes and " + "extensions for you. If you use this flag, " + "bootstrap and buildout will get the newest releases " + "even if they are alphas or betas.")) +parser.add_option("-c", None, action="store", dest="config_file", + help=("Specify the path to the buildout configuration " + "file to be used.")) + +options, args = parser.parse_args() + +# if -c was provided, we push it back into args for buildout's main function +if options.config_file is not None: + args += ['-c', options.config_file] + +if options.eggs: + eggs_dir = os.path.abspath(os.path.expanduser(options.eggs)) +else: + eggs_dir = tempfile.mkdtemp() + +if options.setup_source is None: + if options.use_distribute: + options.setup_source = distribute_source + else: + options.setup_source = setuptools_source + +if options.accept_buildout_test_releases: + args.append('buildout:accept-buildout-test-releases=true') +args.append('bootstrap') + +try: + import pkg_resources + import setuptools # A flag. Sometimes pkg_resources is installed alone. + if not hasattr(pkg_resources, '_distribute'): + raise ImportError +except ImportError: + ez_code = urllib2.urlopen( + options.setup_source).read().replace('\r\n', '\n') + ez = {} + exec ez_code in ez + setup_args = dict(to_dir=eggs_dir, download_delay=0) + if options.download_base: + setup_args['download_base'] = options.download_base + if options.use_distribute: + setup_args['no_fake'] = True + ez['use_setuptools'](**setup_args) + if 'pkg_resources' in sys.modules: + reload(sys.modules['pkg_resources']) + import pkg_resources + # This does not (always?) update the default working set. We will + # do it. + for path in sys.path: + if path not in pkg_resources.working_set.entries: + pkg_resources.working_set.add_entry(path) + +cmd = [quote(sys.executable), + '-c', + quote('from setuptools.command.easy_install import main; main()'), + '-mqNxd', + quote(eggs_dir)] + +if not has_broken_dash_S: + cmd.insert(1, '-S') + +find_links = options.download_base +if not find_links: + find_links = os.environ.get('bootstrap-testing-find-links') +if find_links: + cmd.extend(['-f', quote(find_links)]) + +if options.use_distribute: + setup_requirement = 'distribute' +else: + setup_requirement = 'setuptools' +ws = pkg_resources.working_set +setup_requirement_path = ws.find( + pkg_resources.Requirement.parse(setup_requirement)).location +env = dict( + os.environ, + PYTHONPATH=setup_requirement_path) + +requirement = 'zc.buildout' +version = options.version +if version is None and not options.accept_buildout_test_releases: + # Figure out the most recent final version of zc.buildout. + import setuptools.package_index + _final_parts = '*final-', '*final' + + def _final_version(parsed_version): + for part in parsed_version: + if (part[:1] == '*') and (part not in _final_parts): + return False + return True + index = setuptools.package_index.PackageIndex( + search_path=[setup_requirement_path]) + if find_links: + index.add_find_links((find_links,)) + req = pkg_resources.Requirement.parse(requirement) + if index.obtain(req) is not None: + best = [] + bestv = None + for dist in index[req.project_name]: + distv = dist.parsed_version + if _final_version(distv): + if bestv is None or distv > bestv: + best = [dist] + bestv = distv + elif distv == bestv: + best.append(dist) + if best: + best.sort() + version = best[-1].version +if version: + requirement = '=='.join((requirement, version)) +cmd.append(requirement) + +if is_jython: + import subprocess + exitcode = subprocess.Popen(cmd, env=env).wait() +else: # Windows prefers this, apparently; otherwise we would prefer subprocess + exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env])) +if exitcode != 0: + sys.stdout.flush() + sys.stderr.flush() + print ("An error occurred when trying to install zc.buildout. " + "Look above this message for any errors that " + "were output by easy_install.") + sys.exit(exitcode) + +ws.add_entry(eggs_dir) +ws.require(requirement) +import zc.buildout.buildout +zc.buildout.buildout.main(args) +if not options.eggs: # clean up temporary egg directory + shutil.rmtree(eggs_dir) diff --git a/documentation/source/rest.rst b/documentation/source/rest.rst index aff4d8f69ded8539d8664a604cff2e1a7d2d6395..e849c8ab929222448e3b3a5b11ca48af8e374ee6 100644 --- a/documentation/source/rest.rst +++ b/documentation/source/rest.rst @@ -1,6 +1,17 @@ SlapOS Master REST API (v1) *************************** +Introduction +------------ + +This is so called REST interface to Vifib which uses HTTP protocol. + +API_BASE +++++++++ + +``"API_BASE"`` is server side path of the interface. In case of Vifib.net it +is... + Authentication -------------- @@ -11,30 +22,82 @@ As API is going to be used in environments which support TLS communication channel, but do not, or support is cumbersome, support X509 keys OAuth-2 will be proposed by library. -Token based authentication -++++++++++++++++++++++++++ +Internal authentication ++++++++++++++++++++++++ + +**Note**: This authentication mechanism will change. Avoid implementation for now. In case if client of API does not fulfill X509 authentication it has a chance to use token based authentication (after obtaining proper token). Client application HAVE TO use ``"Authorization"`` header, even if OAuth-2 -allows other ways (like hvaing token in GET parameter or as form one). +allows other ways (like having token in GET parameter or as form one). They were not implemented as begin fragile from security point of view. Example of using Bearer token:: - GET /api/v1/instance/{instance_id} HTTP/1.1 + GET /API_BASE/instance/{instance_id} HTTP/1.1 Host: example.com Accept: application/json Authorization: Bearer 7Fjfp0ZBr1KtDRbnfVdmIw + +External authentication ++++++++++++++++++++++++ + +It is possible to use Facebook and Google as Authorization Server with Oauth 2.0 +access tokens. Client shall fetch `access_token` as described in: + + * https://developers.facebook.com/docs/authentication/client-side/ (Facebook) + * https://developers.google.com/accounts/docs/OAuth2Login (Google) + +Such token shall be passed in `Authorization` header, in case of Facebook:: + + GET /API_BASE/instance/{instance_id} HTTP/1.1 + Host: example.com + Accept: application/json + Authorization: Facebook retrieved_access_token + +and in case of Google:: + + GET /API_BASE/instance/{instance_id} HTTP/1.1 + Host: example.com + Accept: application/json + Authorization: Google retrieved_access_token + + +The client is responsible for having its own application ID and +configure it that user basic information and email will be available after +using `access_token`, for example by fetching token after query like:: + + https://www.facebook.com/dialog/oauth?client_id=FB_ID&response_type=token&redirect_uri=APP_URL&scope=email + +While passing access token Vifib.net server will contact proper Authorization +Server (Google or Facebook) and use proper user profile. In case of first time +usage of the service the user will be automatically created, so application +shall be prepared to support HTTP ``"202 Accepted"`` code, as described in `Response status code`_. + +Facebook notes +~~~~~~~~~~~~~~ + +While requesting Facebook access token it is required to set ``scope`` value +to ``email``. + +Vifib.net will use those data to create users. + +Google notes +~~~~~~~~~~~~ + +While requesting Google access token it is required to set ``scope`` value +to ``https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email``. + +Vifib.net will use those data to create users. + Exchange format --------------- SlapOS master will support both XML and JSON formats for input and output. -The Accept header is required and responsible for format selection. - Response status code -------------------- @@ -59,6 +122,17 @@ applied.. ``OPTIONS`` requests will return ``"204 No Content"`` response with headers informing about possible method usage. +``"202 Accepted"`` with json response with status can be returned in order to +indicate that request was correct, but some asynchronous opertions are disallow +to finish it, for example user being in creation process:: + + HTTP/1.1 202 Accepted + Content-Type: application/json; charset=utf-8 + + { + "status": "User under creation." + } + Common Error Responses ++++++++++++++++++++++ @@ -99,97 +173,6 @@ Request to non existing resource made. ~~~~~~~~~~~~~~~~~~~~~~~~~ Unexpected error. -Introsepcation Methods -********************** - -Fetching list of access urls ----------------------------- - -Explain acccess points in dictionary. - -Client is expected to ask about connection points before doing any request. - -In case if required mapping is defined on client side, but server does not -expose this information, it means, that such capability is not available on -server side and should not be used. - -In case if client does not support exposed mapping it is allowed to ignore -them. - -Client shall be aware that one API can be spanned across many servers and that -all urls are given as abolute ones. - -Endpoint to invoke required action is in ``url`` object, where values in -``{}`` shall be replaced with corresponding access urls. For example -``instance_url`` shall be replaced with obtained URL of instance (by request -or list). - -``method`` is required method on URL. - -All required parameters, if any, are in ``required`` object. - -All optional understandable parameters, if any, are in ``optional`` object. - -In case if access point requires authentication, then ``authentication`` will be set to ``true``. - -`Request`:: - - GET / HTTP/1.1 - Host: example.com - Accept: application/json - -`No Expected Request Body` - -Extract of possible response:: - - HTTP/1.1 200 OK - Content-Type: application/json; charset=utf-8 - - { - "instance_bang": { - "authentication": true, - "url": "{instance_url}/bang", - "method": "POST", - "required": { - "log": "unicode" - }, - "optional": {} - }, - "instance_list": { - "authentication": true, - "url": "http://three.example.com/instance", - "method": "GET", - "required": {}, - "optional": {} - }, - "register_computer": { - "authentication": true, - "url": "http://two.example.com/computer", - "method": "POST", - "required": { - "title": "unicode" - }, - }, - "request_instance": { - "authentication": true, - "url": "http://one.example.com/instance", - "method": "POST", - "required": { - "status": "unicode", - "slave": "bool", - "title": "unicode", - "software_release": "unicode", - "software_type": "unicode", - "parameter": "object", - "sla": "object" - }, - "optional": {} - } - } - -All documentation here will refer to named access points except otherwise -stated. The access point will appear in ``[]`` after method name. - Instance Methods **************** @@ -200,7 +183,7 @@ Ask for list of instances. `Request`:: - GET [instance_list] HTTP/1.1 + GET /API_BASE/instance HTTP/1.1 Host: example.com Accept: application/json @@ -228,7 +211,7 @@ Request a new instantiation of a software. `Request`:: - POST [request_instance] HTTP/1.1 + POST /API_BASE/instance HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -293,7 +276,7 @@ Request all instance information. `Request`:: - GET [instance_info] HTTP/1.1 + GET /API_BASE/<instance_path> HTTP/1.1 Host: example.com Accept: application/json @@ -346,7 +329,7 @@ Request the instance certificates. `Request`:: - GET [instance_certificate] HTTP/1.1 + GET /API_BASE/<instance_path>/certificate HTTP/1.1 Host: example.com Accept: application/json @@ -378,7 +361,7 @@ Trigger the re-instantiation of all partitions in the instance tree `Request`:: - POST [instance_bang] HTTP/1.1 + POST /API_BASE/<instance_path>/bang HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -404,7 +387,7 @@ Modify the instance information and status. `Request`:: - PUT [instance_edit] HTTP/1.1 + PUT /API_BASE/<instance_path> HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -455,7 +438,7 @@ Add a new computer in the system. `Request`:: - POST [register_computer] HTTP/1.1 + POST /API_BASE/computer HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -489,7 +472,7 @@ Get the status of a computer `Request`:: - GET [computer_info] HTTP/1.1 + GET /API_BASE/<computer_path> HTTP/1.1 Host: example.com Accept: application/json @@ -535,7 +518,7 @@ Modify computer information in the system `Request`:: - PUT [computer_edit] HTTP/1.1 + PUT /API_BASE/<computer_path> HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -578,7 +561,7 @@ Request to supply a new software release on a computer `Request`:: - POST [computer_supply] HTTP/1.1 + POST /API_BASE/<computer_path>/supply HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -605,7 +588,7 @@ Request update on all partitions `Request`:: - POST [computer_bang] HTTP/1.1 + POST /API_BASE/<computer_path>/bang HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 @@ -631,7 +614,7 @@ Report computer usage `Request`:: - POST [computer_report] HTTP/1.1 + POST /API_BASE/<computer_path>/report HTTP/1.1 Host: example.com Accept: application/json Content-Type: application/json; charset=utf-8 diff --git a/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getComputerPartitionState.xml b/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getComputerPartitionState.xml new file mode 100644 index 0000000000000000000000000000000000000000..f71c62a82834c35aa91e5adc29a0d617ce14f27c --- /dev/null +++ b/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getComputerPartitionState.xml @@ -0,0 +1,94 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>portal = context.getPortalObject()\n +\n +computer = portal.portal_catalog.getResultValue(\n + portal_type="Computer",\n + reference=computer_reference)\n +\n +partition = portal.portal_catalog.getResultValue(\n + portal_type="Computer Partition",\n + reference=computer_partition_reference,\n + parent_uid=computer.getUid())\n +\n +instance = portal.portal_catalog.getResultValue(\n + portal_type="Software Instance",\n + default_aggregate_uid=partition.getUid(),\n + validation_state="validated")\n +\n +if instance is None:\n + return "Destroyed"\n +else:\n + return instance.SoftwareInstance_getStatus()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>computer_reference, computer_partition_reference</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Agent_getComputerPartitionState</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getSoftwareReleaseDocumentFromReference.xml b/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getSoftwareReleaseDocumentFromReference.xml index 949ec4869e42caa8280cecae771540aef19271c5..dd7a4d9355c96456c229180932f74b31c6e6b5c3 100644 --- a/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getSoftwareReleaseDocumentFromReference.xml +++ b/master/bt5/vifib_agent/SkinTemplateItem/portal_skins/vifib_agent/Agent_getSoftwareReleaseDocumentFromReference.xml @@ -51,7 +51,7 @@ <item> <key> <string>_body</string> </key> <value> <string>portal = context.getPortalObject()\n -software_release = portal.portal_catalog.getResultValue(portal_type="Software Release", reference=software_release_reference)\n +software_release = portal.portal_catalog.getResultValue(portal_type="Software Release", url_string=software_release_reference)\n return software_release\n </string> </value> </item> diff --git a/master/bt5/vifib_agent/bt/revision b/master/bt5/vifib_agent/bt/revision index e440e5c842586965a7fb77deda2eca68612b1f53..62f9457511f879886bb7728c986fe10b0ece6bcb 100644 --- a/master/bt5/vifib_agent/bt/revision +++ b/master/bt5/vifib_agent/bt/revision @@ -1 +1 @@ -3 \ No newline at end of file +6 \ No newline at end of file diff --git a/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstance/bang_timestamp_property.xml b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstance/bang_timestamp_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..e11859b82e9bbb45d28b08bbf1716c52192c5089 --- /dev/null +++ b/master/bt5/vifib_base/PropertySheetTemplateItem/portal_property_sheets/SoftwareInstance/bang_timestamp_property.xml @@ -0,0 +1,32 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/int</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Used to inform client to update the instance.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>bang_timestamp_property</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Base_createOauth2User.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Base_createOauth2User.xml new file mode 100644 index 0000000000000000000000000000000000000000..4904447af92270d1904abfdf0ed52312aed4e679 --- /dev/null +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Base_createOauth2User.xml @@ -0,0 +1,110 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +from DateTime import DateTime\n +\n +if context.REQUEST.get(\'Base_createOauth2User\') is not None:\n + return\n +\n +context.REQUEST.set(\'Base_createOauth2User\', 1)\n +portal = context.getPortalObject()\n +\n +if portal.portal_activities.countMessageWithTag(tag) > 0:\n + return\n +\n +person = portal.ERP5Site_getAuthenticatedMemberPersonValue(reference)\n +if person is not None:\n + return\n +\n +activate_kw={\'tag\': tag}\n +person = portal.person_module.newContent(portal_type=\'Person\',\n + reference=reference,\n + first_name=first_name,\n + last_name=last_name,\n + default_email_coordinate_text=email,\n + activate_kw=activate_kw)\n +\n +person.validate(activate_kw=activate_kw)\n +\n +assignment_duration = portal.portal_preferences.getPreferredCredentialAssignmentDuration()\n +today = DateTime()\n +delay = today + assignment_duration\n +\n +category_list = portal.portal_preferences.getPreferredSubscriptionAssignmentCategoryList()\n +\n +assignment = person.newContent(\n + portal_type=\'Assignment\',\n + category_list=category_list,\n + start_date = today,\n + stop_date = delay,\n + activate_kw=activate_kw)\n +assignment.open(activate_kw=activate_kw)\n +\n +person.setRoleList(assignment.getRoleList())\n + + +]]></string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>tag, first_name, last_name, reference, email</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_createOauth2User</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml index 600b324c0ce1e7eb701899fbed36232b3bcf0b31..4e617972f3f1619ac17119f0f64d77a2a821ef12 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getAvailableSoftwareReleaseUrlStringList.xml @@ -65,7 +65,7 @@ elif slap_state == \'busy\':\n validation_state="validated",\n default_aggregate_uid=context.getUid(),\n )\n - if instance is None:\n + if (instance is None) or (instance.getSlapState() != "start_requested"):\n return []\n else:\n return [instance.getRootSoftwareReleaseUrl()]\n diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getSoftwareType.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getSoftwareType.xml index 7450ea8037c469966617fbad16a6d77f2fe4cfc9..e96b4f0161ab9a966c0942c631a26713c3f2a86e 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getSoftwareType.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/ComputerPartition_getSoftwareType.xml @@ -55,7 +55,7 @@ validation_state="validated",\n default_aggregate_uid=context.getUid(),\n )\n -if instance is None:\n +if (instance is None) or (instance.getSlapState() != "start_requested"):\n return ""\n else:\n return instance.getSourceReference()\n diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Computer_viewCurrentUsage/your_busy_computer_partition_list.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Computer_viewCurrentUsage/your_busy_computer_partition_list.xml index 836e12eb8fdc7ced54075a664e6e20521e3ceaba..2e02cf171f986b4311742a81d344aa541cfd9e12 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Computer_viewCurrentUsage/your_busy_computer_partition_list.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/Computer_viewCurrentUsage/your_busy_computer_partition_list.xml @@ -406,7 +406,7 @@ <string>Image</string> </tuple> <tuple> - <string>SoftwareInstance_getStatus</string> + <string>ComuterPartition_getSoftwareInstanceStatus</string> <string>Status</string> </tuple> </list> diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml index b84edb29cead7dff7a28725e82cfc431ee848863..e7f6a0a5558d83b3cd0a463e9dc97b714d73e7ca 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/OpenSaleOrder_findPartition.xml @@ -71,6 +71,25 @@ else:\n # support SLA\n if "computer_guid" in filter_kw:\n query_kw["parent_reference"] = filter_kw["computer_guid"]\n +if "instance_guid" in filter_kw:\n + portal = context.getPortalObject()\n + instance = portal.portal_catalog.getResultValue(portal_type="Software Instance", reference=filter_kw["instance_guid"])\n + if instance is None:\n + # XXX Other user do not have access to the instance document...\n + if filter_kw["instance_guid"] == "SOFTINST-9238":\n + # XXX Let\'s be nice with Cedric and Vincent\n + query_kw["uid"] = "2225067"\n + elif filter_kw["instance_guid"] == "SOFTINST-11031":\n + # XXX Let\'s be nice with KVM frontend\n + query_kw["uid"] = "2874296"\n + else:\n + query_kw["uid"] = "-1"\n + else:\n + partition_uid = instance.getAggregateUid(portal_type="Computer Partition")\n + if partition_uid:\n + query_kw["uid"] = partition_uid\n + else:\n + query_kw["uid"] = "-1"\n \n SQL_WINDOW_SIZE = 50\n \n diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareInstanceModule_viewSoftwareInstanceList/listbox.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareInstanceModule_viewSoftwareInstanceList/listbox.xml index 6c8a55764914bd48fd8e6898addef3ed03900c7f..9e96d543d5ff7a83ff2bc9796e4d8458a3777672 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareInstanceModule_viewSoftwareInstanceList/listbox.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_base/SoftwareInstanceModule_viewSoftwareInstanceList/listbox.xml @@ -86,6 +86,14 @@ <string>translated_portal_type</string> <string>Type</string> </tuple> + <tuple> + <string>translated_validation_state_title</string> + <string>Validation State</string> + </tuple> + <tuple> + <string>translated_slap_state_title</string> + <string>Slap State</string> + </tuple> <tuple> <string>source_reference</string> <string>Software Type</string> @@ -102,10 +110,6 @@ <string>modification_date</string> <string>Modification Date</string> </tuple> - <tuple> - <string>translated_validation_state_title</string> - <string>Validation State</string> - </tuple> </list> </value> </item> @@ -125,6 +129,14 @@ <string>translated_portal_type</string> <string>Type</string> </tuple> + <tuple> + <string>translated_validation_state_title</string> + <string>Validation State</string> + </tuple> + <tuple> + <string>translated_slap_state_title</string> + <string>Slap State</string> + </tuple> </list> </value> </item> diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/Base_getNotCategoryRelatedList.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/Base_getNotCategoryRelatedList.xml index 4e771cc36366bcde3e218d8d8e85355b3cbe35ce..ab86930852b138bb906ae830ff84f9a99562fe31 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/Base_getNotCategoryRelatedList.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/Base_getNotCategoryRelatedList.xml @@ -99,8 +99,9 @@ base_category_uid\r\n <value> <string encoding="cdata"><![CDATA[ select\n - catalog.uid, catalog.path from catalog\n + catalog.uid, catalog.path from catalog, movement\n where\n + movement.uid = catalog.uid AND movement.quantity <> 0 AND \n catalog.uid not in (\n select category.category_uid from category where category.base_category_uid=<dtml-var base_category_uid>)\n and (<dtml-in simulation_state_list>\n diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibInvoiceTransaction_postGeneration.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibInvoiceTransaction_postGeneration.xml index 81342e7b1d89e6e4653dbbe362a1784a2e37c007..13e54cdebbe640e9780ba47fe89144906dd30eb9 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibInvoiceTransaction_postGeneration.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibInvoiceTransaction_postGeneration.xml @@ -61,7 +61,8 @@ if related_simulation_movement_path_list is None:\n invoice = context\n \n # if installed erp5_simplified_invoicing, set resource from price currency\n -if not invoice.Invoice_isAdvanced():\n +#if not invoice.Invoice_isAdvanced():\n +if 1:\n if not invoice.getResource():\n invoice.setResource(invoice.getPriceCurrency())\n \n diff --git a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibPaymentTransaction_postGeneration.xml b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibPaymentTransaction_postGeneration.xml index ea452d9ee81e458558bc25e96df8ae85d77d9d43..40aac409a9dae7d04b8749070d23d287d98d7f56 100644 --- a/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibPaymentTransaction_postGeneration.xml +++ b/master/bt5/vifib_base/SkinTemplateItem/portal_skins/vifib_simulation/VifibPaymentTransaction_postGeneration.xml @@ -58,8 +58,9 @@ payment_transaction = context\n if payment_transaction.getSimulationState() == "draft":\n payment_transaction.plan(comment=translateString("Initialised by Delivery Builder."))\n \n -# First set the payment transaction in the building state on the causality workflow\n -payment_transaction.startBuilding()\n +if payment_transaction.getCausalityState() == "draft":\n + # First set the payment transaction in the building state on the causality workflow\n + payment_transaction.startBuilding()\n \n # update casuality from movements\n causality_list = payment_transaction.getCausalityList()\n diff --git a/master/bt5/vifib_base/bt/dependency_list b/master/bt5/vifib_base/bt/dependency_list index d98c947cfcf1cd2972cf46c3bf5a65b499ad968c..262dcf13250061926d00fe64be533b25b78d6dde 100644 --- a/master/bt5/vifib_base/bt/dependency_list +++ b/master/bt5/vifib_base/bt/dependency_list @@ -2,11 +2,13 @@ erp5_accounting erp5_accounting_l10n_fr erp5_administration erp5_base +erp5_bearer_token erp5_commerce erp5_computer_immobilisation erp5_content_translation erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -41,5 +43,4 @@ erp5_trade erp5_web erp5_web_download_theme erp5_xhtml_jquery_style -vifib_slapos_core -erp5_bearer_token \ No newline at end of file +vifib_slapos_core \ No newline at end of file diff --git a/master/bt5/vifib_base/bt/revision b/master/bt5/vifib_base/bt/revision index a21cae3648eecf716e8348f3690c25e6285f754d..4af7c92223a703030640aecf8e393d8656d607cc 100644 --- a/master/bt5/vifib_base/bt/revision +++ b/master/bt5/vifib_base/bt/revision @@ -1 +1 @@ -454 \ No newline at end of file +470 \ No newline at end of file diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_facebook_extraction.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_facebook_extraction.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b6f6d0e9db113610e8a19e7fa9c391b1d43f41d --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_facebook_extraction.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ERP5FacebookExtractionPlugin" module="Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>erp5_facebook_extraction</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_google_extraction.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_google_extraction.xml new file mode 100644 index 0000000000000000000000000000000000000000..27448a90b4de575bc641da2f2bc9e92d91d68146 --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/erp5_google_extraction.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ERP5GoogleExtractionPlugin" module="Products.ERP5Security.ERP5ExternalOauth2ExtractionPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>erp5_google_extraction</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_browser_id_authentication.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_browser_id_authentication.xml new file mode 100644 index 0000000000000000000000000000000000000000..44164bdfe8ceabe40c41d3eeaf43f38ef8ef2b3a --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_browser_id_authentication.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="VifibBrowserIDExtractionPlugin" module="Products.Vifib.VifibCookieHashExtractionPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_browser_id_authentication</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_facebook_authentication.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_facebook_authentication.xml new file mode 100644 index 0000000000000000000000000000000000000000..5b4b50dafd570f122a0670c9147552eceb44167a --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_facebook_authentication.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="VifibFacebookServerExtractionPlugin" module="Products.Vifib.VifibCookieHashExtractionPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_facebook_authentication</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_google_authentication.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_google_authentication.xml new file mode 100644 index 0000000000000000000000000000000000000000..f5ec65fa57fb4af40d598599d892b4dee5d36701 --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_google_authentication.xml @@ -0,0 +1,20 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="VifibGoogleServerExtractionPlugin" module="Products.Vifib.VifibCookieHashExtractionPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_google_authentication</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_machine_authentication.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_machine_authentication.xml new file mode 100644 index 0000000000000000000000000000000000000000..f34218131fb23264dc7e8a83195e834ba98f4b2a --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_machine_authentication.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="VifibMachineAuthenticationPlugin" module="Products.Vifib.VifibMachineAuthenticationPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_machine_authentication</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_shadow.xml b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_shadow.xml new file mode 100644 index 0000000000000000000000000000000000000000..0da4599503350e381ab2adce14d319725be1ba35 --- /dev/null +++ b/master/bt5/vifib_data/PathTemplateItem/acl_users/vifib_shadow.xml @@ -0,0 +1,22 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="VifibShadowAuthenticationPlugin" module="Products.Vifib.VifibShadowAuthenticationPlugin"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_shadow</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data/bt/revision b/master/bt5/vifib_data/bt/revision index 0aede4a000a9fda5ae3bb7cad217748e1392f17c..dec4c59e4a093bbe728ad2d8699ace93b10e92e4 100644 --- a/master/bt5/vifib_data/bt/revision +++ b/master/bt5/vifib_data/bt/revision @@ -1 +1 @@ -102 \ No newline at end of file +104 \ No newline at end of file diff --git a/master/bt5/vifib_data/bt/template_path_list b/master/bt5/vifib_data/bt/template_path_list index 72fa233cf0d4c5246ae0bd486f4deb890303ec94..a38471d6127711a1c475935b2e021369b47e3668 100644 --- a/master/bt5/vifib_data/bt/template_path_list +++ b/master/bt5/vifib_data/bt/template_path_list @@ -1,3 +1,10 @@ +acl_users/erp5_facebook_extraction +acl_users/erp5_google_extraction +acl_users/vifib_browser_id_authentication +acl_users/vifib_facebook_authentication +acl_users/vifib_google_authentication +acl_users/vifib_machine_authentication +acl_users/vifib_shadow currency_module/EUR document_module/1 notification_message_module/vifib* diff --git a/master/bt5/vifib_data_simulation/PathTemplateItem/portal_deliveries/vifib_sale_invoice_builder.xml b/master/bt5/vifib_data_simulation/PathTemplateItem/portal_deliveries/vifib_sale_invoice_builder.xml index 8ee0e4f2f7f7b6b663119297c35d251693601da3..5067458366d53824f9f6f1b70e554b5ea88fa187 100644 --- a/master/bt5/vifib_data_simulation/PathTemplateItem/portal_deliveries/vifib_sale_invoice_builder.xml +++ b/master/bt5/vifib_data_simulation/PathTemplateItem/portal_deliveries/vifib_sale_invoice_builder.xml @@ -101,6 +101,10 @@ </tuple> </value> </item> + <item> + <key> <string>delivery_creatable</string> </key> + <value> <int>0</int> </value> + </item> <item> <key> <string>delivery_line_collect_order</string> </key> <value> diff --git a/master/bt5/vifib_data_simulation/bt/revision b/master/bt5/vifib_data_simulation/bt/revision index afbe847262c0a530b87f33d06d3526a72dd1d9a4..405e057083f25e684989f485a916596125fdedc0 100644 --- a/master/bt5/vifib_data_simulation/bt/revision +++ b/master/bt5/vifib_data_simulation/bt/revision @@ -1 +1 @@ -126 \ No newline at end of file +127 \ No newline at end of file diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory.xml new file mode 100644 index 0000000000000000000000000000000000000000..c00ad007e63c9e91b81b7101ce8e52a1c9d1b4e1 --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory.xml @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Cache Factory" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>cache_duration</string> </key> + <value> <int>3600</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>browser_id_auth_token_cache_factory</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Cache Factory</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory/persistent_cache_plugin.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory/persistent_cache_plugin.xml new file mode 100644 index 0000000000000000000000000000000000000000..32cea51e82e2dea0b86c77cfb05a19ca0e13929b --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/browser_id_auth_token_cache_factory/persistent_cache_plugin.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Distributed Ram Cache" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>specialise/portal_memcached/default_memcached_plugin</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>persistent_cache_plugin</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Distributed Ram Cache</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory.xml new file mode 100644 index 0000000000000000000000000000000000000000..fbe9b0c55b2b04033f307be3e9f5efe3d7530b63 --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory.xml @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Cache Factory" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>cache_duration</string> </key> + <value> <int>3600</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>facebook_server_auth_token_cache_factory</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Cache Factory</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory/persistent_cache_plugin.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory/persistent_cache_plugin.xml new file mode 100644 index 0000000000000000000000000000000000000000..32cea51e82e2dea0b86c77cfb05a19ca0e13929b --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/facebook_server_auth_token_cache_factory/persistent_cache_plugin.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Distributed Ram Cache" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>specialise/portal_memcached/default_memcached_plugin</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>persistent_cache_plugin</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Distributed Ram Cache</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory.xml new file mode 100644 index 0000000000000000000000000000000000000000..9b727e65eea165d1136d98ac6154b9cd4482b49f --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory.xml @@ -0,0 +1,76 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Cache Factory" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>cache_duration</string> </key> + <value> <int>3600</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>google_server_auth_token_cache_factory</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Cache Factory</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <none/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory/persistent_cache_plugin.xml b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory/persistent_cache_plugin.xml new file mode 100644 index 0000000000000000000000000000000000000000..32cea51e82e2dea0b86c77cfb05a19ca0e13929b --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/portal_caches/google_server_auth_token_cache_factory/persistent_cache_plugin.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Distributed Ram Cache" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>specialise/portal_memcached/default_memcached_plugin</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>persistent_cache_plugin</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Distributed Ram Cache</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_browser_id.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_browser_id.xml new file mode 100644 index 0000000000000000000000000000000000000000..2bc0f4ab16125cb18f2cc75585b2f2c58a2733ed --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_browser_id.xml @@ -0,0 +1,183 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Section" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_folders_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>__translation_dict</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> + </value> + </item> + <item> + <key> <string>custom_render_method_id</string> </key> + <value> <string>WebSection_browserIdInitiateLogin</string> </value> + </item> + <item> + <key> <string>default_page_displayed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>login_with_browser_id</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Section</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Login with Browser ID</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="5" aka="AAAAAAAAAAU="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="6" aka="AAAAAAAAAAY="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook.xml new file mode 100644 index 0000000000000000000000000000000000000000..b697865284cc6d28ba46fb2e10eedabd7633fafd --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook.xml @@ -0,0 +1,183 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Section" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_folders_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>__translation_dict</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> + </value> + </item> + <item> + <key> <string>custom_render_method_id</string> </key> + <value> <string>WebSection_facebookInitiateLogin</string> </value> + </item> + <item> + <key> <string>default_page_displayed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>login_with_facebook</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Section</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Login with facebook</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="5" aka="AAAAAAAAAAU="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="6" aka="AAAAAAAAAAY="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook/facebook_callback.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook/facebook_callback.xml new file mode 100644 index 0000000000000000000000000000000000000000..ef8aa7b9e7c3cee57c6205a86d8049bd5455e7d5 --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_facebook/facebook_callback.xml @@ -0,0 +1,137 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Section" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_folders_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>custom_render_method_id</string> </key> + <value> <string>WebSection_facebookCallbackLogin</string> </value> + </item> + <item> + <key> <string>default_page_displayed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>facebook_callback</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Section</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Supports Facebook\'s callback</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google.xml new file mode 100644 index 0000000000000000000000000000000000000000..0a6f6cf6f9194fafd1dc4fe961810d37d60065de --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google.xml @@ -0,0 +1,183 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Section" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_folders_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>__translation_dict</string> </key> + <value> + <dictionary/> + </value> + </item> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAU=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAY=</string> </persistent> + </value> + </item> + <item> + <key> <string>custom_render_method_id</string> </key> + <value> <string>WebSection_googleInitiateLogin</string> </value> + </item> + <item> + <key> <string>default_page_displayed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>login_with_google</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Section</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Login with Google</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="5" aka="AAAAAAAAAAU="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="6" aka="AAAAAAAAAAY="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google/google_callback.xml b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google/google_callback.xml new file mode 100644 index 0000000000000000000000000000000000000000..a1c1eca45f7bf49c0d507f755de6c20b38aaf264 --- /dev/null +++ b/master/bt5/vifib_data_web/PathTemplateItem/web_site_module/hosting/login_with_google/google_callback.xml @@ -0,0 +1,137 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Web Section" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Add_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Add_portal_folders_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <tuple> + <string>Assignor</string> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>custom_render_method_id</string> </key> + <value> <string>WebSection_googleCallbackLogin</string> </value> + </item> + <item> + <key> <string>default_page_displayed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>google_callback</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Web Section</string> </value> + </item> + <item> + <key> <string>short_title</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Supports Google\'s callback</string> </value> + </item> + <item> + <key> <string>visible</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_data_web/bt/revision b/master/bt5/vifib_data_web/bt/revision index 69226f7293aa543649b73a6ed3264cddabfcd8c1..c4fbb1cfac0ba7a86115b48a39b49daea09da15a 100644 --- a/master/bt5/vifib_data_web/bt/revision +++ b/master/bt5/vifib_data_web/bt/revision @@ -1 +1 @@ -92 \ No newline at end of file +97 \ No newline at end of file diff --git a/master/bt5/vifib_data_web/bt/template_path_list b/master/bt5/vifib_data_web/bt/template_path_list index de8ddec35f09da807881cd5d7347ee2d15aded4a..971310b00cc823f4b665ea214a8df9845aa0e714 100644 --- a/master/bt5/vifib_data_web/bt/template_path_list +++ b/master/bt5/vifib_data_web/bt/template_path_list @@ -1,6 +1,12 @@ image_module/vifib.cloud image_module/vifib.kvm image_module/vifib.rack +portal_caches/browser_id_auth_token_cache_factory +portal_caches/browser_id_auth_token_cache_factory/persistent_cache_plugin +portal_caches/facebook_server_auth_token_cache_factory +portal_caches/facebook_server_auth_token_cache_factory/persistent_cache_plugin +portal_caches/google_server_auth_token_cache_factory +portal_caches/google_server_auth_token_cache_factory/persistent_cache_plugin web_page_module/vifib* web_site_module/cash web_site_module/cash/** diff --git a/master/bt5/vifib_erp5/PathTemplateItem/person_module/test_updated_vifib_user/1.xml b/master/bt5/vifib_erp5/PathTemplateItem/person_module/test_updated_vifib_user/1.xml new file mode 100644 index 0000000000000000000000000000000000000000..00b3ab48c57ef197adeb8f663e0e0f642e439343 --- /dev/null +++ b/master/bt5/vifib_erp5/PathTemplateItem/person_module/test_updated_vifib_user/1.xml @@ -0,0 +1,117 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Assignment" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_Access_contents_information_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Auditor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_Modify_portal_content_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Auditor</string> + <string>Manager</string> + <string>Owner</string> + </tuple> + </value> + </item> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>group/company</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>1</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Assignment</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <tuple> + <global name="PersistentMapping" module="Persistence.mapping"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <tuple> + <global name="PersistentMapping" module="Persistence.mapping"/> + <tuple/> + </tuple> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml b/master/bt5/vifib_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml index 72b38f4a606dd45d06692bc0ddf5700f4b7da9de..b42865d4f299ea60b7d696fa8445c0837ca86ef5 100644 --- a/master/bt5/vifib_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml +++ b/master/bt5/vifib_erp5/PortalTypePropertySheetTemplateItem/property_sheet_list.xml @@ -5,6 +5,9 @@ <portal_type id="Computer"> <item>VifibComputerConstraint</item> </portal_type> + <portal_type id="Computer Partition"> + <item>VifibComputerPartitionConstraint</item> + </portal_type> <portal_type id="Email"> <item>VifibEmailConstraint</item> </portal_type> diff --git a/master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Computer%20Partition.xml b/master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Computer%20Partition.xml index 76a9f6830f08f57afc949ece972ab0470a4126c4..171863017b49ed82a067856cd76c57a2a04a6e82 100644 --- a/master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Computer%20Partition.xml +++ b/master/bt5/vifib_erp5/PortalTypeRolesTemplateItem/Computer%20Partition.xml @@ -6,9 +6,9 @@ <multi_property id='base_category'>destination_section</multi_property> </role> <role id='Auditor'> - <property id='title'>Software Instance related by Hosting Subscription</property> + <property id='title'>Software Instance group related to Computer Partition</property> <property id='condition'>python: here.getSlapState() == "busy"</property> - <property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateMovementItemByHostingSubscription</property> + <property id='base_category_script'>ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription</property> <multi_property id='base_category'>aggregate</multi_property> </role> </type_roles> \ No newline at end of file diff --git a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint.xml b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint.xml new file mode 100644 index 0000000000000000000000000000000000000000..f37d33d9469a87471d5282c98d48ed1d52bddb02 --- /dev/null +++ b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint.xml @@ -0,0 +1,66 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Property Sheet" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_count</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_mt_index</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>_tree</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAQ=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>VifibComputerPartitionConstraint</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Property Sheet</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Length" module="BTrees.Length"/> + </pickle> + <pickle> <int>0</int> </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> + <record id="4" aka="AAAAAAAAAAQ="> + <pickle> + <global name="OOBTree" module="BTrees.OOBTree"/> + </pickle> + <pickle> + <none/> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint/non_busy_partition_has_no_related_instance_constraint.xml b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint/non_busy_partition_has_no_related_instance_constraint.xml new file mode 100644 index 0000000000000000000000000000000000000000..c68ee4bcc051026b9344b6a4eb052e269dc190e0 --- /dev/null +++ b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibComputerPartitionConstraint/non_busy_partition_has_no_related_instance_constraint.xml @@ -0,0 +1,114 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category Related Membership Arity Constraint" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>constraint_base_category</string> </key> + <value> + <tuple> + <string>default_aggregate</string> + </tuple> + </value> + </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: (\'Software Instance\', \'Slave Instance\')</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Computer Partition which is not busy, shall have none aggregate related instance.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>non_busy_partition_has_no_related_instance_constraint</string> </value> + </item> + <item> + <key> <string>int_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>max_arity</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>membership_criterion_category</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>min_arity</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category Related Membership Arity Constraint</string> </value> + </item> + <item> + <key> <string>string_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>test_method_id</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>test_tales_expression</string> </key> + <value> <string>python: context.getSlapState() != \'busy\'</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/property_existence_constraint.xml b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/ongoing_invoice_constraint.xml similarity index 60% rename from master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/property_existence_constraint.xml rename to master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/ongoing_invoice_constraint.xml index 2b807db14cb4b4b0c5b68c1f6e2d214d02662952..cccaf71aa95f49f02e6d0bcc5bfba2f5b69e3075 100644 --- a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/property_existence_constraint.xml +++ b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibPersonConstraint/ongoing_invoice_constraint.xml @@ -2,7 +2,7 @@ <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> - <global name="Property Existence Constraint" module="erp5.portal_type"/> + <global name="Category Related Membership Arity Constraint" module="erp5.portal_type"/> </pickle> <pickle> <dictionary> @@ -12,23 +12,6 @@ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> - <item> - <key> <string>_local_properties</string> </key> - <value> - <tuple> - <dictionary> - <item> - <key> <string>id</string> </key> - <value> <string>message_property_not_set</string> </value> - </item> - <item> - <key> <string>type</string> </key> - <value> <string>string</string> </value> - </item> - </dictionary> - </tuple> - </value> - </item> <item> <key> <string>_range_criterion</string> </key> <value> @@ -36,32 +19,42 @@ </value> </item> <item> - <key> <string>constraint_property</string> </key> + <key> <string>constraint_base_category</string> </key> <value> <tuple> - <string>last_name</string> + <string>default_destination_section</string> </tuple> </value> </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: (\'Sale Invoice Transaction\',)</string> </value> + </item> <item> <key> <string>description</string> </key> - <value> <string>Property last_name must be defined</string> </value> + <value> + <none/> + </value> + </item> + <item> + <key> <string>filter_parameter</string> </key> + <value> <string>python: {\'simulation_state\': \'planned\'}</string> </value> </item> <item> <key> <string>id</string> </key> - <value> <string>property_existence_constraint</string> </value> + <value> <string>ongoing_invoice_constraint</string> </value> </item> <item> - <key> <string>message_no_such_property</string> </key> - <value> <string>Property last_name must be defined</string> </value> + <key> <string>max_arity</string> </key> + <value> <int>1</int> </value> </item> <item> - <key> <string>message_property_not_set</string> </key> - <value> <string>Property last_name must be defined</string> </value> + <key> <string>min_arity</string> </key> + <value> <int>1</int> </value> </item> <item> <key> <string>portal_type</string> </key> - <value> <string>Property Existence Constraint</string> </value> + <value> <string>Category Related Membership Arity Constraint</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListConstraint/no_additional_applied_rule_order_causality_constraint.xml b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListConstraint/no_additional_applied_rule_order_causality_constraint.xml new file mode 100644 index 0000000000000000000000000000000000000000..2b54e2bc4db2d8431f6e655469e972b401672a71 --- /dev/null +++ b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListConstraint/no_additional_applied_rule_order_causality_constraint.xml @@ -0,0 +1,114 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Category Related Membership Arity Constraint" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_identity_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>_range_criterion</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>constraint_base_category</string> </key> + <value> + <tuple> + <string>causality</string> + </tuple> + </value> + </item> + <item> + <key> <string>constraint_portal_type</string> </key> + <value> <string>python: (\'Applied Rule\',)</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Sale Packing List build from Sale Order shall have no related Applied Rule.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>no_additional_applied_rule_order_causality_constraint</string> </value> + </item> + <item> + <key> <string>int_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>max_arity</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>membership_criterion_category</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>min_arity</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Category Related Membership Arity Constraint</string> </value> + </item> + <item> + <key> <string>string_index</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>test_method_id</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>test_tales_expression</string> </key> + <value> <string>python: len(context.getCausalityList()) != 0</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListLineConstraint/quantity_value_constraint.xml b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListLineConstraint/quantity_value_constraint.xml index 63c370cb505e0cbe52bdf0d4c0082d9af2c8dafa..3bf0ddbfcbcf99f398db03eb27f22ba80b66b140 100644 --- a/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListLineConstraint/quantity_value_constraint.xml +++ b/master/bt5/vifib_erp5/PropertySheetTemplateItem/portal_property_sheets/VifibSalePackingListLineConstraint/quantity_value_constraint.xml @@ -66,7 +66,7 @@ </item> <item> <key> <string>test_tales_expression</string> </key> - <value> <string>python: context.getSimulationState() != \'cancelled\'</string> </value> + <value> <string>python: context.getSimulationState() != \'cancelled\' and context.getSpecialise() != \'sale_trade_condition_module/vifib_simple_trade_condition\'</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.xml b/master/bt5/vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.xml new file mode 100644 index 0000000000000000000000000000000000000000..4fab600f9bc51327256698a12761abff17f1e16a --- /dev/null +++ b/master/bt5/vifib_erp5/SkinTemplateItem/portal_skins/vifib_core/ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription.xml @@ -0,0 +1,103 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""This scripts set ups role of aggregate related Software Instance\n +\n +This is simple implementation, instead of generic related category with portal type,\n +which would not be configurable in Role Definition anyway."""\n +\n +category_list = []\n +\n +if obj is None:\n + return []\n +\n +software_instance_list = obj.getPortalObject().portal_catalog(\n + portal_type=\'Software Instance\',\n + default_aggregate_uid=obj.getUid(),\n + limit=2\n +)\n +\n +if len(software_instance_list) == 1:\n + hosting_subscription = software_instance_list[0].getSpecialise(portal_type=\'Hosting Subscription\')\n + for base_category in base_category_list:\n + category_list.append({base_category: hosting_subscription})\n +\n +return category_list\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>base_category_list, user_name, obj, portal_type</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Assignee</string> + <string>Assignor</string> + <string>Associate</string> + <string>Auditor</string> + <string>Authenticated</string> + <string>Author</string> + <string>Manager</string> + <string>Member</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Type_getSecurityCategoryFromAggregateRelatedSoftwareInstanceHostingSubscription</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_erp5/TestTemplateItem/testVifibConstraint.py b/master/bt5/vifib_erp5/TestTemplateItem/testVifibConstraint.py index f49888ef49042bc8fa9f3c508ec60cd75144ec88..2b14f8d922e2accce8e56a8bb9fbbba9fd58c650 100644 --- a/master/bt5/vifib_erp5/TestTemplateItem/testVifibConstraint.py +++ b/master/bt5/vifib_erp5/TestTemplateItem/testVifibConstraint.py @@ -304,16 +304,6 @@ class TestVifibPersonConstraint(testVifibMixin): def getTitle(self): return "Vifib Person Constraint checks" - def test_last_name_existence(self): - person = self.portal.person_module.newContent(portal_type='Person') - consistency_message = 'Property last_name must be defined' - - self.assertTrue(consistency_message in getMessageList(person)) - - person.setLastName(rndstr()) - - self.assertFalse(consistency_message in getMessageList(person)) - def test_role(self): person = self.portal.person_module.newContent(portal_type='Person') consistency_message = 'One role should be defined' diff --git a/master/bt5/vifib_erp5/TestTemplateItem/testVifibModuleSecurity.py b/master/bt5/vifib_erp5/TestTemplateItem/testVifibModuleSecurity.py index 2b85fa43af61dce5b03a44715948c17c0cb4d198..b91c5945a54bb7d3ae6498413127ae52af88c6c6 100644 --- a/master/bt5/vifib_erp5/TestTemplateItem/testVifibModuleSecurity.py +++ b/master/bt5/vifib_erp5/TestTemplateItem/testVifibModuleSecurity.py @@ -27,6 +27,7 @@ from VifibMixin import testVifibMixin from zExceptions import Unauthorized +from Products.ERP5Type.tests.backportUnittest import skip class TestVifibModuleSecurity(testVifibMixin): """ @@ -72,6 +73,7 @@ class TestVifibModuleSecurity(testVifibMixin): def getTitle(self): return "Test Vifib Module security" + @skip('Ignored for now, as security changed a lot') def test_VifibUserCanNotAccessModules(self): """ Check if member of vifib group can not access modules. diff --git a/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow.xml b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow.xml index 2a56f78e421cd809f8e877152b1f008c3582dce2..bda691bed00d807705e4bf4dbca52ad1d86c884f 100644 --- a/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow.xml +++ b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow.xml @@ -22,6 +22,10 @@ <key> <string>id</string> </key> <value> <string>local_permission_vifib_interaction_workflow</string> </value> </item> + <item> + <key> <string>title</string> </key> + <value> <string>Local Permission Vifib Interaction Workflow</string> </value> + </item> </dictionary> </pickle> </record> diff --git a/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/interactions/SoftwareInstance_setAggregateList.xml b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/interactions/SoftwareInstance_setAggregateList.xml new file mode 100644 index 0000000000000000000000000000000000000000..a4bde692766014feb698f3f5d85aa0c686486dea --- /dev/null +++ b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/interactions/SoftwareInstance_setAggregateList.xml @@ -0,0 +1,98 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <list> + <string>SoftwareInstance_updateAggregateLocalRoles</string> + </list> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>SoftwareInstance_setAggregateList</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_setAggregate.*</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>Software Instance</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <list> + <string>SoftwareInstance_updateAggregateLocalRoles</string> + </list> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_reindexUnderDestructionComputerPartition.xml b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/scripts/SoftwareInstance_updateAggregateLocalRoles.xml similarity index 72% rename from master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_reindexUnderDestructionComputerPartition.xml rename to master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/scripts/SoftwareInstance_updateAggregateLocalRoles.xml index b7304d50f0f8a2a7faff99fd30b5d754684de5bc..a5204a9876221232cd6321e499d7a443ad0d87d9 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SalePackingList_reindexUnderDestructionComputerPartition.xml +++ b/master/bt5/vifib_erp5/WorkflowTemplateItem/portal_workflow/local_permission_vifib_interaction_workflow/scripts/SoftwareInstance_updateAggregateLocalRoles.xml @@ -50,20 +50,11 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, NegatedQuery\n -\n -current_delivery = state_change[\'object\']\n -portal = current_delivery.getPortalObject()\n -\n -destroy_service_relative_url = portal.portal_preferences.getPreferredInstanceCleanupResource()\n -\n -sale_packing_list_line_list = current_delivery.contentValues(portal_type="Sale Packing List Line")\n -for current_delivery_line in sale_packing_list_line_list:\n - if current_delivery_line.getResource() == destroy_service_relative_url:\n -\n - computer_partition = current_delivery_line.getAggregateValue(portal_type=["Computer Partition"])\n - computer_partition.activate(\n - after_path_and_method_id=(current_delivery.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n + <value> <string>portal_type_list = [\'Computer Partition\']\n +software_instance = state_change[\'object\']\n +after_tag = (software_instance.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))\n +for object_ in software_instance.getAggregateValueList(portal_type=portal_type_list):\n + object_.activate(after_path_and_method_id=after_tag).updateLocalRolesOnSecurityGroups()\n </string> </value> </item> <item> @@ -80,7 +71,7 @@ for current_delivery_line in sale_packing_list_line_list:\n </item> <item> <key> <string>id</string> </key> - <value> <string>SalePackingList_reindexUnderDestructionComputerPartition</string> </value> + <value> <string>SoftwareInstance_updateAggregateLocalRoles</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_erp5/bt/revision b/master/bt5/vifib_erp5/bt/revision index 1fde7522a771ec6f5d8c6237abe49bac75f547c8..3b7560b75588f49d996dbc79ff93060f7d6492b0 100644 --- a/master/bt5/vifib_erp5/bt/revision +++ b/master/bt5/vifib_erp5/bt/revision @@ -1 +1 @@ -434 \ No newline at end of file +445 \ No newline at end of file diff --git a/master/bt5/vifib_erp5/bt/template_keep_workflow_path_list b/master/bt5/vifib_erp5/bt/template_keep_workflow_path_list index 4802422df38f5c6adb5a874159eda2b6d964a699..53bebdc0f5bf9084090aeab3a96d70547b682b91 100644 --- a/master/bt5/vifib_erp5/bt/template_keep_workflow_path_list +++ b/master/bt5/vifib_erp5/bt/template_keep_workflow_path_list @@ -12,4 +12,4 @@ open_sale_order_module/test_vifib_user_admin_open_sale_order open_sale_order_module/test_vifib_user_developer_open_sale_order service_module/vifib_discount service_module/vifib_tax -service_module/vifib_discount +service_module/vifib_discount \ No newline at end of file diff --git a/master/bt5/vifib_erp5/bt/template_path_list b/master/bt5/vifib_erp5/bt/template_path_list index ad27e6ee18bd704efc53b2492070d9edbbe09ad5..dff8e99205e3b93a1a2815d1c98c355138d5aecb 100644 --- a/master/bt5/vifib_erp5/bt/template_path_list +++ b/master/bt5/vifib_erp5/bt/template_path_list @@ -35,4 +35,4 @@ service_module/computer_registration/** service_module/vifib_discount service_module/vifib_registration service_module/vifib_registration/default_ssl -service_module/vifib_tax +service_module/vifib_tax \ No newline at end of file diff --git a/master/bt5/vifib_erp5/bt/template_portal_type_property_sheet_list b/master/bt5/vifib_erp5/bt/template_portal_type_property_sheet_list index fc4ad5ba00e7184923fd37b1b793bfecb8939250..c439871d6e06c73bff71b66f4d72000869265e0c 100644 --- a/master/bt5/vifib_erp5/bt/template_portal_type_property_sheet_list +++ b/master/bt5/vifib_erp5/bt/template_portal_type_property_sheet_list @@ -1,4 +1,5 @@ Assignment | VifibAssignmentConstraint +Computer Partition | VifibComputerPartitionConstraint Computer | VifibComputerConstraint Email | VifibEmailConstraint Hosting Subscription | VifibHostingSubscriptionConstraint diff --git a/master/bt5/vifib_erp5/bt/template_property_sheet_id_list b/master/bt5/vifib_erp5/bt/template_property_sheet_id_list index ea34eacaf8521d81582deeab7a63307c2bf22c8e..8d14ea4c1286f98f3bbc38a6364ca2b63d63bb77 100644 --- a/master/bt5/vifib_erp5/bt/template_property_sheet_id_list +++ b/master/bt5/vifib_erp5/bt/template_property_sheet_id_list @@ -1,5 +1,6 @@ VifibAssignmentConstraint VifibPersonConstraint +VifibComputerPartitionConstraint VifibEmailConstraint VifibComputerConstraint VifibSoftwareProductConstraint diff --git a/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.catalog_keys.xml b/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.catalog_keys.xml index e700af78d8c04b485e84f51c235db3d92a2e02c8..671c821534fc220398de17c350b6c5d6d64b42a7 100644 --- a/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.catalog_keys.xml +++ b/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_no_workflow_date_object_list.catalog_keys.xml @@ -6,7 +6,7 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: context.getPortalType() in ('Software Instance', 'Slave Instance', 'Computer')</value> + <value>python: context.getPortalType() in ('Software Instance', 'Slave Instance', 'Computer', 'Computer Partition')</value> </item> <item key="_filter_expression_cache_key_archive" type="tuple"> <value>portal_type</value> diff --git a/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.catalog_keys.xml b/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.catalog_keys.xml index b6a7bf18ea0185b757bffeb610c04dfc8bbb83a2..cf2ec46a51c466b450a5595957ba20f707acc95b 100644 --- a/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.catalog_keys.xml +++ b/master/bt5/vifib_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_object_list.catalog_keys.xml @@ -6,7 +6,7 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: context.getPortalType() not in ('Software Instance', 'Slave Instance', 'Computer')</value> + <value>python: context.getPortalType() not in ('Software Instance', 'Slave Instance', 'Computer', 'Computer Partition')</value> </item> <item key="_filter_expression_cache_key_archive" type="tuple"> <value>portal_type</value> diff --git a/master/bt5/vifib_mysql_innodb_catalog/bt/revision b/master/bt5/vifib_mysql_innodb_catalog/bt/revision index c24b6ae77df02a87472b208f251fad88382a2e55..72f523f36edb05f0f59e02607fd52a844817ed85 100644 --- a/master/bt5/vifib_mysql_innodb_catalog/bt/revision +++ b/master/bt5/vifib_mysql_innodb_catalog/bt/revision @@ -1 +1 @@ -38 \ No newline at end of file +39 \ No newline at end of file diff --git a/master/bt5/vifib_open_trade/SkinTemplateItem/portal_skins/vifib_open_trade/HostingSubscriptionModule_viewHostingSubscriptionList/listbox.xml b/master/bt5/vifib_open_trade/SkinTemplateItem/portal_skins/vifib_open_trade/HostingSubscriptionModule_viewHostingSubscriptionList/listbox.xml index e2dc0eebf5d513e4a3f7265be4a084b608a04333..fee04b1f8e7ef4bf5aad1446cb73a6f9befd7b94 100644 --- a/master/bt5/vifib_open_trade/SkinTemplateItem/portal_skins/vifib_open_trade/HostingSubscriptionModule_viewHostingSubscriptionList/listbox.xml +++ b/master/bt5/vifib_open_trade/SkinTemplateItem/portal_skins/vifib_open_trade/HostingSubscriptionModule_viewHostingSubscriptionList/listbox.xml @@ -10,6 +10,7 @@ <key> <string>delegated_list</string> </key> <value> <list> + <string>all_columns</string> <string>columns</string> <string>selection_name</string> <string>title</string> @@ -73,6 +74,37 @@ <key> <string>values</string> </key> <value> <dictionary> + <item> + <key> <string>all_columns</string> </key> + <value> + <list> + <tuple> + <string>title</string> + <string>Title</string> + </tuple> + <tuple> + <string>reference</string> + <string>Reference</string> + </tuple> + <tuple> + <string>translated_validation_state_title</string> + <string>Validation State</string> + </tuple> + <tuple> + <string>translated_slap_state_title</string> + <string>Slap State</string> + </tuple> + <tuple> + <string>creation_date</string> + <string>Creation Date</string> + </tuple> + <tuple> + <string>modification_date</string> + <string>Modification Date</string> + </tuple> + </list> + </value> + </item> <item> <key> <string>columns</string> </key> <value> @@ -85,6 +117,14 @@ <string>reference</string> <string>Reference</string> </tuple> + <tuple> + <string>translated_validation_state_title</string> + <string>Validation State</string> + </tuple> + <tuple> + <string>translated_slap_state_title</string> + <string>Slap State</string> + </tuple> </list> </value> </item> diff --git a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/archived.xml b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/archived.xml index 524938a2c0fdf11541bc1a39a77b477c02457007..a3f22df54bfe761d807d10a66d276c50cc030c58 100644 --- a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/archived.xml +++ b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/archived.xml @@ -6,6 +6,10 @@ </pickle> <pickle> <dictionary> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> <item> <key> <string>id</string> </key> <value> <string>archived</string> </value> @@ -16,6 +20,22 @@ <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> + <item> + <key> <string>title</string> </key> + <value> <string>Archived</string> </value> + </item> + <item> + <key> <string>transitions</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>type_list</string> </key> + <value> + <tuple/> + </value> + </item> </dictionary> </pickle> </record> diff --git a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/draft.xml b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/draft.xml index a4adc9c3b87ab3078c998fab63c8a3d6a40b355a..a59cc02c166164d0a44955b1e7aa8981425fa3ca 100644 --- a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/draft.xml +++ b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/draft.xml @@ -22,7 +22,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string></string> </value> + <value> <string>Draft</string> </value> </item> <item> <key> <string>transitions</string> </key> diff --git a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/validated.xml b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/validated.xml index d8b30f943b8fcdb5febe2d7430079be3fbbc0ad4..6666011a0e903df909044ee60a1a011b1a40f2a8 100644 --- a/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/validated.xml +++ b/master/bt5/vifib_open_trade/WorkflowTemplateItem/portal_workflow/hosting_subscription_workflow/states/validated.xml @@ -22,7 +22,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string></string> </value> + <value> <string>Validated</string> </value> </item> <item> <key> <string>transitions</string> </key> diff --git a/master/bt5/vifib_open_trade/bt/revision b/master/bt5/vifib_open_trade/bt/revision index 6fc1e6e18c45e38dba6c96fe27ed3514edfbb064..a14c1ee5ab423ef2b6365bb156245892bcd7dfa9 100644 --- a/master/bt5/vifib_open_trade/bt/revision +++ b/master/bt5/vifib_open_trade/bt/revision @@ -1 +1 @@ -178 \ No newline at end of file +180 \ No newline at end of file diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/garbage_collect_destroyed_root_tree.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/garbage_collect_destroyed_root_tree.xml new file mode 100644 index 0000000000000000000000000000000000000000..e7a578a02ebd7d5dc1501bf930f81cd4ae96e0f2 --- /dev/null +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/garbage_collect_destroyed_root_tree.xml @@ -0,0 +1,91 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Alarm" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>active_sense_method_id</string> </key> + <value> <string>Alarm_garbageCollectDestroyedRootTree</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>garbage_collect_destroyed_root_tree</string> </value> + </item> + <item> + <key> <string>periodicity_hour</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>periodicity_hour_frequency</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>periodicity_minute</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>periodicity_month</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>periodicity_month_day</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>periodicity_start_date</string> </key> + <value> + <object> + <klass> + <global name="DateTime" module="DateTime.DateTime"/> + </klass> + <tuple> + <none/> + </tuple> + <state> + <tuple> + <float>1340727840.0</float> + <string>GMT</string> + </tuple> + </state> + </object> + </value> + </item> + <item> + <key> <string>periodicity_week</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Alarm</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Garbage Collect Destroyed Root Tree</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_destroy_partition.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_destroy_partition.xml index d4a255656808eb32c5087860882f112ef2ee9998..39bfff6e213de168443a23f2c3b4f07b66de6c16 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_destroy_partition.xml +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_destroy_partition.xml @@ -18,7 +18,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> <int>1</int> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>id</string> </key> diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_update_partition.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_update_partition.xml index ab7ba322dac9eaa8de1dde50168d042b5935022e..eb6ce930f694ac92ae514f87a03c4734e7fbbc3f 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_update_partition.xml +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_cancel_update_partition.xml @@ -18,7 +18,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> <int>1</int> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>id</string> </key> diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_check_consistency.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_check_consistency.xml index c14b639e40b4e432b62535e040c080c40f639582..a0cd04f2c4ded3bc803c72951490326926f6ea49 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_check_consistency.xml +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_check_consistency.xml @@ -252,9 +252,7 @@ </item> <item> <key> <string>solve_method_id</string> </key> - <value> - <none/> - </value> + <value> <string>Alarm_activateFixConsistency</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_clone_destroy_partition.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_clone_destroy_partition.xml index 7805f493fea2dd59edf854832a16dc07cf1d6147..016f0d1f654a233b7c31da5a39ec3ff6c7b53f72 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_clone_destroy_partition.xml +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_clone_destroy_partition.xml @@ -18,7 +18,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> <int>1</int> </value> + <value> <int>0</int> </value> </item> <item> <key> <string>id</string> </key> diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml index e11cd271a56886f53f85bf4b1936e6abb15fe4e3..28eb391f0839ee04de5e86049800dcb4e133cd5e 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml +++ b/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/vifib_set_priority_one_message_table.xml @@ -18,7 +18,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> <int>0</int> </value> + <value> <int>1</int> </value> </item> <item> <key> <string>id</string> </key> diff --git a/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_id_property.xml b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_id_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..4b8b271aac80df6b5b89ac3e68ab461435e7037e --- /dev/null +++ b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_id_property.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>mode</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Facebook application id.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>preferred_vifib_facebook_application_id_property</string> </value> + </item> + <item> + <key> <string>mode</string> </key> + <value> <string>w</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>preference</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + <item> + <key> <string>write_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_secret_property.xml b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_secret_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..7097702a13a7e06271669b5dcdff38ce8d418092 --- /dev/null +++ b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_facebook_application_secret_property.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>mode</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Facebook application secret.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>preferred_vifib_facebook_application_secret_property</string> </value> + </item> + <item> + <key> <string>mode</string> </key> + <value> <string>w</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>preference</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + <item> + <key> <string>write_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_id_property.xml b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_id_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..4f57bd07b20c6b4a8560232c1b23553c852e6d41 --- /dev/null +++ b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_id_property.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>mode</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Google application id.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>preferred_vifib_google_application_id_property</string> </value> + </item> + <item> + <key> <string>mode</string> </key> + <value> <string>w</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>preference</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + <item> + <key> <string>write_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_secret_property.xml b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_secret_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..25afb69ab7ce4ea22e064b219f993c8c5fcdff93 --- /dev/null +++ b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_google_application_secret_property.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>mode</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>Facebook application secret.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>preferred_vifib_google_application_secret_property</string> </value> + </item> + <item> + <key> <string>mode</string> </key> + <value> <string>w</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>preference</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + <item> + <key> <string>write_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_rest_api_login_check_property.xml b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_rest_api_login_check_property.xml new file mode 100644 index 0000000000000000000000000000000000000000..3efc243b6a9ca3290b976045a36456ff566478f7 --- /dev/null +++ b/master/bt5/vifib_slap/PropertySheetTemplateItem/portal_property_sheets/VifibSystemPreference/preferred_vifib_rest_api_login_check_property.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Standard Property" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>mode</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>string</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>categories</string> </key> + <value> + <tuple> + <string>elementary_type/string</string> + </tuple> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string>URL to Vifib REST API used to check external login user presence.</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>preferred_vifib_rest_api_login_check_property</string> </value> + </item> + <item> + <key> <string>mode</string> </key> + <value> <string>w</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Standard Property</string> </value> + </item> + <item> + <key> <string>preference</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>property_default</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + <item> + <key> <string>write_permission</string> </key> + <value> <string>Manage properties</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_confirmOrderedSaleOrder.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_confirmOrderedSaleOrder.xml index 2e2031ab9bb9d68283ad5c95d8493b28f7b0791c..a899e55fe1d7289a2a711e5928efca7d8800234b 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_confirmOrderedSaleOrder.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_confirmOrderedSaleOrder.xml @@ -58,6 +58,7 @@ portal.portal_catalog.searchAndActivate(\n default_resource_uid=portal.restrictedTraverse(setup_service).getUid(),\n simulation_state="ordered",\n method_id=\'SaleOrderLine_tryToAllocatePartition\',\n + packet_size=1, # Separate calls to many transactions\n activate_kw={\'tag\': tag}\n )\n \n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_destroySeleniumTesterKvmInstance.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_destroySeleniumTesterKvmInstance.xml index eb790ea1819c07af9a75142e13418ed246083c7d..758784ce6e9af7fef3a595e0a880387f0954de37 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_destroySeleniumTesterKvmInstance.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_destroySeleniumTesterKvmInstance.xml @@ -65,6 +65,7 @@ setup_service = portal.restrictedTraverse(portal.portal_preferences.getPreferred portal.portal_catalog.searchAndActivate(\n portal_type="Hosting Subscription",\n owner=person_reference,\n + validation_state="validated",\n method_id=\'HostingSubcription_requestDestructionSeleniumTester\',\n method_kw={\'tag\': tag},\n activate_kw={\'tag\': tag},\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_garbageCollectDestroyedRootTree.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_garbageCollectDestroyedRootTree.xml new file mode 100644 index 0000000000000000000000000000000000000000..845be513398c89f77df1305c509bb2b80f71d1d8 --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_garbageCollectDestroyedRootTree.xml @@ -0,0 +1,77 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>portal = context.getPortalObject()\n +\n +portal.portal_catalog.searchAndActivate(\n + portal_type=["Slave Instance", "Software Instance"],\n + validation_state="validated",\n + specialise_validation_state="archived",\n + method_id=\'Instance_tryToGarbageCollect\',\n + activate_kw={\'tag\': tag}\n +)\n +\n +context.activate(after_tag=tag).getId()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>tag, fixit, params</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Alarm_garbageCollectDestroyedRootTree</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_updatePersonOpenOrder.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_updatePersonOpenOrder.xml index 19012246a2ab72d026fc8fa6761175835ce0a6b0..657b8c030cf3173eabc1b61c14770109b3f67c0e 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_updatePersonOpenOrder.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Alarm_updatePersonOpenOrder.xml @@ -56,12 +56,12 @@ kw = {}\n search_kw = {}\n from DateTime import DateTime\n from Products.ZSQLCatalog.SQLCatalog import Query\n -from Products.ERP5Type.DateUtils import getClosestDate, addToDate\n +from Products.ERP5Type.DateUtils import addToDate\n \n last_active_process = context.getLastActiveProcess()\n -if last_active_process is not None and params.get(\'full\', False):\n +if last_active_process is not None and not(params.get(\'full\', False)):\n # fetch only objects modified since last alarm run\n - kw[\'modification_date\'] = Query(modification_date=last_active_process.getStartDate(), range="min")\n + kw[\'modification_date\'] = last_active_process.getStartDate()\n search_kw[\'modification_date\'] = Query(modification_date=addToDate(last_active_process.getStartDate(), to_add={\'hour\': -1}), range="min")\n # register active process in order to have "windows" of last indexed objects\n context.newActiveProcess()\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml index f88647a974fabf4835de1f62ade591a467838236..bcc9a3f7aad177249e7cd505075b8371adb5c3c9 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Computer_updateFromDict.xml @@ -85,7 +85,7 @@ \n # Getting existing partitions\n existing_partition_dict = {}\n -for c in context.contentValues():\n +for c in context.contentValues(portal_type="Computer Partition"):\n existing_partition_dict[c.getReference()] = c\n \n # update computer data\n @@ -94,18 +94,31 @@ context.edit(\n )\n \n compareAndUpdateAddressList(context, [{\'addr\': computer_dict[\'address\'], \'netmask\': computer_dict[\'netmask\']}])\n +expected_partition_dict = {}\n for send_partition in computer_dict[\'partition_list\']:\n partition = existing_partition_dict.get(send_partition[\'reference\'], None)\n + expected_partition_dict[send_partition[\'reference\']] = True\n if partition is None:\n partition = context.newContent(portal_type=\'Computer Partition\')\n partition.validate()\n partition.markFree()\n elif partition.getSlapState() == \'inactive\':\n # Reactivate partition\n - partition.markFree()\n + partition.markFree(comment="Reactivated by slapformat")\n +\n + if partition.getValidationState() == "invalidated":\n + partition.validate(comment="Reactivated by slapformat")\n partition.edit(reference=send_partition[\'reference\'])\n network_interface = send_partition[\'tap\'][\'name\']\n compareAndUpdateAddressList(partition, send_partition[\'address_list\'], {\'network_interface\': network_interface})\n +\n +# Desactivate all other partitions\n +for key, value in existing_partition_dict.items():\n + if key not in expected_partition_dict:\n + if value.getSlapState() == "free":\n + value.markInactive(comment="Desactivated by slapformat")\n + if value.getValidationState() == "validated":\n + value.invalidate(comment="Desactivated by slapformat")\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/ComuterPartition_getSoftwareInstanceStatus.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/ComuterPartition_getSoftwareInstanceStatus.xml new file mode 100644 index 0000000000000000000000000000000000000000..24219c10460023c369fed8d57172272656696c21 --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/ComuterPartition_getSoftwareInstanceStatus.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>software_instance = context.getAggregateRelatedValue(portal_type=\'Software Instance\')\n +if software_instance is not None:\n + return software_instance.SoftwareInstance_getStatus()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ComuterPartition_getSoftwareInstanceStatus</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubcription_requestDestructionSeleniumTester.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubcription_requestDestructionSeleniumTester.xml index 3f40eab0316f4c41c80daee9b2e4aaa3fc99e474..a5b45f3746b2301ad19f7746b3ef3e0044f9d4f5 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubcription_requestDestructionSeleniumTester.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/HostingSubcription_requestDestructionSeleniumTester.xml @@ -58,10 +58,21 @@ hosting_subscription = context\n \n now = DateTime()\n \n -if hosting_subscription.getAggregateRelatedValue(portal_type=\'Sale Order Line\').getParentValue().getDestinationSectionValue().getReference() == \'seleniumtester\' and \\\n +if hosting_subscription.getDestinationSectionValue().getReference() == \'seleniumtester\' and \\\n hosting_subscription.getModificationDate() < (now - 1):\n - if hosting_subscription.SoftwareInstance_getStatus() not in [\'Destroyed\', \'Destruction in progress\']:\n - hosting_subscription.requestDestroy(comment=\'Requested by clenaup alarm\', activate_kw={\'tag\': tag})\n +\n + person = hosting_subscription.getDestinationSectionValue(portal_type="Person")\n + person.requestSoftwareInstance(\n + software_release=hosting_subscription.getRootSoftwareReleaseUrl(),\n + instance_xml=hosting_subscription.getTextContent(),\n + software_type=hosting_subscription.getSourceReference(),\n + sla_xml=hosting_subscription.getSlaXml(),\n + shared=hosting_subscription.getRootSlave(),\n + state="destroyed",\n + software_title=hosting_subscription.getTitle(),\n + comment=\'Requested by clenaup alarm\', \n + activate_kw={\'tag\': tag}\n + )\n ]]></string> </value> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Instance_tryToGarbageCollect.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Instance_tryToGarbageCollect.xml new file mode 100644 index 0000000000000000000000000000000000000000..90619c7ed2811d5c527d342c4d4c6c12961d3c35 --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Instance_tryToGarbageCollect.xml @@ -0,0 +1,95 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = context\n +\n +if (instance.getSlapState() != "destroy_requested"):\n + hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n + if (hosting_subscription.getValidationState() == "archived"):\n + # Buildout didn\'t propagate the destruction request\n + requester = instance.getPredecessorRelatedValue()\n + if (instance.getRelativeUrl() in requester.getPredecessorList()) and \\\n + (requester.getSlapState() == "destroy_requested"):\n + # For security, only destroyed if parent is also destroyed\n +\n + if instance.getPortalType() == \'Software Instance\':\n + is_slave = False\n + elif instance.getPortalType() == \'Slave Instance\':\n + is_slave = True\n + else:\n + raise NotImplementedError, "Unknow portal type %s of %s" % \\\n + (instance.getPortalType(), instance.getRelativeUrl())\n +\n + requester.requestInstance(\n + software_release=instance.getRootSoftwareReleaseUrl(),\n + software_title=instance.getTitle(),\n + software_type=instance.getSourceReference(),\n + instance_xml=instance.getTextContent(),\n + sla_xml=instance.getSlaXml(),\n + shared=is_slave,\n + state="destroyed",\n + comment="Garbage collect %s" % instance.getRelativeUrl()\n + )\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Instance_tryToGarbageCollect</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml index 4221ac493703251be670036849ace1ed4dbbb49e..77a179744aa43b78fba5c6db8ba472054d2427fb 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/Person_storeOpenOrderJournal.xml @@ -51,12 +51,12 @@ <item> <key> <string>_body</string> </key> <value> <string>from Products.ZSQLCatalog.SQLCatalog import Query\n +from Products.ERP5Type.DateUtils import addToDate\n portal = context.getPortalObject()\n \n kw = {}\n if modification_date is not None:\n - kw[\'modification_date\'] = Query(modification_date=modification_date, range="min")\n -\n + kw[\'modification_date\'] = Query(modification_date=addToDate(modification_date, to_add={\'hour\': -1}), range="min")\n remove_hosting_list = []\n add_kw_list = []\n start_date_tuple_list = []\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleInvoiceTransaction_confirmPlanned.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleInvoiceTransaction_confirmPlanned.xml index 409f85089248f822d3f86cf416ac9561beb24770..df4bea03a5180ac7cb610d4cffbffc50668acf70 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleInvoiceTransaction_confirmPlanned.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleInvoiceTransaction_confirmPlanned.xml @@ -53,8 +53,16 @@ <value> <string encoding="cdata"><![CDATA[ isTransitionPossible = context.getPortalObject().portal_workflow.isTransitionPossible\n -if context.getSimulationState() == \'planned\' and context.getStartDate() < this_month and isTransitionPossible(context, \'confirm\'):\n - context.confirm()\n +if context.getSimulationState() == \'planned\' and context.getStartDate() < this_month:\n + if len(context.getMovementList()) > 0:\n + if isTransitionPossible(context, \'confirm\'):\n + context.confirm(comment=\'Confirmed as ready to be accounted.\')\n + # as user will not have any invoice in planned state create new one, a bit later, in order to have current state reindexed\n + context.getDestinationValue().activate(after_path_and_method_id=(context.getPath(), (\'recursiveImmediateReindexObject\', \'immediateReindexObject\'))).fixConsistency()\n + else:\n + old_date = context.getStartDate()\n + context.setStartDate(this_month)\n + context.portal_workflow.doActionFor(context, \'edit_action\', comment=\'Moved date from %s to %s in order to move to new month.\' % (old_date, context.getStartDate()))\n ]]></string> </value> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml index 41cd2a550524eb1eb45d502155cc2019bdf8943f..3b00a90e8650730b97d3aba3fbf6c00cdbedcc16 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SaleOrderLine_tryToAllocatePartition.xml @@ -100,9 +100,9 @@ if sale_order.getSimulationState() == \'ordered\':\n except ValueError:\n # It was not possible to find free Computer Partition\n markHistory(sale_order, \'Not confirmed: no free Computer Partition\')\n - except Unauthorized:\n + except Unauthorized, e:\n # user has bad balance\n - markHistory(sale_order, \'Not confirmed: user has bad balance\')\n + markHistory(sale_order, \'Not confirmed: %s\' % e)\n else:\n if computer_partition is not None:\n try:\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SalePackingListLine_checkAndCloneCleanupPartition.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SalePackingListLine_checkAndCloneCleanupPartition.xml index 9a837d01ae41a327e2c1055ab45b473589898d20..05f365eeaa99809ed945e0a3ee0905af3c369623 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SalePackingListLine_checkAndCloneCleanupPartition.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SalePackingListLine_checkAndCloneCleanupPartition.xml @@ -94,6 +94,7 @@ if newer_newest_movement is not None:\n new_cleanup_delivery = cleanup_delivery.Base_createCloneDocument(batch_mode=1)\n new_cleanup_delivery.setStartDate(DateTime())\n cleanup_delivery.cancel(comment=\'Cancelled as newer clone is created: %s\' % new_cleanup_delivery.getPath())\n + new_cleanup_delivery.startBuilding()\n new_cleanup_delivery.confirm(comment=\'Replaced too old cleanup delivery: %s\' % cleanup_delivery.getPath())\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getDefaultImageAbsoluteUrl.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getDefaultImageAbsoluteUrl.xml index 8ed24fec27feaa3b99f76060e5b620ba68b69664..1a841120075e26d7f9e621214ca4c1da3350b544 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getDefaultImageAbsoluteUrl.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getDefaultImageAbsoluteUrl.xml @@ -54,7 +54,7 @@ delivery_line = context\n else:\n delivery = context.getCausalityValue(portal_type=["Sale Order", "Sale Packing List"])\n - delivery_line = context.contentValues(portal_type=["Sale Order Line", "Sale Packing List Line"])[0]\n + delivery_line = delivery.contentValues(portal_type=["Sale Order Line", "Sale Packing List Line"])[0]\n \n software_release = delivery_line.getAggregateValue(portal_type=\'Software Release\')\n if software_release is not None:\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getStatus.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getStatus.xml index 4cb41509f2feb29697eb91024dee82cd3223cb8f..f44b2bbcde2f17f13660cb19b689a0e31c13fb6c 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getStatus.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_getStatus.xml @@ -53,6 +53,8 @@ <value> <string>"""Dirty script to return Software Instance state"""\n if context.getPortalType() == "Sale Order Line":\n return "Under Approval"\n +elif context.getPortalType() == "Hosting Subscription":\n + return context.getSlapStateTitle()\n else:\n state = context.getSlapState()\n has_partition = context.getAggregate(portal_type="Computer Partition")\n diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_requestDestruction.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_requestDestruction.xml index c227afb3eddc2e65bf0203b164b9f0d48d6b4775..a7de0b9b0bf4e3babd8b60ab9ca0f098b3ed8444 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_requestDestruction.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SoftwareInstance_requestDestruction.xml @@ -69,7 +69,7 @@ promise_kw = {\n }\n \n if context.getPortalObject().portal_workflow.isTransitionPossible(context, \'request_destroy\'):\n - context.requestDestroy(**promise_kw)\n + context.requestDestroy(comment="Garbage collected because Hosting Subscription is archived", **promise_kw)\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib.xml index ba57d364247de735c808530e85a487536a6f7f6f..6edfd04eacc345af08ca9c43431f8d8357015594 100644 --- a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib.xml +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib.xml @@ -110,7 +110,13 @@ <item> <key> <string>right</string> </key> <value> - <list/> + <list> + <string>my_preferred_vifib_facebook_application_id</string> + <string>my_preferred_vifib_facebook_application_secret</string> + <string>my_preferred_vifib_rest_api_login_check</string> + <string>my_preferred_vifib_google_application_id</string> + <string>my_preferred_vifib_google_application_secret</string> + </list> </value> </item> </dictionary> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_id.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_id.xml new file mode 100644 index 0000000000000000000000000000000000000000..9bf0548554a78bb5bdf4162a224b7907927c3c5b --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_id.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_vifib_facebook_application_id</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Preferred Facebook Application Id</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_secret.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_secret.xml new file mode 100644 index 0000000000000000000000000000000000000000..42ea6ab78b92dec1a001cd463913c41e075e5264 --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_facebook_application_secret.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_vifib_facebook_application_secret</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Preferred Facebook Application Secret</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_id.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_id.xml new file mode 100644 index 0000000000000000000000000000000000000000..65a1d8f319bcf5df2c53e18b6f44df10c69d09d9 --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_id.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_vifib_google_application_id</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Preferred Google Application Id</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_secret.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_secret.xml new file mode 100644 index 0000000000000000000000000000000000000000..bae82d503d683fdf5fec8d11266f4cff70b77f2c --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_google_application_secret.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_vifib_google_application_secret</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Preferred Google Application Secret</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_rest_api_login_check.xml b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_rest_api_login_check.xml new file mode 100644 index 0000000000000000000000000000000000000000..f2765a95c656379c65949afb4bcc225d450054ca --- /dev/null +++ b/master/bt5/vifib_slap/SkinTemplateItem/portal_skins/vifib_slap/SystemPreference_viewVifib/my_preferred_vifib_rest_api_login_check.xml @@ -0,0 +1,96 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ProxyField" module="Products.ERP5Form.ProxyField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>delegated_list</string> </key> + <value> + <list> + <string>title</string> + </list> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>my_preferred_vifib_rest_api_login_check</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>field_id</string> </key> + <value> <string>my_string_field</string> </value> + </item> + <item> + <key> <string>form_id</string> </key> + <value> <string>Base_viewFieldLibrary</string> </value> + </item> + <item> + <key> <string>target</string> </key> + <value> <string>Click to edit the target</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Preferred Vifib REST API URL for login check</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestRegistration.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestRegistration.xml index cef58da93ca060641586ef4424debeae9ca87f29..81fb14b2ec6f642b10a1a354b16bc996755c6c20 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestRegistration.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestRegistration.xml @@ -66,7 +66,6 @@ internal_packing_list_module = portal.restrictedTraverse(internal_packing_list_i internal_packing_list = internal_packing_list_module.newContent(\n portal_type=\'Internal Packing List\',\n )\n -\n # User has to access his person profile\n person_value = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n # Edit IPL data\n @@ -93,6 +92,8 @@ internal_packing_list_line = internal_packing_list.newContent(\n internal_packing_list.portal_workflow.doActionFor(internal_packing_list, \'confirm_action\')\n internal_packing_list.portal_workflow.doActionFor(internal_packing_list, \'stop_action\')\n \n +internal_packing_list.startBuilding()\n +\n computer.createComputerRegistration(internal_packing_list_url=internal_packing_list.getRelativeUrl())\n </string> </value> </item> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml index cecbeb18128909440416d69bf990bccef14701ec..7ef822606a2e2fb4a48fcdd10557eed6b57abeb3 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/computer_slap_interface_workflow/scripts/Computer_requestSoftwareReleaseChange.xml @@ -52,6 +52,7 @@ <key> <string>_body</string> </key> <value> <string encoding="cdata"><![CDATA[ +from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n computer = state_change[\'object\']\n # Get required arguments\n kwargs = state_change.kwargs\n @@ -74,7 +75,27 @@ if portal.portal_activities.countMessageWithTag(tag) > 0:\n raise NotImplementedError(\'In progress\')\n activate_kw = {\'tag\': tag}\n \n -if len(context.Computer_getSoftwarePackingListLineList(state_change, service_uid_list=[service_uid])) > 0:\n +state_list = []\n +state_list.extend(portal.getPortalReservedInventoryStateList())\n +state_list.extend(portal.getPortalTransitInventoryStateList())\n +state_list.extend([\'stopped\', \'delivered\'])\n +\n +current_delivery_line = portal.portal_catalog.getResultValue(\n + portal_type=\'Purchase Packing List Line\',\n + simulation_state=state_list,\n + default_resource_uid=[\n + portal.restrictedTraverse(portal.portal_preferences.getPreferredSoftwareCleanupResource()).getUid(),\n + portal.restrictedTraverse(portal.portal_preferences.getPreferredSoftwareSetupResource()).getUid(),\n + ],\n + sort_on=((\'movement.start_date\', \'DESC\'),),\n + aggregate_relative_url=ComplexQuery(\n + Query(aggregate_relative_url=software_release_document.getRelativeUrl()),\n + Query(aggregate_relative_url=computer.getRelativeUrl()),\n + operator="AND"),\n + limit=1\n +)\n +\n +if current_delivery_line is not None and current_delivery_line.getResourceUid() == service_uid and current_delivery_line.getSimulationState() not in [\'stopped\', \'delivered\']:\n # change installation in progress\n return\n \n @@ -105,6 +126,7 @@ packing_list.newContent(\n )\n \n packing_list.confirm(activate_kw=activate_kw)\n +packing_list.startBuilding()\n ]]></string> </value> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml index 29c0407d2e5c2dce9c7b7e2583a75b1157930f32..2b103aebb20eb0042e35ca9377bc4d9407c5dba9 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/person_slap_interface_workflow/scripts/Person_requestSoftwareInstance.xml @@ -73,6 +73,23 @@ except KeyError:\n if is_slave not in [True, False]:\n raise ValueError, "shared should be a boolean"\n \n +empty_parameter = """<?xml version="1.0" encoding="utf-8"?>\n +<instance>\n +</instance>"""\n +empty_parameter2 = """<?xml version=\'1.0\' encoding=\'utf-8\'?>\n +<instance/>"""\n +\n +\n +# XXX Hardcode default parameter\n +if (instance_xml == empty_parameter) or (instance_xml.startswith(empty_parameter2)):\n + if software_release_url_string == "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5-frontend:/software/erp5/software.cfg": \n + instance_xml = """<?xml version="1.0" encoding="utf-8"?>\n +<instance>\n +<parameter id="frontend-instance-guid">SOFTINST-9238</parameter>\n +<parameter id="frontend-software-url">http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg</parameter>\n +</instance>\n +"""\n +\n hosting_subscription_portal_type = "Hosting Subscription"\n \n tag = "%s_%s_inProgress" % (person.getUid(), \n @@ -86,13 +103,13 @@ if (portal.portal_activities.countMessageWithTag(tag) > 0):\n # Check if it already exists\n request_hosting_subscription_list = portal.portal_catalog(\n portal_type=hosting_subscription_portal_type,\n - title=software_title,\n + title={\'query\': software_title, \'key\': \'ExactMatch\'},\n validation_state="validated",\n - default_destination_section=person.getRelativeUrl(),\n + default_destination_section_uid=person.getUid(),\n limit=2,\n )\n if len(request_hosting_subscription_list) > 1:\n - raise NotImplementedError, "Too many hosting subscription %s found" % software_title\n + raise NotImplementedError, "Too many hosting subscription %s found %s" % (software_title, [x.path for x in request_hosting_subscription_list])\n elif len(request_hosting_subscription_list) == 1:\n request_hosting_subscription = request_hosting_subscription_list[0].getObject()\n if (request_hosting_subscription.getSlapState() == "destroy_requested") or \\\n diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/Person_fixConsistency.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/Person_fixConsistency.xml index 354e8c1c6f748380d9e646bf9173944ebb138210..cc13c3f99a55060843c6138c95fb151ca3f43f3a 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/Person_fixConsistency.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/Person_fixConsistency.xml @@ -34,6 +34,7 @@ <key> <string>before_commit_script_name</string> </key> <value> <list> + <string>Person_createOngoingInvoice</string> <string>Person_createOpenOrder</string> <string>Person_createRegistrationInvoice</string> </list> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SalePackingList_changeDestructionState.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SoftwareInstance_changeState.xml similarity index 86% rename from master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SalePackingList_changeDestructionState.xml rename to master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SoftwareInstance_changeState.xml index fc973a0b1c7fabf0e5714447d22d7cf7fa66c8ad..919840a2df634657121adbfc82b6540efe79da2e 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SalePackingList_changeDestructionState.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/SoftwareInstance_changeState.xml @@ -27,15 +27,15 @@ <item> <key> <string>after_script_name</string> </key> <value> - <list> - <string>SalePackingList_reindexUnderDestructionComputerPartition</string> - </list> + <tuple/> </value> </item> <item> <key> <string>before_commit_script_name</string> </key> <value> - <tuple/> + <list> + <string>SoftwareInstance_reindexComputerPartition</string> + </list> </value> </item> <item> @@ -50,16 +50,15 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>SalePackingList_changeDestructionState</string> </value> + <value> <string>SoftwareInstance_changeState</string> </value> </item> <item> <key> <string>method_id</string> </key> <value> <list> - <string>confirm</string> - <string>start</string> - <string>stop</string> - <string>deliver</string> + <string>requestStart</string> + <string>requestStop</string> + <string>requestDestroy</string> </list> </value> </item> @@ -71,7 +70,7 @@ <key> <string>portal_type_filter</string> </key> <value> <list> - <string>Sale Packing List</string> + <string>Software Instance</string> </list> </value> </item> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/change_instance_parameter.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/change_instance_parameter.xml new file mode 100644 index 0000000000000000000000000000000000000000..706d464ad2af46d130c604437e64bc137b738ec1 --- /dev/null +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/interactions/change_instance_parameter.xml @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="InteractionDefinition" module="Products.ERP5.Interaction"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>actbox_category</string> </key> + <value> <string>workflow</string> </value> + </item> + <item> + <key> <string>actbox_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>actbox_url</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>activate_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>after_script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>before_commit_script_name</string> </key> + <value> + <list> + <string>Instance_changePromiseParameter</string> + </list> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>guard</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>change_instance_parameter</string> </value> + </item> + <item> + <key> <string>method_id</string> </key> + <value> + <list> + <string>_setRootSoftwareReleaseUrl</string> + <string>_setTextContent</string> + <string>_setSourceReference</string> + <string>_setSlaXml</string> + </list> + </value> + </item> + <item> + <key> <string>once_per_transaction</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>portal_type_filter</string> </key> + <value> + <list> + <string>Slave Instance</string> + <string>Software Instance</string> + </list> + </value> + </item> + <item> + <key> <string>script_name</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>temporary_document_disallowed</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>trigger_type</string> </key> + <value> <int>2</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml new file mode 100644 index 0000000000000000000000000000000000000000..3d761ad777b4e52a6f53e1c44577692d84390da7 --- /dev/null +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = state_change[\'object\']\n +instance.bang(bang_tree=False, comment="Parameter changed")\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Instance_changePromiseParameter</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createOngoingInvoice.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createOngoingInvoice.xml new file mode 100644 index 0000000000000000000000000000000000000000..f08c3be67b09f692b2bb4f19f3309bc348361e5a --- /dev/null +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createOngoingInvoice.xml @@ -0,0 +1,99 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>person = state_change[\'object\']\n +portal = person.getPortalObject()\n +\n +invoice = portal.portal_catalog.getResultValue(\n + portal_type="Sale Invoice Transaction",\n + # XXX Hardcoded\n + simulation_state=["planned"],\n + default_destination_uid=person.getUid())\n +\n +if invoice is None:\n + tag = \'%s_createOngoingInvoice\' % person.getUid()\n + kw = {\'activate_kw\': {\'tag\': tag}}\n +\n + if portal.portal_activities.countMessageWithTag(tag) == 0:\n +\n + invoice = portal.accounting_module.newContent(\n + portal_type=\'Sale Invoice Transaction\',\n + start_date=DateTime(),\n + resource=\'currency_module/EUR\',\n + price_currency=\'currency_module/EUR\',\n + source_section=\'organisation_module/vifib_internet\',\n + source=\'organisation_module/vifib_internet\',\n + destination_section=person.getRelativeUrl(),\n + destination_decision=person.getRelativeUrl(),\n + destination=person.getRelativeUrl(),\n + specialise=\'sale_trade_condition_module/vifib_trade_condition\',\n + created_by_builder=1, # XXX to prevent init script to create lines\n + **kw\n + )\n +\n + # force tracking causality state\n + invoice.startBuilding()\n + invoice.plan(comment=\'Initialised by fixing consistency.\', **kw)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Person_createOngoingInvoice</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createRegistrationInvoice.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createRegistrationInvoice.xml index b25e60890a6219f74dfd23ba99d90ed166ceaf13..8ab3d426f3b4538eac026f559749dc761e170d51 100644 --- a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createRegistrationInvoice.xml +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/Person_createRegistrationInvoice.xml @@ -57,7 +57,7 @@ invoice_line = portal.portal_catalog.getResultValue(\n resource_relative_url=portal.portal_preferences.getPreferredRegistrationResource(),\n portal_type="Invoice Line",\n # XXX Hardcoded\n - simulation_state=["stopped", "delivered"],\n + simulation_state=["confirmed", "stopped", "delivered"],\n **{\'movement.destination_uid\': person.getUid()})\n \n if invoice_line is None:\n @@ -92,8 +92,8 @@ if invoice_line is None:\n \n # force tracking causality state\n invoice.startBuilding()\n - invoice.plan(**kw)\n - invoice.confirm(**kw)\n + invoice.plan(comment=\'Initialised by fixing consistency.\', **kw)\n + invoice.confirm(comment=\'Initialised by fixing consistency.\', **kw)\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.xml b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.xml new file mode 100644 index 0000000000000000000000000000000000000000..ad29a84aa98c8e16be10436b95cc95924f3a6115 --- /dev/null +++ b/master/bt5/vifib_slap/WorkflowTemplateItem/portal_workflow/slap_interaction_workflow/scripts/SoftwareInstance_reindexComputerPartition.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = state_change[\'object\']\n +partition = instance.getAggregateValue(portal_type="Computer Partition")\n +if partition is not None:\n + partition.activate(\n + after_path_and_method_id=(instance.getPath(), (\'immediateReindexObject\', \'recursiveImmediateReindexObject\'))).reindexObject()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>_proxy_roles</string> </key> + <value> + <tuple> + <string>Manager</string> + </tuple> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>SoftwareInstance_reindexComputerPartition</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slap/bt/revision b/master/bt5/vifib_slap/bt/revision index 827de6e93391d4316eb67ec07d237454f98f7027..0be467d0c837327421c898ae8e86887424fe9395 100644 --- a/master/bt5/vifib_slap/bt/revision +++ b/master/bt5/vifib_slap/bt/revision @@ -1 +1 @@ -754 \ No newline at end of file +800 \ No newline at end of file diff --git a/master/bt5/vifib_slap/bt/template_path_list b/master/bt5/vifib_slap/bt/template_path_list index 680a5a7df0a8e4abaff64f4d846f30eb589eee74..0f8ccdf402b0af280d701b95a5f27fe9a9486002 100644 --- a/master/bt5/vifib_slap/bt/template_path_list +++ b/master/bt5/vifib_slap/bt/template_path_list @@ -1,8 +1,8 @@ -portal_alarms/cleanup_archived_hs_instances portal_alarms/confirm_ordered_sale_order portal_alarms/confirm_planned_sale_invoice_transaction portal_alarms/deliver_subscription_sale_packing_list portal_alarms/free_computer_partition +portal_alarms/garbage_collect_destroyed_root_tree portal_alarms/stop_confirmed_sale_invoice_transaction portal_alarms/vifib_bang_selenium_tester_instance portal_alarms/vifib_cancel_destroy_partition diff --git a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml index be13d1e8cc76e163d2e41b87220558b752a7a38c..0f198a9d8c6f20b131ec082a4d6d2cff3616c0a0 100644 --- a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml +++ b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseParameter.xml @@ -68,12 +68,13 @@ if (state in (started, stopped)):\n new_delivery = context.Instance_createSalePackingList(state_change, portal.restrictedTraverse(update_service_relative_url))\n else:\n new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n - new_delivery.edit(start_date=DateTime(), stop_date=DateTime())\n + new_delivery.edit(start_date=DateTime(), stop_date=DateTime(), causality_value=None)\n new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=update_service_relative_url)\n new_delivery.confirm()\n new_delivery.start()\n new_delivery.stop()\n new_delivery.deliver()\n + new_delivery.startBuilding()\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml index 35890e1e2a764454a89312a7c926cda2e2348be3..4cefaafc91ad10a3d7b241c4b36db10d0c7b95fe 100644 --- a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml +++ b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_changePromiseState.xml @@ -155,6 +155,7 @@ else:\n packing_list.confirm()\n elif (state == destroyed):\n packing_list.confirm()\n + packing_list.startBuilding()\n \n elif delivery.getPortalType() == "Sale Packing List":\n line_list = delivery.contentValues(portal_type="Sale Packing List Line")\n @@ -164,10 +165,11 @@ else:\n \n def letsclone(service_relative_url):\n new_delivery = delivery.Base_createCloneDocument(batch_mode=1)\n - new_delivery.edit(start_date=DateTime(), stop_date=DateTime())\n + new_delivery.edit(start_date=DateTime(), stop_date=DateTime(), causality_value=None)\n new_delivery.contentValues(portal_type="Sale Packing List Line")[0].edit(resource=service_relative_url)\n return new_delivery\n \n + new_delivery = None\n if (service_relative_url == setup_service_relative_url):\n if (state == started):\n new_delivery = letsclone(hosting_service_relative_url)\n @@ -190,7 +192,8 @@ else:\n new_delivery.confirm()\n instance.edit(causality_value=new_delivery)\n elif (state == stopped):\n - delivery.stop()\n + if isTransitionPossible(delivery, "stop"):\n + delivery.stop()\n elif (state == destroyed):\n if isTransitionPossible(delivery, "stop"):\n delivery.stop()\n @@ -201,12 +204,13 @@ else:\n instance.edit(causality_value=new_delivery)\n else:\n raise NotImplementedError\n -\n elif (service_relative_url == cleanup_service_relative_url):\n raise NotImplementedError, "Not update should be allowed"\n -\n else:\n raise NotImplementedError\n +\n + if new_delivery is not None:\n + new_delivery.startBuilding()\n </string> </value> </item> <item> diff --git a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml index 34010ddaff74ef12f969e6ae79f7e2ae3d6f8118..f882a0d24eaf2a8d682765aa624e49ef09c0b7c9 100644 --- a/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml +++ b/master/bt5/vifib_slapos_accounting/WorkflowTemplateItem/portal_workflow/instance_accounting_slap_interaction_workflow/scripts/Instance_createSalePackingList.xml @@ -80,6 +80,7 @@ packing_list_line = packing_list.newContent(\n price=service.getSaleSupplyLineBasePrice(),\n )\n \n +\n return packing_list\n </string> </value> </item> diff --git a/master/bt5/vifib_slapos_accounting/bt/revision b/master/bt5/vifib_slapos_accounting/bt/revision index dec2bf5d6199c7cd0d84f3dc1e76a73ccc336302..a5c750feac4168f62cfd29aa62b4624f0a430cd5 100644 --- a/master/bt5/vifib_slapos_accounting/bt/revision +++ b/master/bt5/vifib_slapos_accounting/bt/revision @@ -1 +1 @@ -19 \ No newline at end of file +27 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml new file mode 100644 index 0000000000000000000000000000000000000000..fac478a51c289cd996abd02c38c24b56f4371c93 --- /dev/null +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToDestroyed.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = state_change[\'object\']\n +if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'destroy_requested\'):\n + instance.bang(bang_tree=False, comment="State changed from %s to destroy_requested" % instance.getSlapState())\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>RequestedInstance_bangIfStateChangeToDestroyed</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml new file mode 100644 index 0000000000000000000000000000000000000000..a765a1071f6a984fd554f1cec89422d8f0c83705 --- /dev/null +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStarted.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = state_change[\'object\']\n +if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'start_requested\'):\n + instance.bang(bang_tree=False, comment="State changed from %s to start_requested" % instance.getSlapState())\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>RequestedInstance_bangIfStateChangeToStarted</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml new file mode 100644 index 0000000000000000000000000000000000000000..f51ad4e30fd5dba255bfaabaf9d8d692b4e66229 --- /dev/null +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangIfStateChangeToStopped.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>instance = state_change[\'object\']\n +if (instance.getPortalType() in ["Software Instance", "Slave Instance"]) and (instance.getSlapState() != \'stop_requested\'):\n + instance.bang(bang_tree=False, comment="State changed from %s to stop_requested" % instance.getSlapState())\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>state_change</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>RequestedInstance_bangIfStateChangeToStopped</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml index b1ff84541a5700bfa622c2cc1107c2458343bf30..3f77fdad08f0db8fac0a540c9998a4425183d0b5 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequestedInstance_bangInstanceTree.xml @@ -50,19 +50,23 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string>instance = state_change[\'object\']\n + <value> <string>from DateTime import DateTime\n +instance = state_change[\'object\']\n assert instance.getPortalType() in ["Slave Instance", "Software Instance"]\n \n +instance.edit(bang_timestamp=int(DateTime()))\n +\n if state_change.kwargs[\'bang_tree\']:\n from Products.ZSQLCatalog.SQLCatalog import Query, NegatedQuery\n portal = instance.getPortalObject()\n + comment = state_change.kwargs[\'comment\']\n hosting_subscription = instance.getSpecialiseValue(portal_type="Hosting Subscription")\n portal.portal_catalog.searchAndActivate(\n default_specialise_uid=hosting_subscription.getUid(),\n path=NegatedQuery(Query(path=instance.getPath())),\n portal_type=["Slave Instance", "Software Instance"],\n method_id=\'bang\',\n - method_kw={\'bang_tree\': False},\n + method_kw={\'bang_tree\': False, \'comment\': comment},\n )\n </string> </value> </item> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml index e7fa43e58ecd83820873b9972eec141791a7a94a..012c7dde8d6b38ea27b0b4c185c5d61f2ab94e24 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/scripts/RequesterInstance_request.xml @@ -106,7 +106,7 @@ while True:\n request_software_instance_list = portal.portal_catalog(\n # Fetch all portal type, as it is not allowed to change it\n portal_type=["Software Instance", "Slave Instance"],\n - title=software_title,\n + title={\'query\': software_title, \'key\': \'ExactMatch\'},\n specialise_uid=hosting_subscription.getUid(),\n # Do not fetch destroyed instances\n # XXX slap_state=["start_requested", "stop_requested"],\n @@ -122,33 +122,38 @@ else:\n raise ValueError, "Too many instances \'%s\' found: %s" % (software_title, [x.path for x in request_software_instance_list])\n \n if (request_software_instance is None):\n - # First time that the software instance is requested\n - if is_slave == True:\n - software_instance_portal_type = "Slave Instance"\n + if (root_state == "destroyed"):\n + instance_found = False\n else:\n - software_instance_portal_type = "Software Instance"\n - # Create a new one\n - reference = "SOFTINST-%s" % portal.portal_ids.generateNewId(\n - id_group=\'slap_software_instance_reference\',\n - id_generator=\'uid\')\n - certificate_dict = portal.portal_certificate_authority.getNewCertificate(reference)\n -\n - module = portal.getDefaultModule(portal_type="Software Instance")\n - request_software_instance = module.newContent(\n - portal_type=software_instance_portal_type,\n - title=software_title,\n - specialise_value=hosting_subscription,\n - reference=reference,\n - destination_reference=certificate_dict[\'id\'],\n - ssl_key=certificate_dict[\'key\'],\n - ssl_certificate=certificate_dict[\'certificate\'],\n - activate_kw={\'tag\': tag},\n - )\n - # request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n - request_software_instance.validate()\n - graph[request_software_instance.getUid()] = []\n + instance_found = True\n + # First time that the software instance is requested\n + if is_slave == True:\n + software_instance_portal_type = "Slave Instance"\n + else:\n + software_instance_portal_type = "Software Instance"\n + # Create a new one\n + reference = "SOFTINST-%s" % portal.portal_ids.generateNewId(\n + id_group=\'slap_software_instance_reference\',\n + id_generator=\'uid\')\n + certificate_dict = portal.portal_certificate_authority.getNewCertificate(reference)\n +\n + module = portal.getDefaultModule(portal_type="Software Instance")\n + request_software_instance = module.newContent(\n + portal_type=software_instance_portal_type,\n + title=software_title,\n + specialise_value=hosting_subscription,\n + reference=reference,\n + destination_reference=certificate_dict[\'id\'],\n + ssl_key=certificate_dict[\'key\'],\n + ssl_certificate=certificate_dict[\'certificate\'],\n + activate_kw={\'tag\': tag},\n + )\n + # request_software_instance.portal_workflow.doActionFor(request_software_instance, \'validate_action\')\n + request_software_instance.validate()\n + graph[request_software_instance.getUid()] = []\n \n else:\n + instance_found = True\n # Update the predecessor category of the previous requester\n predecessor = request_software_instance.getPredecessorRelatedValue(portal_type="Software Instance")\n if (predecessor is None):\n @@ -161,41 +166,46 @@ else:\n predecessor.edit(predecessor_uid_list=predecessor_uid_list)\n graph[predecessor.getUid()] = predecessor_uid_list\n \n -# Change desired state\n -promise_kw = {\n - \'instance_xml\': instance_xml,\n - \'software_type\': software_type,\n - \'sla_xml\': sla_xml,\n - \'software_release\': software_release_url_string,\n - \'shared\': is_slave,\n -}\n -request_software_instance_url = request_software_instance.getRelativeUrl()\n -context.REQUEST.set(\'request_instance\', request_software_instance)\n -if (root_state == "started"):\n - request_software_instance.requestStart(**promise_kw)\n -elif (root_state == "stopped"):\n - request_software_instance.requestStop(**promise_kw)\n -elif (root_state == "destroyed"):\n - request_software_instance.requestDestroy(**promise_kw)\n - context.REQUEST.set(\'request_instance\', None)\n -else:\n - raise ValueError, "state should be started, stopped or destroyed"\n +if instance_found:\n \n -predecessor_list = requester_instance.getPredecessorList() + [request_software_instance_url]\n -uniq_predecessor_list = list(set(predecessor_list))\n -predecessor_list.sort()\n -uniq_predecessor_list.sort()\n + # Change desired state\n + promise_kw = {\n + \'instance_xml\': instance_xml,\n + \'software_type\': software_type,\n + \'sla_xml\': sla_xml,\n + \'software_release\': software_release_url_string,\n + \'shared\': is_slave,\n + }\n + request_software_instance_url = request_software_instance.getRelativeUrl()\n + context.REQUEST.set(\'request_instance\', request_software_instance)\n + if (root_state == "started"):\n + request_software_instance.requestStart(**promise_kw)\n + elif (root_state == "stopped"):\n + request_software_instance.requestStop(**promise_kw)\n + elif (root_state == "destroyed"):\n + request_software_instance.requestDestroy(**promise_kw)\n + context.REQUEST.set(\'request_instance\', None)\n + else:\n + raise ValueError, "state should be started, stopped or destroyed"\n \n -assert predecessor_list == uniq_predecessor_list, "%s != %s" % (predecessor_list, uniq_predecessor_list)\n + predecessor_list = requester_instance.getPredecessorList() + [request_software_instance_url]\n + uniq_predecessor_list = list(set(predecessor_list))\n + predecessor_list.sort()\n + uniq_predecessor_list.sort()\n \n -# update graph to reflect requested operation\n -graph[requester_instance.getUid()] = requester_instance.getPredecessorUidList() + [request_software_instance.getUid()]\n + assert predecessor_list == uniq_predecessor_list, "%s != %s" % (predecessor_list, uniq_predecessor_list)\n \n -# check if all elements are still connected and if there is no cycle\n -request_software_instance.checkConnected(graph, hosting_subscription.getUid())\n -request_software_instance.checkNotCyclic(graph)\n + # update graph to reflect requested operation\n + graph[requester_instance.getUid()] = requester_instance.getPredecessorUidList() + [request_software_instance.getUid()]\n \n -requester_instance.edit(predecessor_list=predecessor_list)\n + # check if all elements are still connected and if there is no cycle\n + request_software_instance.checkConnected(graph, hosting_subscription.getUid())\n + request_software_instance.checkNotCyclic(graph)\n +\n + requester_instance.edit(predecessor_list=predecessor_list)\n +\n +else:\n + context.REQUEST.set(\'request_instance\', None)\n ]]></string> </value> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml index ee535ac7c6052d649cb2ea329ee9ecea5be5ff79..19cbaf5a58f40a3beafab571548c099dc18a1b2a 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/states/draft.xml @@ -22,6 +22,7 @@ <key> <string>transitions</string> </key> <value> <tuple> + <string>bang</string> <string>request_start</string> <string>request_stop</string> </tuple> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml index 67a723c8c6273235fe890a85221859a278738303..3792cfb867107cfbb383ca208e03c777bdfd9dc8 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_destroy.xml @@ -46,7 +46,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string></string> </value> + <value> <string>RequestedInstance_bangIfStateChangeToDestroyed</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml index c10fc282073783014b4245b5708e3ca6d5488907..d9ac7d29255e7554478660cf636fced91ce1d8ba 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_start.xml @@ -46,7 +46,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string></string> </value> + <value> <string>RequestedInstance_bangIfStateChangeToStarted</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml index 11c249f4962e32e491f0ae97897e770f2e476c68..cd939e8da7791f5135926d1c427842b5f16a8c9c 100644 --- a/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml +++ b/master/bt5/vifib_slapos_core/WorkflowTemplateItem/portal_workflow/instance_slap_interface_workflow/transitions/request_stop.xml @@ -46,7 +46,7 @@ </item> <item> <key> <string>script_name</string> </key> - <value> <string></string> </value> + <value> <string>RequestedInstance_bangIfStateChangeToStopped</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/master/bt5/vifib_slapos_core/bt/revision b/master/bt5/vifib_slapos_core/bt/revision index c24b6ae77df02a87472b208f251fad88382a2e55..f70d7bba4ae1f07682e0358bd7a2068094fc023b 100644 --- a/master/bt5/vifib_slapos_core/bt/revision +++ b/master/bt5/vifib_slapos_core/bt/revision @@ -1 +1 @@ -38 \ No newline at end of file +42 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_core_test/TestTemplateItem/testSlapOSCorePersonRequest.py b/master/bt5/vifib_slapos_core_test/TestTemplateItem/testSlapOSCorePersonRequest.py index 9295bdf251395dd9fcd6e24f2b3fc74f16727cd4..b34938903a598b2ae0adc6193addbb481907c396 100644 --- a/master/bt5/vifib_slapos_core_test/TestTemplateItem/testSlapOSCorePersonRequest.py +++ b/master/bt5/vifib_slapos_core_test/TestTemplateItem/testSlapOSCorePersonRequest.py @@ -2,6 +2,7 @@ from Products.Vifib.tests.testVifibSlapWebService import \ TestVifibSlapWebServiceMixin import transaction +from Products.ERP5Type.tests.backportUnittest import expectedFailure class TestSlapOSCorePersonRequest(TestVifibSlapWebServiceMixin): @@ -324,6 +325,7 @@ class TestSlapOSCorePersonRequest(TestVifibSlapWebServiceMixin): state=state, ) + @expectedFailure def test_Person_requestSoftwareInstance_updateHostingSubscription(self): person = self.getPortalObject().ERP5Site_getAuthenticatedMemberPersonValue() diff --git a/master/bt5/vifib_slapos_core_test/bt/revision b/master/bt5/vifib_slapos_core_test/bt/revision index 9a037142aa3c1b4c490e1a38251620f113465330..9d607966b721abde8931ddd052181fae905db503 100644 --- a/master/bt5/vifib_slapos_core_test/bt/revision +++ b/master/bt5/vifib_slapos_core_test/bt/revision @@ -1 +1 @@ -10 \ No newline at end of file +11 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_v1_preference.xml b/master/bt5/vifib_slapos_rest_api/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_preference.xml similarity index 93% rename from master/bt5/vifib_slapos_rest_api_v1/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_v1_preference.xml rename to master/bt5/vifib_slapos_rest_api/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_preference.xml index 4a758ceed11d62da51fb99f51cf276a97c1253d7..465b3e06630d966b907c9648b24acc3c5432b9b7 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_v1_preference.xml +++ b/master/bt5/vifib_slapos_rest_api/ActionTemplateItem/portal_types/System%20Preference/vifib_rest_api_preference.xml @@ -40,7 +40,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>vifib_rest_api_v1_preference</string> </value> + <value> <string>vifib_rest_api_preference</string> </value> </item> <item> <key> <string>permissions</string> </key> @@ -60,7 +60,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Vifib Rest API V1</string> </value> + <value> <string>Vifib Rest API</string> </value> </item> <item> <key> <string>visible</string> </key> @@ -77,7 +77,7 @@ <dictionary> <item> <key> <string>text</string> </key> - <value> <string>string:${object_url}/SystemPreference_viewVifibRestAPIV1</string> </value> + <value> <string>string:${object_url}/SystemPreference_viewVifibRestAPI</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference.xml b/master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference.xml similarity index 95% rename from master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference.xml rename to master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference.xml index aa00f364ed1fce871d0e0dd8fdee8ee3b4086fbe..f586edcd3e6f935684989fc38c2ba1be903619fd 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference.xml +++ b/master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference.xml @@ -32,7 +32,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>VifibRestAPIV1SystemPreference</string> </value> + <value> <string>VifibRestAPISystemPreference</string> </value> </item> <item> <key> <string>portal_type</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference/preferred_rest_api_v1_token_server_url_property.xml b/master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference/preferred_rest_api_token_server_url_property.xml similarity index 95% rename from master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference/preferred_rest_api_v1_token_server_url_property.xml rename to master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference/preferred_rest_api_token_server_url_property.xml index 25c569415638b687705a4f101cd3bd1ab284524f..57abcfbb0efa04d20449876e17a5c5d706dc01ee 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPIV1SystemPreference/preferred_rest_api_v1_token_server_url_property.xml +++ b/master/bt5/vifib_slapos_rest_api/PropertySheetTemplateItem/portal_property_sheets/VifibRestAPISystemPreference/preferred_rest_api_token_server_url_property.xml @@ -37,7 +37,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>preferred_rest_api_v1_token_server_url_property</string> </value> + <value> <string>preferred_rest_api_token_server_url_property</string> </value> </item> <item> <key> <string>mode</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api.xml similarity index 95% rename from master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml rename to master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api.xml index 83cabbd1dcf106454c91b87320f754f4f040727c..50f11699e48a59790defd94f27048327ff54972d 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1.xml +++ b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api.xml @@ -35,7 +35,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>vifib_slapos_rest_api_v1</string> </value> + <value> <string>vifib_slapos_rest_api</string> </value> </item> <item> <key> <string>title</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI.xml similarity index 93% rename from master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml rename to master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI.xml index 2653835d90e2e8143471cad95b045e2947430629..fb38db1cb1e756ab2af22a2ae8436527cccbc507 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1.xml +++ b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI.xml @@ -93,7 +93,7 @@ <key> <string>left</string> </key> <value> <list> - <string>my_preferred_rest_api_v1_token_server_url</string> + <string>my_preferred_rest_api_token_server_url</string> </list> </value> </item> @@ -108,7 +108,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>SystemPreference_viewVifibRestAPIV1</string> </value> + <value> <string>SystemPreference_viewVifibRestAPI</string> </value> </item> <item> <key> <string>method</string> </key> @@ -116,7 +116,7 @@ </item> <item> <key> <string>name</string> </key> - <value> <string>SystemPreference_viewVifibRestAPIV1</string> </value> + <value> <string>SystemPreference_viewVifibRestAPI</string> </value> </item> <item> <key> <string>pt</string> </key> @@ -132,7 +132,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>Vifib Rest API V1</string> </value> + <value> <string>Vifib Rest API</string> </value> </item> <item> <key> <string>unicode_mode</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI/my_preferred_rest_api_token_server_url.xml similarity index 98% rename from master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml rename to master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI/my_preferred_rest_api_token_server_url.xml index b46c38fb630093fb6f814de6c5234bbb9d4c7798..3d3180f43a550eb737e435284be30195a7f3c5bc 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/SkinTemplateItem/portal_skins/vifib_slapos_rest_api_v1/SystemPreference_viewVifibRestAPIV1/my_preferred_rest_api_v1_token_server_url.xml +++ b/master/bt5/vifib_slapos_rest_api/SkinTemplateItem/portal_skins/vifib_slapos_rest_api/SystemPreference_viewVifibRestAPI/my_preferred_rest_api_token_server_url.xml @@ -17,7 +17,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>my_preferred_rest_api_v1_token_server_url</string> </value> + <value> <string>my_preferred_rest_api_token_server_url</string> </value> </item> <item> <key> <string>message_values</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_v1/ToolTemplateItem/portal_vifib_rest_api_v1.xml b/master/bt5/vifib_slapos_rest_api/ToolTemplateItem/portal_vifib_rest_api.xml similarity index 87% rename from master/bt5/vifib_slapos_rest_api_v1/ToolTemplateItem/portal_vifib_rest_api_v1.xml rename to master/bt5/vifib_slapos_rest_api/ToolTemplateItem/portal_vifib_rest_api.xml index 3a6b758f043b3f5879cab5af64dcb19345835e13..62f60efb77059b1543af8c86569a24da11d16171 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/ToolTemplateItem/portal_vifib_rest_api_v1.xml +++ b/master/bt5/vifib_slapos_rest_api/ToolTemplateItem/portal_vifib_rest_api.xml @@ -2,7 +2,7 @@ <ZopeData> <record id="1" aka="AAAAAAAAAAE="> <pickle> - <global name="Vifib Rest API V1 Tool" module="erp5.portal_type"/> + <global name="Vifib Rest API Tool" module="erp5.portal_type"/> </pickle> <pickle> <dictionary> @@ -33,7 +33,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>portal_vifib_rest_api_v1</string> </value> + <value> <string>portal_vifib_rest_api</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/copyright_list b/master/bt5/vifib_slapos_rest_api/bt/copyright_list similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/copyright_list rename to master/bt5/vifib_slapos_rest_api/bt/copyright_list diff --git a/master/bt5/vifib_slapos_rest_api/bt/dependency_list b/master/bt5/vifib_slapos_rest_api/bt/dependency_list new file mode 100644 index 0000000000000000000000000000000000000000..cdf217389066bb9a1935ec703ffe220d15464a86 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/dependency_list @@ -0,0 +1,2 @@ +vifib_slapos_core +vifib_slapos_rest_api_tool_portal_type \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api/bt/description b/master/bt5/vifib_slapos_rest_api/bt/description new file mode 100644 index 0000000000000000000000000000000000000000..36f53b66870eb7b393a9a80c1d68ffbe723adae9 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/description @@ -0,0 +1 @@ +Tool and shared code for all versions of API. \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/license b/master/bt5/vifib_slapos_rest_api/bt/license similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/license rename to master/bt5/vifib_slapos_rest_api/bt/license diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_format_version b/master/bt5/vifib_slapos_rest_api/bt/revision similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_format_version rename to master/bt5/vifib_slapos_rest_api/bt/revision diff --git a/master/bt5/vifib_slapos_rest_api/bt/template_action_path_list b/master/bt5/vifib_slapos_rest_api/bt/template_action_path_list new file mode 100644 index 0000000000000000000000000000000000000000..16bb67b23c2ffcdf8323544d07cdf03416b175fa --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/template_action_path_list @@ -0,0 +1 @@ +System Preference | vifib_rest_api_preference \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_update_tool b/master/bt5/vifib_slapos_rest_api/bt/template_format_version similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_update_tool rename to master/bt5/vifib_slapos_rest_api/bt/template_format_version diff --git a/master/bt5/vifib_slapos_rest_api/bt/template_property_sheet_id_list b/master/bt5/vifib_slapos_rest_api/bt/template_property_sheet_id_list new file mode 100644 index 0000000000000000000000000000000000000000..002a2616b6c68be546e1d70b4e49fdc45a111241 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/template_property_sheet_id_list @@ -0,0 +1 @@ +VifibRestAPISystemPreference \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api/bt/template_skin_id_list b/master/bt5/vifib_slapos_rest_api/bt/template_skin_id_list new file mode 100644 index 0000000000000000000000000000000000000000..cd870eb4cba5c8f780e180f204d3c50aedf88d04 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/template_skin_id_list @@ -0,0 +1 @@ +vifib_slapos_rest_api \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api/bt/template_tool_id_list b/master/bt5/vifib_slapos_rest_api/bt/template_tool_id_list new file mode 100644 index 0000000000000000000000000000000000000000..01e8a50f9aa33d74d43e16c583ace09a7a3f2fd7 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/template_tool_id_list @@ -0,0 +1 @@ +portal_vifib_rest_api \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api/bt/template_update_tool b/master/bt5/vifib_slapos_rest_api/bt/template_update_tool new file mode 100644 index 0000000000000000000000000000000000000000..56a6051ca2b02b04ef92d5150c9ef600403cb1de --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/template_update_tool @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api/bt/title b/master/bt5/vifib_slapos_rest_api/bt/title new file mode 100644 index 0000000000000000000000000000000000000000..cd870eb4cba5c8f780e180f204d3c50aedf88d04 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api/bt/title @@ -0,0 +1 @@ +vifib_slapos_rest_api \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/version b/master/bt5/vifib_slapos_rest_api/bt/version similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/version rename to master/bt5/vifib_slapos_rest_api/bt/version diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20V1%20Tool.xml b/master/bt5/vifib_slapos_rest_api_tool_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20Tool.xml similarity index 91% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20V1%20Tool.xml rename to master/bt5/vifib_slapos_rest_api_tool_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20Tool.xml index f20d49a28b9a0b4ac0216224352e684f3a4d040b..f6054114aa30a642bc218d0e2c338516104b4c08 100644 --- a/master/bt5/vifib_slapos_rest_api_v1_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20V1%20Tool.xml +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/PortalTypeTemplateItem/portal_types/Vifib%20Rest%20API%20Tool.xml @@ -20,7 +20,7 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>Vifib Rest API V1 Tool</string> </value> + <value> <string>Vifib Rest API Tool</string> </value> </item> <item> <key> <string>init_script</string> </key> @@ -40,7 +40,7 @@ </item> <item> <key> <string>type_class</string> </key> - <value> <string>VifibRestApiV1Tool</string> </value> + <value> <string>VifibRestApiTool</string> </value> </item> <item> <key> <string>type_interface</string> </key> diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/copyright_list b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/copyright_list new file mode 100644 index 0000000000000000000000000000000000000000..35398e283d7106b97bd7415f044f1ac4a67629e0 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/copyright_list @@ -0,0 +1 @@ +2012 Vifib \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/description b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/description similarity index 100% rename from master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/description rename to master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/description diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/license b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/license new file mode 100644 index 0000000000000000000000000000000000000000..3a3e12bcad97e4b3bdd6a8bb499fd23a4bcb0819 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/license @@ -0,0 +1 @@ +GPL \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/revision b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/revision new file mode 100644 index 0000000000000000000000000000000000000000..c7930257dfef505fd996e1d6f22f2f35149990d0 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/revision @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_format_version b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_format_version new file mode 100644 index 0000000000000000000000000000000000000000..56a6051ca2b02b04ef92d5150c9ef600403cb1de --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_format_version @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_portal_type_id_list b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_portal_type_id_list new file mode 100644 index 0000000000000000000000000000000000000000..7e0aa561d0ef6a1d37536b0525d65a0f3fce16ce --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_portal_type_id_list @@ -0,0 +1 @@ +Vifib Rest API Tool \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_update_tool b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_update_tool new file mode 100644 index 0000000000000000000000000000000000000000..56a6051ca2b02b04ef92d5150c9ef600403cb1de --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/template_update_tool @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/title b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/title new file mode 100644 index 0000000000000000000000000000000000000000..96fb77355c6f081d1af67c1e9e23df8c432bba43 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/title @@ -0,0 +1 @@ +vifib_slapos_rest_api_tool_portal_type \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/version b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/version new file mode 100644 index 0000000000000000000000000000000000000000..ceab6e11ece0bcec917c12e11d350946f085d549 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_tool_portal_type/bt/version @@ -0,0 +1 @@ +0.1 \ No newline at end of file diff --git a/master/product/Vifib/Tool/VifibRestApiV1Tool.py b/master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py similarity index 76% rename from master/product/Vifib/Tool/VifibRestApiV1Tool.py rename to master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py index 9f4bc48d289dc2ad32f39d03b0c733baed7f0ba7..41372e2295b0f9b7f483535b7dd0ccef7f42d6b1 100644 --- a/master/product/Vifib/Tool/VifibRestApiV1Tool.py +++ b/master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.py @@ -29,10 +29,8 @@ ############################################################################## from Acquisition import Implicit -from Products.ERP5Type.Tool.BaseTool import BaseTool from AccessControl import ClassSecurityInfo, getSecurityManager, Unauthorized from Products.Vifib.VifibMachineAuthenticationPlugin import getUserByLogin -from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type import Permissions from ComputedAttribute import ComputedAttribute from zLOG import LOG, ERROR @@ -62,7 +60,8 @@ def requireHeader(header_dict): def wrapperRequireHeader(self, *args, **kwargs): problem_dict = {} for header, value in header_dict.iteritems(): - if not re.match(value, self.REQUEST.getHeader(header)): + send_header = self.REQUEST.getHeader(header) + if send_header is None or not re.match(value, send_header): problem_dict[header] = 'Header with value %r is required.' % value if not problem_dict: return fn(self, *args, **kwargs) @@ -75,7 +74,7 @@ def requireHeader(header_dict): return wrapperRequireHeader return outer -def supportModifiedSince(document_url_id=None, modified_property_id=None): +def supportModifiedSince(document_url_id): def outer(fn): def wrapperSupportModifiedSince(self, *args, **kwargs): modified_since = self.REQUEST.getHeader('If-Modified-Since') @@ -91,16 +90,9 @@ def supportModifiedSince(document_url_id=None, modified_property_id=None): # client send date before current time, shall continue and # compare with second precision, as client by default shall set # If-Modified-Since to last known Last-Modified value - document = None - if document_url_id is None and modified_property_id is None: - document = self - elif document_url_id is not None: - document = self.restrictedTraverse(getattr(self, document_url_id)) - else: - document_date = getattr(self, modified_property_id) - if document is not None: - document_date = document.getModificationDate() or \ - document.bobobase_modification_time() + document = self.restrictedTraverse(getattr(self, document_url_id)) + document_date = document.getModificationDate() or \ + document.bobobase_modification_time() if int(document_date.timeTime()) <= int(modified_since.timeTime()): # document was not modified since self.REQUEST.response.setStatus(304) @@ -168,12 +160,18 @@ def responseSupport(anonymous=False): 'GET, OPTIONS') if not anonymous: if getSecurityManager().getUser().getId() is None: - # force login - self.REQUEST.response.setStatus(401) - self.REQUEST.response.setHeader('WWW-Authenticate', 'Bearer realm="%s"'% - self.absolute_url()) - self.REQUEST.response.setHeader('Location', self.getPortalObject()\ - .portal_preferences.getPreferredRestApiV1TokenServerUrl()) + if self.REQUEST.get('USER_CREATION_IN_PROGRESS') is not None: + # inform that user is not ready yet + self.REQUEST.response.setStatus(202) + self.REQUEST.response.setBody(jsonify( + {'status':'User under creation.'})) + else: + # force login + self.REQUEST.response.setStatus(401) + self.REQUEST.response.setHeader('WWW-Authenticate', 'Bearer realm="%s"'% + self.getAPIRoot()) + self.REQUEST.response.setHeader('Location', self.getPortalObject()\ + .portal_preferences.getPreferredRestApiTokenServerUrl()) return self.REQUEST.response else: user_name = self.getPortalObject().portal_membership\ @@ -182,7 +180,7 @@ def responseSupport(anonymous=False): str(user_name)) if len(user_document) != 1: transaction.abort() - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Currenty logged in user %r wrong document list %r.'% (user_name, user_document)) self.REQUEST.response.setStatus(500) @@ -212,13 +210,13 @@ def extractDocument(portal_type): portal_type))) self.document_url = document.getRelativeUrl() except WrongRequest: - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while trying to find document:', error=True) self.REQUEST.response.setStatus(404) except (Unauthorized, KeyError): self.REQUEST.response.setStatus(404) except Exception: - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while trying to find instance:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -249,8 +247,7 @@ class InstancePublisher(GenericPublisher): """Instance publisher""" @responseSupport() - @requireHeader({'Accept': 'application/json', - 'Content-Type': '^application/json.*'}) + @requireHeader({'Content-Type': '^application/json.*'}) @requireJson(dict( title=(unicode, encode_utf8), connection=dict @@ -275,7 +272,7 @@ class InstancePublisher(GenericPublisher): self.REQUEST.response.setStatus(200) except Exception: transaction.abort() - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while modifying:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -285,8 +282,7 @@ class InstancePublisher(GenericPublisher): self.REQUEST.response.setBody(jsonify(d)) return self.REQUEST.response - @requireHeader({'Accept': 'application/json', - 'Content-Type': '^application/json.*'}) + @requireHeader({'Content-Type': '^application/json.*'}) @requireJson(dict(log=unicode)) @extractDocument(['Software Instance', 'Slave Instance']) def __bang(self): @@ -294,7 +290,7 @@ class InstancePublisher(GenericPublisher): self.restrictedTraverse(self.document_url ).bang(bang_tree=True, comment=self.jbody['log']) except Exception: - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while trying to generate instance dict:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -303,8 +299,7 @@ class InstancePublisher(GenericPublisher): self.REQUEST.response.setStatus(204) return self.REQUEST.response - @requireHeader({'Accept': 'application/json', - 'Content-Type': '^application/json.*'}) + @requireHeader({'Content-Type': '^application/json.*'}) @requireJson(dict( slave=bool, software_release=(unicode, encode_utf8), @@ -337,7 +332,7 @@ class InstancePublisher(GenericPublisher): ).requestSoftwareInstance(**request_dict) except Exception: transaction.abort() - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem with person.requestSoftwareInstance:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -348,7 +343,6 @@ class InstancePublisher(GenericPublisher): self.REQUEST.response.setBody(jsonify({'status':'processing'})) return self.REQUEST.response - @requireHeader({'Accept': 'application/json'}) @extractDocument(['Software Instance', 'Slave Instance']) @supportModifiedSince('document_url') def __instance_info(self): @@ -367,14 +361,14 @@ class InstancePublisher(GenericPublisher): d = { "title": software_instance.getTitle(), "status": software_instance.getSlapState(), - "software_release": "", # not ready yet + "software_release": software_instance.getRootSoftwareReleaseUrl(), "software_type": software_instance.getSourceReference(), "slave": software_instance.getPortalType() == 'Slave Instance', "connection": software_instance.getConnectionXmlAsDict(), "parameter": software_instance.getInstanceXmlAsDict(), "sla": software_instance.getSlaXmlAsDict(), - "children_list": [q.absolute_url() for q in \ - software_instance.getPredecessorValueList()], + "children_list": [self.getAPIRoot() + '/' + q.getRelativeUrl() \ + for q in software_instance.getPredecessorValueList()], "partition": { # not ready yet "public_ip": [], "private_ip": [], @@ -382,7 +376,7 @@ class InstancePublisher(GenericPublisher): } } except Exception: - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while trying to generate instance dict:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -401,8 +395,6 @@ class InstancePublisher(GenericPublisher): self.REQUEST.response.setBody(jsonify(d)) return self.REQUEST.response - software_instance_module = 'software_instance_module' - @requireHeader({'Accept': 'application/json'}) def __instance_list(self): kw = dict( portal_type=('Software Instance', 'Slave Instance'), @@ -410,7 +402,7 @@ class InstancePublisher(GenericPublisher): d = {"list": []} a = d['list'].append for si in self.getPortalObject().portal_catalog(**kw): - a('/'.join([self.absolute_url(), 'instance', si.getRelativeUrl()])) + a('/'.join([self.getAPIRoot(), 'instance', si.getRelativeUrl()])) try: d['list'][0] except IndexError: @@ -439,8 +431,7 @@ class InstancePublisher(GenericPublisher): class ComputerPublisher(GenericPublisher): @responseSupport() - @requireHeader({'Accept': 'application/json', - 'Content-Type': '^application/json.*'}) + @requireHeader({'Content-Type': '^application/json.*'}) @extractDocument('Computer') @requireJson(dict( partition=list, @@ -491,7 +482,7 @@ class ComputerPublisher(GenericPublisher): computer.Computer_updateFromJson(self.jbody) except Exception: transaction.abort() - LOG('VifibRestApiV1Tool', ERROR, + LOG('VifibRestApiV1', ERROR, 'Problem while trying to update computer:', error=True) self.REQUEST.response.setStatus(500) self.REQUEST.response.setBody(jsonify({'error': @@ -500,18 +491,16 @@ class ComputerPublisher(GenericPublisher): self.REQUEST.response.setStatus(204) return self.REQUEST.response - -class VifibRestApiV1Tool(BaseTool): - """SlapOS REST API V1 Tool""" - - id = 'portal_vifib_rest_api_v1' - meta_type = 'ERP5 Vifib Rest API V1 Tool' - portal_type = 'Vifib Rest API V1 Tool' +class VifibRestAPIV1(Implicit): security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) - allowed_types = () - security.declarePublic('instance') + + security.declarePublic('getAPIRoot') + def getAPIRoot(self): + """Returns the root of API""" + return self.absolute_url() + '/v1' + @ComputedAttribute def instance(self): """Instance publisher""" @@ -523,109 +512,6 @@ class VifibRestApiV1Tool(BaseTool): """Computer publisher""" return ComputerPublisher().__of__(self) - security.declarePrivate('manage_afterAdd') - def manage_afterAdd(self, item, container) : - """Init permissions right after creation. - - Permissions in slap tool are simple: - o Each member can access the tool. - o Only manager can view and create. - o Anonymous can not access - """ - item.manage_permission(Permissions.AddPortalContent, - ['Manager']) - item.manage_permission(Permissions.AccessContentsInformation, - ['Member', 'Manager']) - item.manage_permission(Permissions.View, - ['Manager',]) - BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container) - - # set this date to moment of API modification - api_modification_date = DateTime('2012/05/24 10:00 GMT+2') - - @supportModifiedSince(modified_property_id='api_modification_date') - def __api_discovery(self): - self.REQUEST.response.setHeader('Last-Modified', - rfc1123_date(self.api_modification_date)) - self.REQUEST.response.setHeader('Cache-Control', 'must-revalidate') - self.REQUEST.response.setStatus(200) - d = { - "computer_update": { - "authentication": True, - "url": '{computer_url}', - "method": "PUT", - "required": {}, - "optional": { - "software": "list", - "address": "list" - } - }, - "discovery": { - "authentication": False, - "url": self.absolute_url(), - "method": "GET", - "required": {}, - "optional": {} - }, - "instance_list": { - "authentication": True, - "url": self.absolute_url() + '/instance', - "method": "GET", - "required": {}, - "optional": {} - }, - "instance_bang": { - "authentication": True, - "url": "{instance_url}/bang", - "method": "POST", - "required": { - "log": "unicode" - }, - "optional": {} - }, - "instance_certificate": { - "authentication": True, - "url": "{instance_url}/certificate", - "method": "GET", - "required": {}, - "optional": {} - }, - "instance_edit": { - "authentication": True, - "url": "{instance_url}", - "method": "PUT", - "required": {}, - "optional": { - "title": "unicode", - "connection": "object" - }, - }, - "instance_info": { - "authentication": True, - "url": "{instance_url}", - "method": "GET", - "required": {}, - "optional": {} - }, - 'request_instance': { - "authentication": True, - 'url': self.absolute_url() + '/instance', - 'method': 'POST', - 'required': { - "status": "unicode", - "slave": "bool", - "title": "unicode", - "software_release": "unicode", - "software_type": "unicode", - "parameter": "object", - "sla": "object" - }, - 'optional' : {} - } - } - self.REQUEST.response.setBody(jsonify(d)) - return self.REQUEST.response - @responseSupport(True) def OPTIONS(self, *args, **kwargs): """HTTP OPTIONS implementation""" @@ -634,12 +520,7 @@ class VifibRestApiV1Tool(BaseTool): security.declarePublic('__call__') @responseSupport(True) - @requireHeader({'Accept': 'application/json'}) def __call__(self): """Possible API discovery""" - if self.REQUEST['REQUEST_METHOD'] == 'GET': - return self.__api_discovery() self.REQUEST.response.setStatus(400) return self.REQUEST.response - -InitializeClass(VifibRestApiV1Tool) diff --git a/master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.xml b/master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.xml new file mode 100644 index 0000000000000000000000000000000000000000..576fda23221ed34a3c62013178f6c2974b36d5a9 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_v1/DocumentTemplateItem/portal_components/VifibRestAPIV1.xml @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Document Component" module="erp5.portal_type"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_recorded_property_dict</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>default_reference</string> </key> + <value> <string>VifibRestAPIV1</string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>VifibRestAPIV1</string> </value> + </item> + <item> + <key> <string>portal_type</string> </key> + <value> <string>Document Component</string> </value> + </item> + <item> + <key> <string>sid</string> </key> + <value> + <none/> + </value> + </item> + <item> + <key> <string>version</string> </key> + <value> <string>erp5</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="PersistentMapping" module="Persistence.mapping"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>data</string> </key> + <value> + <dictionary/> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/dependency_list b/master/bt5/vifib_slapos_rest_api_v1/bt/dependency_list index 0b4cb2dd5cbb56f8f0ae7c7d91bf124783fbbdae..cd870eb4cba5c8f780e180f204d3c50aedf88d04 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/dependency_list +++ b/master/bt5/vifib_slapos_rest_api_v1/bt/dependency_list @@ -1,2 +1 @@ -vifib_slapos_core -vifib_slapos_rest_api_v1_portal_type \ No newline at end of file +vifib_slapos_rest_api \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/description b/master/bt5/vifib_slapos_rest_api_v1/bt/description index 6d8395973201da52a53d45a225972be0ea21ba84..b9e8a9bc974e8e89e58d1e962376aedd76680922 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/description +++ b/master/bt5/vifib_slapos_rest_api_v1/bt/description @@ -1 +1 @@ -Restful API V1 for Vifib \ No newline at end of file +Version 1 of REST API. \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/revision b/master/bt5/vifib_slapos_rest_api_v1/bt/revision index 62f9457511f879886bb7728c986fe10b0ece6bcb..19c7bdba7b1e9bfe80365a50420a6d538ca503c3 100644 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/revision +++ b/master/bt5/vifib_slapos_rest_api_v1/bt/revision @@ -1 +1 @@ -6 \ No newline at end of file +16 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list b/master/bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list deleted file mode 100644 index cb0910e65f542298b54a4fe50cd46668c02012b8..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/template_action_path_list +++ /dev/null @@ -1 +0,0 @@ -System Preference | vifib_rest_api_v1_preference \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/template_document_id_list b/master/bt5/vifib_slapos_rest_api_v1/bt/template_document_id_list new file mode 100644 index 0000000000000000000000000000000000000000..b08f7ab68505d6d50fe277cbcf35adc28e9fd4a6 --- /dev/null +++ b/master/bt5/vifib_slapos_rest_api_v1/bt/template_document_id_list @@ -0,0 +1 @@ +VifibRestAPIV1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/template_property_sheet_id_list b/master/bt5/vifib_slapos_rest_api_v1/bt/template_property_sheet_id_list deleted file mode 100644 index 82c7d941f451e1a0468def0a321efe4b29d42ce0..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/template_property_sheet_id_list +++ /dev/null @@ -1 +0,0 @@ -VifibRestAPIV1SystemPreference \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list b/master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list deleted file mode 100644 index 3aad62d5a6f1e873271ff464d62fe51fbd8cc20b..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/template_skin_id_list +++ /dev/null @@ -1 +0,0 @@ -vifib_slapos_rest_api_v1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1/bt/template_tool_id_list b/master/bt5/vifib_slapos_rest_api_v1/bt/template_tool_id_list deleted file mode 100644 index 538fcf9709894331de4622fd584df27632814c0f..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1/bt/template_tool_id_list +++ /dev/null @@ -1 +0,0 @@ -portal_vifib_rest_api_v1 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/revision b/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/revision deleted file mode 100644 index 62f9457511f879886bb7728c986fe10b0ece6bcb..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/revision +++ /dev/null @@ -1 +0,0 @@ -6 \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_portal_type_id_list b/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_portal_type_id_list deleted file mode 100644 index b0a59899b653bd26ab7166104207e5c4f015edd9..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/template_portal_type_id_list +++ /dev/null @@ -1 +0,0 @@ -Vifib Rest API V1 Tool \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/title b/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/title deleted file mode 100644 index ab0401af7fbf105f5124dbf894fc91ad5789d731..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_slapos_rest_api_v1_portal_type/bt/title +++ /dev/null @@ -1 +0,0 @@ -vifib_slapos_rest_api_v1_portal_type \ No newline at end of file diff --git a/master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py b/master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py index e1b61fa90ce3ee49e0d6eff6e54bcf8a4adf75e5..d9887d28d7301a53321729319ecbf66fd9f4f3ab 100644 --- a/master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py +++ b/master/bt5/vifib_slapos_rest_api_v1_test/TestTemplateItem/testVifibSlaposRestAPIV1.py @@ -12,6 +12,8 @@ from App.Common import rfc1123_date from DateTime import DateTime import time +from Products.ERP5Type.tests.backportUnittest import skip + class Simulator: def __init__(self, outfile, method): self.outfile = outfile @@ -70,14 +72,13 @@ class VifibSlaposRestAPIV1MixinBase(TestVifibSlapWebServiceMixin): self.document_list = [] self.portal = self.getPortalObject() - self.api_url = self.portal.portal_vifib_rest_api_v1.absolute_url() + self.api_url = self.portal.portal_vifib_rest_api.v1.getAPIRoot() self.api_scheme, self.api_netloc, self.api_path, self.api_query, \ self.api_fragment = urlparse.urlsplit(self.api_url) self.connection = CustomHeaderHTTPConnection(host=self.api_netloc, custom_header={ 'Access-Control-Request-Headers': self.access_control_allow_headers, - 'Accept': 'application/json', 'Content-Type': 'application/json', }) @@ -170,6 +171,7 @@ class VifibSlaposRestAPIV1Mixin(VifibSlaposRestAPIV1MixinBase): set([str]) ) +@skip('Undecided.') class TestInstanceRequest(VifibSlaposRestAPIV1Mixin): def test_not_logged_in(self): self.connection.request(method='POST', @@ -436,8 +438,7 @@ class TestInstanceRequest(VifibSlaposRestAPIV1Mixin): self.assertResponseCode(400) self.assertResponseJson() self.assertEqual({ - 'Content-Type': "Header with value 'application/json' is required.", - 'Accept': "Header with value 'application/json' is required."}, + 'Content-Type': "Header with value '^application/json.*' is required."}, self.json_response) self.assertPersonRequestSimulatorEmpty() @@ -447,18 +448,18 @@ class TestInstanceRequest(VifibSlaposRestAPIV1Mixin): body=json.dumps(kwargs), headers={'REMOTE_USER': self.customer_reference, 'Content-Type': 'please/complain', - 'Accept': 'please/complain'}) + 'Accept': 'be/silent'}) self.prepareResponse() self.assertBasicResponse() self.assertResponseCode(400) self.assertResponseJson() self.assertEqual({ - 'Content-Type': "Header with value 'application/json' is required.", - 'Accept': "Header with value 'application/json' is required."}, + 'Content-Type': "Header with value '^application/json.*' is required."}, self.json_response) self.assertPersonRequestSimulatorEmpty() # and with correct ones are set by default +@skip('Undecided.') class TestInstanceOPTIONS(VifibSlaposRestAPIV1Mixin): def test_OPTIONS_not_logged_in(self): self.connection = CustomHeaderHTTPConnection(host=self.api_netloc, @@ -473,6 +474,7 @@ class TestInstanceOPTIONS(VifibSlaposRestAPIV1Mixin): self.assertResponseNoContentType() self.assertPersonRequestSimulatorEmpty() +@skip('Undecided.') class VifibSlaposRestAPIV1InstanceMixin(VifibSlaposRestAPIV1Mixin): def afterSetUp(self): VifibSlaposRestAPIV1Mixin.afterSetUp(self) @@ -490,7 +492,8 @@ class VifibSlaposRestAPIV1InstanceMixin(VifibSlaposRestAPIV1Mixin): software_instance.edit( reference='SI' + self.test_random_id, ssl_key='SSL Key', - ssl_certificate='SSL Certificate' + ssl_certificate='SSL Certificate', + root_software_release_url='http://url.of.software.release/' ) software_instance.validate() hosting_subscription.edit( @@ -517,6 +520,7 @@ class VifibSlaposRestAPIV1InstanceMixin(VifibSlaposRestAPIV1Mixin): software_instance.recursiveImmediateReindexObject() transaction.commit() +@skip('Undecided.') class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): def test_non_existing(self): non_existing = 'software_instance_module/' + self.generateNewId() @@ -584,7 +588,7 @@ class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): "parameter": { "parameter1": "valueof1", "parameter2": "valueof2"}, - "software_release": "", + "software_release": "http://url.of.software.release/", "sla": {"computer_guid": "SOMECOMP"}}, self.json_response) @@ -647,7 +651,7 @@ class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): "parameter": { "parameter1": "valueof1", "parameter2": "valueof2"}, - "software_release": "", + "software_release": "http://url.of.software.release/", "sla": {"computer_guid": "SOMECOMP"}}, self.json_response) @@ -679,7 +683,7 @@ class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): "parameter": { "parameter1": "valueof1", "parameter2": "valueof2"}, - "software_release": "", + "software_release": "http://url.of.software.release/", "sla": {"computer_guid": "SOMECOMP"}}, self.json_response) @@ -711,7 +715,7 @@ class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): "parameter": { "parameter1": "valueof1", "parameter2": "valueof2"}, - "software_release": "", + "software_release": "http://url.of.software.release/", "sla": {"computer_guid": "SOMECOMP"}}, self.json_response) @@ -725,6 +729,7 @@ class TestInstanceGET(VifibSlaposRestAPIV1InstanceMixin): self.assertBasicResponse() self.assertResponseCode(404) +@skip('Undecided.') class TestInstanceGETcertificate(VifibSlaposRestAPIV1InstanceMixin): def test(self): self.connection.request(method='GET', @@ -819,6 +824,7 @@ class VifibSlaposRestAPIV1BangMixin(VifibSlaposRestAPIV1InstanceMixin): [{'recargs': args, 'reckwargs': kwargs, 'recmethod': 'bang'}]) +@skip('Undecided.') class TestInstancePOSTbang(VifibSlaposRestAPIV1BangMixin): def test(self): kwargs = {'log': 'This is cool log!', 'bang_tree': True} @@ -977,6 +983,7 @@ class TestInstancePOSTbang(VifibSlaposRestAPIV1BangMixin): self.assertEqual({'log': 'bool is not unicode.'}, self.json_response) self.assertInstanceBangSimulatorEmpty() +@skip('Undecided.') class TestInstancePUT(VifibSlaposRestAPIV1InstanceMixin): def afterSetUp(self): super(TestInstancePUT, self).afterSetUp() @@ -1144,13 +1151,15 @@ class TestInstancePUT(VifibSlaposRestAPIV1InstanceMixin): self.assertResponseCode(204) self.assertInstancePUTSimulatorEmpty() +@skip('Undecided.') class TestInstanceGETlist(VifibSlaposRestAPIV1InstanceMixin): def assertLastModifiedHeader(self): calculated = rfc1123_date(self.portal.software_instance_module\ .bobobase_modification_time()) self.assertEqual(calculated, self.response.getheader('Last-Modified')) - def test(self): + def test_no_cache(self): + # version of test which ignores cache to expose possible other errors self.connection.request(method='GET', url='/'.join([self.api_path, 'instance']), headers={'REMOTE_USER': self.customer_reference}) @@ -1158,14 +1167,17 @@ class TestInstanceGETlist(VifibSlaposRestAPIV1InstanceMixin): self.assertBasicResponse() self.assertResponseCode(200) self.assertResponseJson() - self.assertLastModifiedHeader() - self.assertCacheControlHeader() self.assertEqual({ "list": ['/'.join([self.api_url, 'instance', self.software_instance.getRelativeUrl()])] }, self.json_response) + def test(self): + self.test_no_cache() + self.assertLastModifiedHeader() + self.assertCacheControlHeader() + def test_if_modified_since_equal(self): self.connection.request(method='GET', url='/'.join([self.api_path, 'instance']), @@ -1283,110 +1295,7 @@ class TestInstanceGETlist(VifibSlaposRestAPIV1InstanceMixin): self.assertTrue('Bearer realm="' in auth) self.assertPersonRequestSimulatorEmpty() -class TestGET_discovery(VifibSlaposRestAPIV1Mixin): - def afterSetUp(self): - super(TestGET_discovery, self).afterSetUp() - self.api_date = self.portal.portal_vifib_rest_api_v1.api_modification_date - - def assertLastModifiedHeader(self): - self.assertEqual( - rfc1123_date(self.api_date), - self.response.getheader('Last-Modified')) - - def assertAPIDiscoveryDict(self): - self.assertSameSet(self.json_response.keys(), - [ - 'computer_update', - 'instance_certificate', - 'request_instance', - 'instance_list', - 'instance_edit', - 'instance_bang', - 'instance_info', - 'discovery', - ]) - - def test_noAcquisition(self): - # check the test - portal_id = self.portal.getId() - self.logout() - self.assertEqual(portal_id, self.portal.getId()) - self.login() - # prove that even if anyone has access to portal root it is impossible - # to fetch it via API - self.connection.request(method='GET', - url='/'.join([self.api_path, self.portal.getId(), 'getId']) - ) - self.prepareResponse() - self.assertResponseCode(404) - self.assertBasicResponse() - - def test(self): - self.connection.request(method='GET', - url=self.api_path) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(200) - self.assertLastModifiedHeader() - self.assertCacheControlHeader() - self.assertResponseJson() - self.assertAPIDiscoveryDict() - - def test_if_modified_since_equal(self): - self.connection.request(method='GET', - url=self.api_path, - headers={'If-Modified-Since': rfc1123_date(self.api_date)}) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(304) - - def test_if_modified_since_after(self): - if_modified = self.api_date.timeTime() + 2 - # check the test: is calculated time *before* now? - self.assertTrue(int(if_modified) < int(DateTime().timeTime())) - self.connection.request(method='GET', - url=self.api_path, - headers={'If-Modified-Since': rfc1123_date(DateTime(if_modified))}) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(304) - - def test_if_modified_since_before(self): - self.connection.request(method='GET', - url=self.api_path, - headers={'If-Modified-Since': rfc1123_date(self.api_date - 1)}) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(200) - self.assertLastModifiedHeader() - self.assertCacheControlHeader() - self.assertResponseJson() - self.assertAPIDiscoveryDict() - - def test_if_modified_since_date_not_date(self): - self.connection.request(method='GET', - url=self.api_path, - headers={'If-Modified-Since': 'This Is Not A date'}) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(200) - self.assertLastModifiedHeader() - self.assertCacheControlHeader() - self.assertResponseJson() - self.assertAPIDiscoveryDict() - - def test_if_modified_since_date_future(self): - self.connection.request(method='GET', - url=self.api_path, - headers={'If-Modified-Since': rfc1123_date(DateTime() + 1)}) - self.prepareResponse() - self.assertBasicResponse() - self.assertResponseCode(200) - self.assertLastModifiedHeader() - self.assertCacheControlHeader() - self.assertResponseJson() - self.assertAPIDiscoveryDict() - +@skip('Undecided.') class TestComputerPUT(VifibSlaposRestAPIV1MixinBase): def createComputer(self): computer = self.cloneByPath( diff --git a/master/bt5/vifib_slapos_rest_api_v1_test/bt/revision b/master/bt5/vifib_slapos_rest_api_v1_test/bt/revision index 832332893ab752cd7a530a0d45c00fdf2f436453..efee1f88bb8fecf9af959805925bca35285f1712 100644 --- a/master/bt5/vifib_slapos_rest_api_v1_test/bt/revision +++ b/master/bt5/vifib_slapos_rest_api_v1_test/bt/revision @@ -1 +1 @@ -67 \ No newline at end of file +78 \ No newline at end of file diff --git a/master/bt5/vifib_upgrader/ExtensionTemplateItem/VifibUpgrader.py b/master/bt5/vifib_upgrader/ExtensionTemplateItem/VifibUpgrader.py index 4f8be2ff227c839ae304aa86661aacb6117b5924..beaba56f4bbdabbcbc2e1a942a3987de742e7883 100644 --- a/master/bt5/vifib_upgrader/ExtensionTemplateItem/VifibUpgrader.py +++ b/master/bt5/vifib_upgrader/ExtensionTemplateItem/VifibUpgrader.py @@ -70,3 +70,216 @@ def VifibSaleInvoiceBuilder_buildAndPlan(self, movement_list): for delivery in delivery_list: if delivery.getSimulationState() == 'draft': wf._changeStateOf(delivery, plan_tdef, dict(comment="Generated by the upgrade")) + +def fixSaleOrder(slap_document): + sale_order_line_list = slap_document.getAggregateRelatedValueList( + portal_type='Sale Order Line') + assert(len(sale_order_line_list) == 1) + sale_order = sale_order_line_list[0].getParentValue() + sale_packing_list_line_list = slap_document.getAggregateRelatedValueList( + portal_type='Sale Packing List Line') + if len(sale_packing_list_line_list) == 0: + return sale_order.contentValues(portal_type='Sale Order Line')[0] + assert(len(sale_packing_list_line_list) == 1) + sale_packing_list = sale_packing_list_line_list[0].getParentValue() + + new_sale_order = sale_order.Base_createCloneDocument(batch_mode=1) + slap_document.getPortalObject().portal_workflow.\ + _jumpToStateFor(new_sale_order, 'ordered', 'order_workflow') + applied_rule = sale_order.getCausalityRelatedValue(portal_type='Applied Rule') + applied_rule.getParentValue().deleteContent(applied_rule.getId()) + sale_order.getParentValue().deleteContent(sale_order.getId()) + sale_packing_list.getParentValue().deleteContent(sale_packing_list.getId()) + return new_sale_order.contentValues(portal_type='Sale Order Line')[0] + +def SlapDocument_migrateSlapState(self): + @WorkflowMethod.disable + def real(self): + from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery + + def setUpPeriodicity(hosting_subscription): + from Products.ERP5Type.DateUtils import addToDate, getClosestDate + start_date = hosting_subscription.getCreationDate() + start_date = getClosestDate(target_date=start_date, precision='day') + while start_date.day() >= 29: + start_date = addToDate(start_date, to_add={'day': -1}) + periodicity_month_day_list = [start_date.day()] + periodicity_hour_list=[0] + periodicity_minute_list=[0] + hosting_subscription.edit( + periodicity_month_day_list=periodicity_month_day_list, + periodicity_hour_list=periodicity_hour_list, + periodicity_minute_list=periodicity_minute_list + ) + + slap_document = self + portal = self.getPortalObject() + + portal_type_list = ('Hosting Subscription', 'Software Instance', 'Slave Instance') + portal_type = slap_document.getPortalType() + if portal_type not in portal_type_list: + raise TypeError('%s is not %s' % (slap_document.getPath(), portal_type_list)) + + explanation_delivery_line = portal.portal_catalog.getResultValue( + portal_type='Sale Packing List Line', + simulation_state=['ready', 'confirmed', 'started', 'stopped', 'delivered'], + query=ComplexQuery( + Query(default_aggregate_uid=slap_document.getUid()), + Query(default_resource_uid=[ + portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(), + portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceHostingResource()).getUid(), + portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceCleanupResource()).getUid(), + ]), + operator='AND', + ), + sort_on=(('movement.start_date', 'DESC'),) + ) + if explanation_delivery_line is None: + explanation_delivery_line = slap_document.getAggregateRelatedValue(portal_type='Sale Order Line') + + if slap_document.getRelativeUrl() == 'hosting_subscription_module/20120521-C46CA2': + # special case of destroyed data + explanation_delivery_line = fixSaleOrder(slap_document) + + if portal_type == 'Hosting Subscription': + current_periodicity = slap_document.getPeriodicityMonthDayList() + if current_periodicity is None or len(current_periodicity) == 0: + setUpPeriodicity(slap_document) + # Person is now directly associated on the HS + slap_document.edit( + destination_section_value=explanation_delivery_line.getDestinationSectionValue(portal_type="Person"), + ) + assert(slap_document.getDestinationSection() == explanation_delivery_line.getDestinationSectionValue().getRelativeUrl()) + else: + hosting_subscription = explanation_delivery_line.getAggregateValue(portal_type='Hosting Subscription') + slap_document.edit( + specialise_value=hosting_subscription, + root_software_release_url=explanation_delivery_line.getAggregateValue(portal_type='Software Release').getUrlString() + ) + assert(slap_document.getSpecialise() == hosting_subscription.getRelativeUrl()) + + + # Migrate slap state + if portal_type == 'Hosting Subscription': + state = slap_document.getRootState() + promise_kw = { + 'instance_xml': slap_document.getTextContent(), + 'software_type': slap_document.getSourceReference(), + 'sla_xml': slap_document.getSlaXml(), + 'software_release': slap_document.getRootSoftwareReleaseUrl(), + 'shared': slap_document.isRootSlave() + } + else: + if explanation_delivery_line.getPortalType() == 'Sale Packing List Line': + resource = explanation_delivery_line.getResource() + if resource == portal.portal_preferences.getPreferredInstanceSetupResource(): + state = 'stopped' + elif resource == portal.portal_preferences.getPreferredInstanceCleanupResource(): + state = 'destroyed' + elif resource == portal.portal_preferences.getPreferredInstanceHostingResource(): + if explanation_delivery_line.getSimulationState() in ('confirmed', 'started'): + state = 'started' + else: + state = 'stopped' + pass + else: + raise TypeError('Bad resource %s' % resource) + pass + else: + if explanation_delivery_line.getSimulationState() == 'cancelled': + state = 'destroyed' + else: + assert(explanation_delivery_line.getSimulationState() in ['ordered', 'confirmed']) + previous_workflow_state = self.workflow_history[ + 'software_instance_slap_interface_workflow'][-1]['slap_state'] + if previous_workflow_state == 'start_requested': + state = 'started' + elif previous_workflow_state == 'stop_requested': + state = 'stopped' + else: + raise NotImplementedError("Previous state %r not supported" % previous_workflow_state) + promise_kw = { + 'instance_xml': slap_document.getTextContent(), + 'software_type': slap_document.getSourceReference(), + 'sla_xml': slap_document.getSlaXml(), + 'software_release': slap_document.getRootSoftwareReleaseUrl(), + 'shared': slap_document.getPortalType() == 'Slave Instance' + } + + slap_document.setCausalityValue(explanation_delivery_line.getParentValue()) + if state != 'destroyed' or explanation_delivery_line.getSimulationState() != 'delivered': + slap_document.setAggregateValue(explanation_delivery_line.getAggregateValue(portal_type='Computer Partition')) + assert(slap_document.getAggregate() == explanation_delivery_line.getAggregate(portal_type='Computer Partition')) + state_map = { + 'started': 'start_requested', + 'stopped': 'stop_requested', + 'destroyed': 'destroy_requested' + } + required_state = state_map[state] + _jumpToStateFor = portal.portal_workflow._jumpToStateFor + if slap_document.getSlapState() != required_state: + _jumpToStateFor(slap_document, required_state, 'instance_slap_interface_workflow') + if not(slap_document.getSlapState() == required_state): + raise ValueError('%s: %s != %s' % (state, slap_document.getSlapState(), required_state)) + + # Migrate validation state + if portal_type == 'Hosting Subscription': + if state == 'destroyed': + _jumpToStateFor(slap_document, 'archived', 'hosting_subscription_workflow') + assert(slap_document.getValidationState() == 'archived') + else: + _jumpToStateFor(slap_document, 'validated', 'hosting_subscription_workflow') + assert(slap_document.getValidationState() == 'validated') + else: + if state == 'destroyed' and \ + (explanation_delivery_line.getPortalType() == 'Sale Order Line' or \ + explanation_delivery_line.getSimulationState() == 'delivered'): + _jumpToStateFor(slap_document, 'invalidated', 'item_workflow') + else: + if not(slap_document.getValidationState() == 'validated'): + raise ValueError('%s != %s' % (slap_document.getValidationState(), 'validated')) + + # Update Local Roles + slap_document.updateLocalRolesOnSecurityGroups() + real(self) + +def HostingSubscription_garbageCollectForMigration(self): + @WorkflowMethod.disable + def real(self): + slap_document = self + portal = self.getPortalObject() + + title = slap_document.getTitle() + instance_state = 'destroy_requested' + for software_instance in slap_document.getPredecessorValueList(): + if software_instance.getTitle() == title: + if software_instance.getSlapState() != 'destroy_requested': + instance_state = software_instance.getSlapState() + break + + if instance_state == 'destroy_requested': + _jumpToStateFor = portal.portal_workflow._jumpToStateFor + _jumpToStateFor(slap_document, instance_state, 'instance_slap_interface_workflow') + assert(slap_document.getSlapState() == instance_state) + _jumpToStateFor(slap_document, 'archived', 'hosting_subscription_workflow') + assert(slap_document.getValidationState() == 'archived') + + # Update Local Roles + slap_document.updateLocalRolesOnSecurityGroups() + real(self) + +def SalePackingListLine_deliver(self): + @WorkflowMethod.disable + def real(self): + portal = self.getPortalObject() + assert(self.getResource() in [portal.portal_preferences.getPreferredInstanceSetupResource(), + portal.portal_preferences.getPreferredInstanceUpdateResource()]) + if self.getSimulationState() != 'delivered': + portal.portal_workflow._jumpToStateFor(self.getParentValue(), 'delivered') + self.recursiveReindexObject() + real(self) + +def Computer_updateLocalRoles(self): + self.updateLocalRolesOnSecurityGroups(reindex=False) + for partition in self.contentValues(portal_type='Computer Partition'): + partition.updateLocalRolesOnSecurityGroups(reindex=False) diff --git a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/cleanup_archived_hs_instances.xml b/master/bt5/vifib_upgrader/PathTemplateItem/portal_alarms/vifib_promise_pas.xml similarity index 75% rename from master/bt5/vifib_slap/PathTemplateItem/portal_alarms/cleanup_archived_hs_instances.xml rename to master/bt5/vifib_upgrader/PathTemplateItem/portal_alarms/vifib_promise_pas.xml index 0912b8911c6c4c99573755e5906cae11564cfce1..dee26c8ead89fb25e74c38057a2bed018af04db5 100644 --- a/master/bt5/vifib_slap/PathTemplateItem/portal_alarms/cleanup_archived_hs_instances.xml +++ b/master/bt5/vifib_upgrader/PathTemplateItem/portal_alarms/vifib_promise_pas.xml @@ -8,11 +8,21 @@ <dictionary> <item> <key> <string>active_sense_method_id</string> </key> - <value> <string>Alarm_searchInstanceAndRequestDestruction</string> </value> + <value> <string>Alarm_checkPromiseVifibPAS</string> </value> + </item> + <item> + <key> <string>alarm_notification_mode</string> </key> + <value> + <tuple> + <string>never</string> + </tuple> + </value> </item> <item> <key> <string>description</string> </key> - <value> <string>Finds all instances related to archived hosting subscriptions and request their destruction.</string> </value> + <value> + <none/> + </value> </item> <item> <key> <string>enabled</string> </key> @@ -20,30 +30,26 @@ </item> <item> <key> <string>id</string> </key> - <value> <string>cleanup_archived_hs_instances</string> </value> + <value> <string>vifib_promise_pas</string> </value> + </item> + <item> + <key> <string>periodicity_day_frequency</string> </key> + <value> <int>1</int> </value> </item> <item> <key> <string>periodicity_hour</string> </key> <value> - <tuple/> + <tuple> + <int>0</int> + </tuple> </value> </item> - <item> - <key> <string>periodicity_hour_frequency</string> </key> - <value> <int>12</int> </value> - </item> <item> <key> <string>periodicity_minute</string> </key> <value> <tuple/> </value> </item> - <item> - <key> <string>periodicity_minute_frequency</string> </key> - <value> - <none/> - </value> - </item> <item> <key> <string>periodicity_month</string> </key> <value> @@ -68,7 +74,7 @@ </tuple> <state> <tuple> - <float>1288051200.0</float> + <float>0.0</float> <string>GMT</string> </tuple> </state> @@ -86,14 +92,12 @@ <value> <string>Alarm</string> </value> </item> <item> - <key> <string>sense_method_id</string> </key> - <value> - <none/> - </value> + <key> <string>solve_method_id</string> </key> + <value> <string>Alarm_fixPromiseVifibPAS</string> </value> </item> <item> <key> <string>title</string> </key> - <value> <string>Cleanup archived Hosting Subscription Instances</string> </value> + <value> <string>Pluggable Auth Service Vifib Promise</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_upgrader/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml b/master/bt5/vifib_upgrader/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml index 50ecf3cbd95210f4809474c052249aeb8ccadba0..19f5370c476e539dad19b2af3d63d7dbb8b87ec2 100644 --- a/master/bt5/vifib_upgrader/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml +++ b/master/bt5/vifib_upgrader/RegisteredSkinSelectionTemplateItem/registered_skin_selection.xml @@ -3,4 +3,8 @@ <skin_folder>vifib_upgrader_20120423</skin_folder> <skin_selection>Outdated</skin_selection> </skin_folder_selection> + <skin_folder_selection> + <skin_folder>vifib_upgrader_before_201208</skin_folder> + <skin_selection>Outdated</skin_selection> + </skin_folder_selection> </registered_skin_selection> \ No newline at end of file diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise.xml new file mode 100644 index 0000000000000000000000000000000000000000..66206ba137d26e216188136b994d614eb8b91558 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Folder" module="OFS.Folder"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>business_template_skin_layer_priority</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>float</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>business_template_skin_layer_priority</string> </key> + <value> <float>60.0</float> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_promise</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_checkPromiseVifibPAS.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_checkPromiseVifibPAS.xml new file mode 100644 index 0000000000000000000000000000000000000000..5dc8732ba02ac81bc5fd82a25b176997f7a117b9 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_checkPromiseVifibPAS.xml @@ -0,0 +1,134 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>from Products.CMFActivity.ActiveResult import ActiveResult\n +\n +portal = context.getPortalObject()\n +\n +def mergePASDictDifference(portal, d, fixit):\n + plugins = portal.acl_users.plugins\n + error_list = []\n + plugin_type_info = plugins.listPluginTypeInfo()\n + for plugin, active_list in d.iteritems():\n + plugin_info = [q for q in plugin_type_info if q[\'id\'] == plugin][0]\n + found_list = plugins.listPlugins(plugin_info[\'interface\'])\n + meta_type_list = [q[1].meta_type for q in found_list]\n + for expected in active_list:\n + if expected not in meta_type_list:\n + error = \'Plugin %s missing %s.\' % (plugin, expected)\n + if fixit: \n + existing = [q for q in portal.acl_users.objectValues() if q.meta_type == expected]\n + if len(existing) == 0:\n + error_list.append(\'%s not found\' % expected)\n + else:\n + plugins.activatePlugin(plugin_info[\'interface\'], existing[0].getId())\n + error += \' Fixed.\'\n + error_list.append(error)\n + \n + \n +\n + return error_list\n +\n +promise_dict = {\n + \'IExtractionPlugin\': [\n + \'Vifib Machine Authentication Plugin\',\n + \'Vifib Browser ID Extraction Plugin\',\n + \'Vifib Facebook Server Extraction Plugin\',\n + \'Vifib Google Server Extraction Plugin\',\n +# \'ERP5 Bearer Extraction Plugin\',\n + \'ERP5 Facebook Extraction Plugin\',\n + \'ERP5 Google Extraction Plugin\',\n + ],\n + \'IAuthenticationPlugin\': [\n + \'Vifib Machine Authentication Plugin\',\n + \'Vifib Shadow Authentication Plugin\',\n + ],\n + \'IGroupsPlugin\': [\n + \'Vifib Machine Authentication Plugin\',\n + \'Vifib Shadow Authentication Plugin\',\n + ],\n + \'IUserEnumerationPlugin\': [\n + \'Vifib Machine Authentication Plugin\',\n + \'Vifib Shadow Authentication Plugin\'\n + ]\n +}\n +pas_difference = mergePASDictDifference(portal, promise_dict, fixit)\n +if len(pas_difference) != 0:\n + severity = 1\n + summary = "PAS not configured as expected"\n + detail = "Difference:\\n%s" % (\'\\n\'.join(pas_difference), )\n +else:\n + severity = 0\n + summary = "Nothing to do."\n + detail = ""\n +\n +active_result = ActiveResult()\n +active_result.edit(\n + summary=summary, \n + severity=severity,\n + detail=detail)\n +\n +context.newActiveProcess().postResult(active_result)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>tag, fixit=False, **kw</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Alarm_checkPromiseVifibPAS</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_fixPromiseVifibPAS.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_fixPromiseVifibPAS.xml new file mode 100644 index 0000000000000000000000000000000000000000..715b60d7fd137cd53af0c9b801719176aa448f70 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_promise/Alarm_fixPromiseVifibPAS.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>context.activeSense(fixit=1)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Alarm_fixPromiseVifibPAS</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_fixPersonConsistency.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_fixPersonConsistency.xml new file mode 100644 index 0000000000000000000000000000000000000000..083f5d27dad4f7c54c772de80f5b2f1ffc38c484 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_fixPersonConsistency.xml @@ -0,0 +1,69 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>context.getPortalObject().portal_catalog.searchAndActivate(method_id=\'fixConsistency\', portal_type=\'Person\')\n +\n +return \'ok\'\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_fixPersonConsistency</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_getUpgraderSignature.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_getUpgraderSignature.xml index 1a62b91a97f415337a541e040a70f565bd015a23..4da99e73f4dba5020f3247731b31a90d7cb3f62f 100644 --- a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_getUpgraderSignature.xml +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_getUpgraderSignature.xml @@ -67,64 +67,84 @@ ALARM_DICT = {\n }\n \n REQUIRED_BT5_ID_LIST = (\n +# core of core\n + \'erp5_mysql_innodb_catalog\',\n \'erp5_core\',\n \'erp5_property_sheets\',\n \'erp5_xhtml_style\',\n +# erp5\n \'erp5_base\',\n - \'erp5_jquery_ui\',\n - \'erp5_rss_style\',\n \'erp5_accounting\',\n - \'erp5_credential\',\n \'erp5_crm\',\n - \'erp5_open_trade\',\n - \'erp5_payzen_secure_payment\',\n + \'erp5_accounting_l10n_fr\',\n + \'erp5_dms\',\n + \'erp5_computer_immobilisation\',\n + \'erp5_credential\',\n + \'erp5_discount_resource\',\n + \'erp5_commerce\',\n + \'erp5_pdm\',\n + \'erp5_knowledge_pad\',\n + \'erp5_forge\',\n + \'erp5_legacy_tax_system\',\n + \'erp5_invoicing\',\n + \'erp5_ingestion\',\n + \'erp5_item\',\n + \'erp5_km\'\n + \'erp5_simulation\',\n + \'erp5_trade\',\n + \'erp5_ui_test_core\',\n + \'erp5_tax_resource\',\n + \'erp5_system_event\',\n + \'erp5_ui_test\',\n + \'erp5_secure_payment\',\n \'erp5_web\',\n - \'erp5_bearer_token\',\n - \'vifib_slapos_core\',\n + \'erp5_project\',\n + \'erp5_credential_oauth2\',\n +# vifib\n \'vifib_base\',\n - \'vifib_mysql_innodb_catalog\',\n - \'vifib_forge_release\',\n - \'vifib_open_trade\',\n - \'vifib_slap\',\n - \'vifib_software_pdm\',\n + \'vifib_slapos_core\',\n \'vifib_web\',\n - \'vifib_payzen\',\n - \'vifib_web_ui_test\',\n + \'vifib_slap\',\n \'vifib_agent\',\n - \'vifib_data\',\n - \'vifib_data_web\',\n \'vifib_slapos_accounting\',\n \'vifib_erp5\',\n + \'vifib_web_ui_test\',\n + \'vifib_slapos_rest_api_tool_portal_type\',\n + \'vifib_slapos_rest_api\',\n + \'vifib_slapos_rest_api_v1\',\n + \'vifib_data\',\n + \'vifib_data_web\',\n + \'vifib_data_simulation\',\n )\n \n REINSTALLABLE_BT5_ID_LIST = ()\n \n # items to keep even if marked by BT5 to \'Remove\'\n KEEP_ORIGINAL_DICT = {\n - \'vifib_base\': (\n - \'software_instance_module\',\n - \'portal_types/Slave Instance\',\n - \'portal_types/Software Instance\',\n - \'portal_types/Software Instance Module\',\n - \'allowed_content_types/Software Instance Module\',\n - \'base_category_list/Slave Instance\',\n - \'base_category_list/Software Instance\',\n - \'base_category_list/Software Instance Module\',\n - \'property_sheet_list/Slave Instance\',\n - \'property_sheet_list/Software Instance\',\n - \'property_sheet_list/Item\',\n - \'portal_workflow/software_instance_slap_interface_workflow\',\n - ),\n - \'vifib_open_trade\': (\n - \'hosting_subscription_module\',\n - \'portal_types/Hosting Subscription\',\n - \'portal_types/Hosting Subscription Module\',\n - \'property_sheet_list/Hosting Subscription\',\n - \'allowed_content_types/Hosting Subscription Module\',\n - \'base_category_list/Hosting Subscription\',\n - \'base_category_list/Hosting Subscription Module\',\n - \'portal_type_workflow_chain/Hosting Subscription\',\n - ),\n +# \'vifib_base\': (\n +# \'software_instance_module\',\n +# \'portal_types/Slave Instance\',\n +# \'portal_types/Software Instance\',\n +# \'portal_types/Software Instance Module\',\n +# \'allowed_content_types/Software Instance Module\',\n +# \'base_category_list/Slave Instance\',\n +# \'base_category_list/Software Instance\',\n +# \'base_category_list/Software Instance Module\',\n +# \'property_sheet_list/Slave Instance\',\n +# \'property_sheet_list/Software Instance\',\n +# \'property_sheet_list/Item\',\n +# \'portal_workflow/software_instance_slap_interface_workflow\',\n +# ),\n +# \'vifib_open_trade\': (\n +# \'hosting_subscription_module\',\n +# \'portal_types/Hosting Subscription\',\n +# \'portal_types/Hosting Subscription Module\',\n +# \'property_sheet_list/Hosting Subscription\',\n +# \'allowed_content_types/Hosting Subscription Module\',\n +# \'base_category_list/Hosting Subscription\',\n +# \'base_category_list/Hosting Subscription Module\',\n +# \'portal_type_workflow_chain/Hosting Subscription\',\n +# ),\n }\n \n # Items which need validation at upgrade time\n @@ -134,6 +154,12 @@ INTEGRITY_VERIFICATION_SCRIPT_ID_LIST = ( )\n \n ALARM_TOOL_CONFIGURATION_LIST = ( )\n \n +WORKFLOW_CHAIN_DICT = context.getPortalObject().portal_workflow.getWorkflowChainDict()\n +\n +WORKFLOW_CHAIN_DICT.update(**{\n + \'chain_Slave Instance\': \'edit_workflow, instance_accounting_slap_interaction_workflow, instance_slap_interface_workflow, item_workflow, local_permission_vifib_interaction_workflow, slap_interaction_workflow\',\n + \'chain_Software Instance\': \'edit_workflow, instance_accounting_slap_interaction_workflow, instance_slap_interface_workflow, item_workflow, local_permission_vifib_interaction_workflow, slap_interaction_workflow\',\n +})\n \n FINALIZE_ALARM_SCRIPT = ( )\n \n @@ -148,6 +174,7 @@ signature_dict = {\n , \'validation_dict\': VALIDATION_DICT\n , \'integrity_verification_script_id_list\': INTEGRITY_VERIFICATION_SCRIPT_ID_LIST\n , \'alarm_tool_configuration_list\' : ALARM_TOOL_CONFIGURATION_LIST\n + , \'workflow_chain_dict\': WORKFLOW_CHAIN_DICT\n # , \'finalize_upgrade_script_list\': FINALIZE_ALARM_SCRIPT\n }\n \n diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/SlapDocument_migrateSlapState.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/SlapDocument_migrateSlapState.xml deleted file mode 100644 index b2058fcb6cf0af2aeb3ffd00059fcbff93aa78cf..0000000000000000000000000000000000000000 --- a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/SlapDocument_migrateSlapState.xml +++ /dev/null @@ -1,208 +0,0 @@ -<?xml version="1.0"?> -<ZopeData> - <record id="1" aka="AAAAAAAAAAE="> - <pickle> - <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>Script_magic</string> </key> - <value> <int>3</int> </value> - </item> - <item> - <key> <string>_bind_names</string> </key> - <value> - <object> - <klass> - <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> - </klass> - <tuple/> - <state> - <dictionary> - <item> - <key> <string>_asgns</string> </key> - <value> - <dictionary> - <item> - <key> <string>name_container</string> </key> - <value> <string>container</string> </value> - </item> - <item> - <key> <string>name_context</string> </key> - <value> <string>context</string> </value> - </item> - <item> - <key> <string>name_m_self</string> </key> - <value> <string>script</string> </value> - </item> - <item> - <key> <string>name_subpath</string> </key> - <value> <string>traverse_subpath</string> </value> - </item> - </dictionary> - </value> - </item> - </dictionary> - </state> - </object> - </value> - </item> - <item> - <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery\n -\n -def setUpPeriodicity(hosting_subscription):\n - from Products.ERP5Type.DateUtils import addToDate, getClosestDate\n - start_date = hosting_subscription.getCreationDate()\n - start_date = getClosestDate(target_date=start_date, precision=\'day\')\n - while start_date.day() >= 29:\n - start_date = addToDate(start_date, to_add={\'day\': -1})\n - periodicity_month_day_list = [start_date.day()]\n - periodicity_hour_list=[0]\n - periodicity_minute_list=[0]\n - hosting_subscription.edit(\n - periodicity_month_day_list=periodicity_month_day_list,\n - periodicity_hour_list=periodicity_hour_list,\n - periodicity_minute_list=periodicity_minute_list\n - )\n -\n -slap_document = context\n -portal = context.getPortalObject()\n -\n -portal_type_list = (\'Hosting Subscription\', \'Software Instance\', \'Slave Instance\')\n -portal_type = slap_document.getPortalType()\n -if portal_type not in portal_type_list:\n - raise TypeError(\'%s is not %s\' % (slap_document.getPath(), portal_type_list))\n -\n -sale_order_line = slap_document.getAggregateRelatedValue(portal_type=\'Sale Order Line\')\n -\n -\n -if portal_type == \'Hosting Subscription\':\n - current_periodicity = slap_document.getPeriodicityMonthDayList()\n - if current_periodicity is None or len(current_periodicity) == 0:\n - setUpPeriodicity(slap_document)\n - # Person is now directly associated on the HS\n - slap_document.edit(\n - destination_section_value=sale_order_line.getDestinationSectionValue(portal_type="Person"),\n - )\n - assert(slap_document.getDestinationSection() == sale_order_line.getDestinationSectionValue().getRelativeUrl())\n -else:\n - hosting_subscription = sale_order_line.getAggregateValue(portal_type=\'Hosting Subscription\')\n - slap_document.edit(\n - specialise_value=hosting_subscription\n - )\n - assert(slap_document.getSpecialise() == hosting_subscription.getRelativeUrl())\n -\n -\n -# Migrate slap state\n -if portal_type == \'Hosting Subscription\':\n - state = slap_document.getRootState()\n - promise_kw = {\n - \'instance_xml\': context.getTextContent(),\n - \'software_type\': context.getSourceReference(),\n - \'sla_xml\': context.getSlaXml(),\n - \'software_release\': context.getRootSoftwareReleaseUrl(),\n - \'shared\': slap_document.isRootSlave()\n - }\n -else:\n - explanation_delivery_line = portal.portal_catalog.getResultValue(\n - portal_type=\'Sale Packing List Line\',\n - query=ComplexQuery(\n - Query(default_aggregate_uid=slap_document.getUid()),\n - Query(default_resource_uid=[\n - portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceSetupResource()).getUid(),\n - portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceHostingResource()).getUid(),\n - portal.restrictedTraverse(portal.portal_preferences.getPreferredInstanceCleanupResource()).getUid(),\n - ]),\n - operator=\'AND\',\n - ),\n - sort_on=((\'movement.start_date\', \'DESC\'),)\n - )\n - if explanation_delivery_line is None:\n - explanation_delivery_line = sale_order_line\n -\n - if explanation_delivery_line.getPortalType() == \'Sale Packing List Line\':\n - resource = explanation_delivery_line.getResource()\n - if resource == portal.portal_preferences.getPreferredInstanceSetupResource():\n - state = \'stopped\'\n - elif resource == portal.portal_preferences.getPreferredInstanceCleanupResource():\n - state = \'destroyed\'\n - elif resource == portal.portal_preferences.getPreferredInstanceHostingResource():\n - if explanation_delivery_line.getSimulationState() in (\'confirmed\', \'started\'):\n - state = \'started\'\n - else:\n - state = \'stopped\'\n - pass\n - else:\n - raise TypeError(\'Bad resource %s\' % resource)\n - pass\n - else:\n - if explanation_delivery_line.getSimulationState() == \'cancelled\':\n - state = \'destoyed\'\n - else:\n - raise NotImplementedError\n - promise_kw = {\n - \'instance_xml\': context.getTextContent(),\n - \'software_type\': context.getSourceReference(),\n - \'sla_xml\': context.getSlaXml(),\n - \'software_release\': context.getRootSoftwareReleaseUrl(),\n - \'shared\': slap_document.getPortalType() == \'Slave Instance\'\n - }\n -\n - slap_document.setCausalityValue(explanation_delivery_line.getParentValue())\n - if state != \'destroyed\' or explanation_delivery_line.getSimulationState() != \'delivered\':\n - slap_document.setAggregateValue(explanation_delivery_line.getAggregateValue(portal_type=\'Computer Partition\'))\n - assert(slap_document.getAggregate() == explanation_delivery_line.getAggregate(portal_type=\'Computer Partition\'))\n -state_map = {\n - \'started\': \'start_requested\',\n - \'stopped\': \'stop_requested\',\n - \'destroyed\': \'destroy_requested\'\n -}\n -\n -if slap_document.getSlapState() == \'draft\':\n - if state == "started":\n - slap_document.requestStart(comment=\'Migration.\', **promise_kw)\n - elif state == "stopped":\n - slap_document.requestStop(comment=\'Migration.\', **promise_kw)\n - elif state == "destroyed":\n - raise NotImplementedError\n - slap_document.requestDestroy(comment=\'Migration.\', **promise_kw)\n - else:\n - raise ValueError("Unknown state %s for %s" % (state, slap_document.getRelativeUrl()))\n -if not(slap_document.getSlapState() == state_map[state]):\n - raise ValueError(\'%s: %s != %s\' % (state, slap_document.getSlapState(), state_map[state]))\n -\n -# Migrate validation state\n -if portal_type == \'Hosting Subscription\':\n - if state == \'destroyed\':\n - slap_document.validate()\n - slap_document.archive()\n - assert(slap_document.getValidationState() == \'archived\')\n - else:\n - assert(slap_document.getValidationState() == \'validated\')\n -else:\n - if state == \'destroyed\' and \\\n - (explanation_delivery_line.getPortalType() == \'Sale Order Line\' or \\\n - explanation_delivery_line.getSimulationState() == \'delivered\'):\n - slap_document.invalidate()\n - else:\n - assert(slap_document.getValidationState() == \'validated\')\n - - -]]></string> </value> - </item> - <item> - <key> <string>_params</string> </key> - <value> <string></string> </value> - </item> - <item> - <key> <string>id</string> </key> - <value> <string>SlapDocument_migrateSlapState</string> </value> - </item> - </dictionary> - </pickle> - </record> -</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208.xml new file mode 100644 index 0000000000000000000000000000000000000000..5bf9fd699fbc408a786fb51dbaf45ab5b10f76ed --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208.xml @@ -0,0 +1,47 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Folder" module="OFS.Folder"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_local_properties</string> </key> + <value> + <tuple> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>business_template_skin_layer_priority</string> </value> + </item> + <item> + <key> <string>type</string> </key> + <value> <string>float</string> </value> + </item> + </dictionary> + </tuple> + </value> + </item> + <item> + <key> <string>_objects</string> </key> + <value> + <tuple/> + </value> + </item> + <item> + <key> <string>business_template_skin_layer_priority</string> </key> + <value> <float>90.0</float> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>vifib_upgrader_before_201208</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/Computer_updateLocalRoles.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/Computer_updateLocalRoles.xml new file mode 100644 index 0000000000000000000000000000000000000000..71d68ccd11497d81c055a5b264c48609a914d2c0 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/Computer_updateLocalRoles.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Computer_updateLocalRoles</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>VifibUpgrader</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Computer_updateLocalRoles</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_deliverSetupUpdateDelivery.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_deliverSetupUpdateDelivery.xml new file mode 100644 index 0000000000000000000000000000000000000000..1ac57e9e9e127cb9bbb037e7f868b12d74d79632 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_deliverSetupUpdateDelivery.xml @@ -0,0 +1,73 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>context.portal_catalog.searchAndActivate(\n + portal_type=\'Sale Packing List Line\',\n + simulation_state=\'!= delivered\',\n + default_resource_uid=[context.restrictedTraverse(context.portal_preferences.getPreferredInstanceSetupResource()).getUid(),\n + context.restrictedTraverse(context.portal_preferences.getPreferredInstanceUpdateResource()).getUid()],\n + method_id=\'SalePackingListLine_deliver\'\n +)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_deliverSetupUpdateDelivery</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_garbageCollectHostingSubscription.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_garbageCollectHostingSubscription.xml new file mode 100644 index 0000000000000000000000000000000000000000..8a17425ed52b619c9bad812162dbd2edfcb3ef3d --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_garbageCollectHostingSubscription.xml @@ -0,0 +1,71 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>context.getPortalObject().portal_catalog.searchAndActivate(\n + portal_type=[\'Hosting Subscription\'],\n + validation_state=\'validated\',\n + method_id=\'HostingSubscription_garbageCollectForMigration\'\n +)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_garbageCollectHostingSubscription</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_migrateSlapState.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_migrateSlapState.xml similarity index 100% rename from master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_migrateSlapState.xml rename to master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_migrateSlapState.xml diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_removeSimulationOrderedSaleOrder.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_removeSimulationOrderedSaleOrder.xml similarity index 100% rename from master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/ERP5Site_removeSimulationOrderedSaleOrder.xml rename to master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_removeSimulationOrderedSaleOrder.xml diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_updateComputerLocalRoles.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_updateComputerLocalRoles.xml new file mode 100644 index 0000000000000000000000000000000000000000..4585cbb8a042461e0f54e9b5fe6cc1149b160387 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/ERP5Site_updateComputerLocalRoles.xml @@ -0,0 +1,73 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>portal = context.getPortalObject()\n +portal.portal_catalog.searchAndActivate(portal_type=\'Computer Partition\', method_id=\'updateLocalRolesOnSecurityGroups\', activate_kw={\'tag\': \'Computer_updateLocalRoles\'})\n +return "ok"\n +\n +portal.portal_catalog.searchAndActivate(portal_type=\'Computer\', method_id=\'Computer_updateLocalRoles\', activate_kw={\'tag\': \'Computer_updateLocalRoles\'})\n +\n +portal.computer_module.activate(after_tag=\'Computer_updateLocalRoles\').Folder_reindexAll()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>ERP5Site_updateComputerLocalRoles</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/HostingSubscription_garbageCollectForMigration.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/HostingSubscription_garbageCollectForMigration.xml new file mode 100644 index 0000000000000000000000000000000000000000..19bd09ea02fd922b50fd1b9acd5719477ecea6c9 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/HostingSubscription_garbageCollectForMigration.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>HostingSubscription_garbageCollectForMigration</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>VifibUpgrader</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>HostingSubscription_garbageCollectForMigration</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/SaleOrder_removeAppliedRuleOnOrdered.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SaleOrder_removeAppliedRuleOnOrdered.xml similarity index 100% rename from master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader/SaleOrder_removeAppliedRuleOnOrdered.xml rename to master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SaleOrder_removeAppliedRuleOnOrdered.xml diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SalePackingListLine_deliver.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SalePackingListLine_deliver.xml new file mode 100644 index 0000000000000000000000000000000000000000..93734fe31e9426e4fab3ea7f5c33bd10e2930306 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SalePackingListLine_deliver.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>SalePackingListLine_deliver</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>VifibUpgrader</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>SalePackingListLine_deliver</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SlapDocument_migrateSlapState.xml b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SlapDocument_migrateSlapState.xml new file mode 100644 index 0000000000000000000000000000000000000000..b634798a2922fd14ba7bbd301a9f6c70c7856f42 --- /dev/null +++ b/master/bt5/vifib_upgrader/SkinTemplateItem/portal_skins/vifib_upgrader_before_201208/SlapDocument_migrateSlapState.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>SlapDocument_migrateSlapState</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>VifibUpgrader</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>SlapDocument_migrateSlapState</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_upgrader/bt/revision b/master/bt5/vifib_upgrader/bt/revision index 69226f7293aa543649b73a6ed3264cddabfcd8c1..dd1ec209f3358043353ec9054f1d3bf3416d325e 100644 --- a/master/bt5/vifib_upgrader/bt/revision +++ b/master/bt5/vifib_upgrader/bt/revision @@ -1 +1 @@ -92 \ No newline at end of file +132 \ No newline at end of file diff --git a/master/bt5/vifib_upgrader/bt/template_path_list b/master/bt5/vifib_upgrader/bt/template_path_list new file mode 100644 index 0000000000000000000000000000000000000000..b3bf715fb1b64cf3e2de9f49dd4569b76c7c2479 --- /dev/null +++ b/master/bt5/vifib_upgrader/bt/template_path_list @@ -0,0 +1 @@ +portal_alarms/vifib_promise_pas \ No newline at end of file diff --git a/master/bt5/vifib_upgrader/bt/template_registered_skin_selection_list b/master/bt5/vifib_upgrader/bt/template_registered_skin_selection_list index 6884813fb981628d53e9d1b851be186a526f140c..3589844f6f44a7749e88ccf41cba40bf268e6500 100644 --- a/master/bt5/vifib_upgrader/bt/template_registered_skin_selection_list +++ b/master/bt5/vifib_upgrader/bt/template_registered_skin_selection_list @@ -1 +1,2 @@ -vifib_upgrader_20120423 | Outdated \ No newline at end of file +vifib_upgrader_20120423 | Outdated +vifib_upgrader_before_201208 | Outdated \ No newline at end of file diff --git a/master/bt5/vifib_upgrader/bt/template_skin_id_list b/master/bt5/vifib_upgrader/bt/template_skin_id_list index 6615afed3c92a5a0186518e79dd6caffcfe8d134..23ee90e5764bb5970dd961c08744c006b39d1fa5 100644 --- a/master/bt5/vifib_upgrader/bt/template_skin_id_list +++ b/master/bt5/vifib_upgrader/bt/template_skin_id_list @@ -1,2 +1,4 @@ +vifib_promise vifib_upgrader -vifib_upgrader_20120423 \ No newline at end of file +vifib_upgrader_20120423 +vifib_upgrader_before_201208 \ No newline at end of file diff --git a/master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py b/master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py index b96e45ac6f764824dd55912b3d7b9c43de627767..40d2c06900ecf0d4ba3207a25d72d774c2dd8e52 100644 --- a/master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py +++ b/master/bt5/vifib_web/ExtensionTemplateItem/ViFiBWeb.py @@ -26,8 +26,210 @@ ############################################################################## import subprocess +import facebook +from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE +import httplib +import urllib +import urlparse +import json +import apiclient.discovery +import httplib2 +import oauth2client.client +import socket +from Products.ERP5Security.ERP5UserManager import getUserByLogin +from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod def formatXml(self, xml): """Simple way to have nicely formatted XML""" popen = subprocess.Popen(['xmllint', '--format', '--recover', '-'], stdin=subprocess.PIPE, stdout=subprocess.PIPE) - return popen.communicate(xml)[0] \ No newline at end of file + return popen.communicate(xml)[0] + +# common methods +def _getCacheFactory(self, cache_factory_name): + portal = self.getPortalObject() + cache_tool = portal.portal_caches + cache_factory = cache_tool.getRamCacheRoot().get(cache_factory_name) + #XXX This conditional statement should be remove as soon as + #Broadcasting will be enable among all zeo clients. + #Interaction which update portal_caches should interact with all nodes. + if cache_factory is None \ + and getattr(cache_tool, cache_factory_name, None) is not None: + #ram_cache_root is not up to date for current node + cache_tool.updateCache() + return cache_tool.getRamCacheRoot().get(cache_factory_name) + +def setServerToken(self, key, body, cache_factory_name): + cache_factory = _getCacheFactory(self, cache_factory_name) + cache_duration = cache_factory.cache_duration + for cache_plugin in cache_factory.getCachePluginList(): + cache_plugin.set(key, DEFAULT_CACHE_SCOPE, + body, cache_duration=cache_duration) + +def getServerToken(self, key, cache_factory_name): + cache_factory = _getCacheFactory(self, cache_factory_name) + for cache_plugin in cache_factory.getCachePluginList(): + cache_entry = cache_plugin.get(key, DEFAULT_CACHE_SCOPE) + if cache_entry is not None: + return cache_entry.getValue() + raise KeyError('Key %r not found' % key) + +# Facebook AS +def Facebook_setServerToken(self, key, body): + setServerToken(self, key, body, 'facebook_server_auth_token_cache_factory') + +def Facebook_getServerToken(self, key): + return getServerToken(self, key, 'facebook_server_auth_token_cache_factory') + +def Facebook_getAccessTokenFromCode(self, code, redirect_uri): + return facebook.get_access_token_from_code(code=code, + redirect_uri=redirect_uri, + app_id=self.portal_preferences.getPreferredVifibFacebookApplicationId(), + app_secret=self.portal_preferences.getPreferredVifibFacebookApplicationSecret()) + +# Google AS +def Google_setServerToken(self, key, body): + setServerToken(self, key, body, 'google_server_auth_token_cache_factory') + +def Google_getServerToken(self, key): + return getServerToken(self, key, 'google_server_auth_token_cache_factory') + +def Google_getAccessTokenFromCode(self, code, redirect_uri): + connection_kw = {'host': 'accounts.google.com', 'timeout': 30} + connection = httplib.HTTPSConnection(**connection_kw) + data = { + 'client_id': self.portal_preferences.getPreferredVifibGoogleApplicationId(), + 'client_secret': self.portal_preferences.getPreferredVifibGoogleApplicationSecret(), + 'grant_type': 'authorization_code', + 'redirect_uri': redirect_uri, + 'code': code + } + data = urllib.urlencode(data) + headers = { + "Content-Type": "application/x-www-form-urlencoded", + "Accept": "*/*" + } + connection.request('POST', '/o/oauth2/token', data, headers) + response = connection.getresponse() + + if response.status != 200: + return None + + try: + body = json.loads(response.read()) + except Exception: + return None + + try: + return body + except Exception: + return None + +def Facebook_getUserId(access_token): + facebook_entry = facebook.GraphAPI(access_token).get_object("me") + return facebook_entry['id'].encode('utf-8') + +def Google_getUserId(access_token): + timeout = socket.getdefaulttimeout() + try: + socket.setdefaulttimeout(10) + http = oauth2client.client.AccessTokenCredentials(access_token, 'Vifib' + ).authorize(httplib2.Http()) + service = apiclient.discovery.build("oauth2", "v1", http=http) + google_entry = service.userinfo().get().execute() + except Exception: + google_entry = None + finally: + socket.setdefaulttimeout(timeout) + + if google_entry is not None: + return google_entry['id'].encode('utf-8') + return None + +def Facebook_checkUserExistence(self): + hash = self.REQUEST.get('__ac_facebook_hash') + try: + access_token_dict = Facebook_getServerToken(self, hash) + except KeyError: + return False + access_token = access_token_dict.get('access_token') + url = urlparse.urlsplit(self.portal_preferences.getPreferredVifibRestApiLoginCheck()) + connection_kw = {'host': url.netloc, 'timeout': 30} + if url.scheme == 'http': + connection = httplib.HTTPConnection(**connection_kw) + else: + connection = httplib.HTTPSConnection(**connection_kw) + connection.request('GET', url.path, headers = { + 'Authorization' : 'Facebook %s' % access_token, + 'Accept': 'application/json'}) + response = connection.getresponse() + + # user exist if server gave some correct response without waiting for user + return response.status in (200, 204) + +def Google_checkUserExistence(self): + hash = self.REQUEST.get('__ac_google_hash') + try: + access_token_dict = Google_getServerToken(self, hash) + except KeyError: + return False + access_token = access_token_dict.get('access_token') + url = urlparse.urlsplit(self.portal_preferences.getPreferredVifibRestApiLoginCheck()) + connection_kw = {'host': url.netloc, 'timeout': 30} + if url.scheme == 'http': + connection = httplib.HTTPConnection(**connection_kw) + else: + connection = httplib.HTTPSConnection(**connection_kw) + connection.request('GET', url.path, headers = { + 'Authorization' : 'Google %s' % access_token, + 'Accept': 'application/json'}) + response = connection.getresponse() + + # user exist if server gave some correct response without waiting for user + return response.status in (200, 204) + +# Browser ID +def BrowserID_setServerToken(self, key, body): + setServerToken(self, key, body, 'browser_id_auth_token_cache_factory') + +def BrowserID_getServerToken(self, key): + return getServerToken(self, key, 'browser_id_auth_token_cache_factory') + + +def BrowserID_validateAssertion(self, assertion): + connection = httplib.HTTPSConnection(host='browserid.org', timeout=5) + data = urllib.urlencode({'assertion': assertion, + 'audience': self.REQUEST.get('SERVER_URL')}) + headers = {'Content-type': 'application/x-www-form-urlencoded'} + connection.request('POST', '/verify', data, headers) + response = connection.getresponse() + + if response.status != 200: + return None + + try: + body = json.loads(response.read()) + except Exception: + return None + + return body + +@UnrestrictedMethod +def BrowserID_checkUserExistence(self): + hash = self.REQUEST.get('__ac_browser_id_hash') + try: + user_dict = BrowserID_getServerToken(self, hash) + except KeyError: + return False + user = user_dict['login'] + tag = '%s_user_creation_in_progress' % user + person_list = getUserByLogin(self.getPortalObject(), user) + if len(person_list) == 0: + if self.getPortalObject().portal_activities.countMessageWithTag(tag) == 0: + user_entry = {'reference': user, + 'email': user[4:], + 'first_name': None, + 'last_name': None} + self.Base_createOauth2User(tag, **user_entry) + return False + else: + return True diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getNonEditableAbsoluteUrl.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getNonEditableAbsoluteUrl.xml new file mode 100644 index 0000000000000000000000000000000000000000..a7e7c69acbf52ba62ab09ed9be65c09b8adf2aec --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Base_getNonEditableAbsoluteUrl.xml @@ -0,0 +1,67 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>return "%s?editable_mode:int=0" % context.absolute_url()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>**kw</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Base_getNonEditableAbsoluteUrl</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..89e1d06b357d1560573cd09ab341aef3962c1245 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_checkUserExistence.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>BrowserID_checkUserExistence</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BrowserID_checkUserExistence</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..e6aa02c5637e1c6d0e97bd8c8b31de0c8263ed35 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_setServerToken.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>BrowserID_setServerToken</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BrowserID_setServerToken</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml new file mode 100644 index 0000000000000000000000000000000000000000..1593e982343db9aa2da7b2fe490d2fb16769d093 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/BrowserID_validateAssertion.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>BrowserID_validateAssertion</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>BrowserID_validateAssertion</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewSoftwareReleaseManageDialog/my_reinstall_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewSoftwareReleaseManageDialog/my_reinstall_button.xml index d68ceb06bba5cfab06ec6910696bf5075e7b5564..d7220df3d88233e60e640b179bf7b4f8c3a6662a 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewSoftwareReleaseManageDialog/my_reinstall_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Computer_viewSoftwareReleaseManageDialog/my_reinstall_button.xml @@ -66,9 +66,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>field_id</string> </key> @@ -81,7 +79,7 @@ <item> <key> <string>href</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> <item> @@ -138,19 +136,6 @@ </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="TALESMethod" module="Products.Formulator.TALESField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string>python: context.getPortalObject().Base_checkPermission(\'software_instance_module\', \'Add portal content\')</string> </value> - </item> - </dictionary> - </pickle> - </record> - <record id="3" aka="AAAAAAAAAAM="> <pickle> <global name="TALESMethod" module="Products.Formulator.TALESField"/> </pickle> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_checkUserExistence.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_checkUserExistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..4605522433e0c587deaa17efea96b1ea0710783d --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_checkUserExistence.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Facebook_checkUserExistence</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Facebook_checkUserExistence</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getAccessTokenFromCode.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getAccessTokenFromCode.xml new file mode 100644 index 0000000000000000000000000000000000000000..f894dc7fa5aa2c4ba849b6f27b05de9acb959e51 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getAccessTokenFromCode.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Facebook_getAccessTokenFromCode</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Facebook_getAccessTokenFromCode</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getServerToken.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getServerToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..67fc045a3fa892065344c47d9c02e44348987a27 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getServerToken.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Facebook_getServerToken</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Facebook_getServerToken</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getUserId.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getUserId.xml new file mode 100644 index 0000000000000000000000000000000000000000..b39bbf6efabf036a110be78fb454b6ec8c3a73f1 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_getUserId.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Facebook_getUserId</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Facebook_getUserId</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_setServerToken.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_setServerToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..4ca82b42af3d0b01bcc45cbea903d278e2dfa18c --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Facebook_setServerToken.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Facebook_setServerToken</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Facebook_setServerToken</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_checkUserExistence.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_checkUserExistence.xml new file mode 100644 index 0000000000000000000000000000000000000000..0bcae7b9aeb4a544dc94b1766e962f6ec39e4613 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_checkUserExistence.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Google_checkUserExistence</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Google_checkUserExistence</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getAccessTokenFromCode.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getAccessTokenFromCode.xml new file mode 100644 index 0000000000000000000000000000000000000000..d0adfe9a7577974ea11d28d22d36fec7e195b5bd --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getAccessTokenFromCode.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Google_getAccessTokenFromCode</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Google_getAccessTokenFromCode</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getServerToken.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getServerToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..2a338c3b16cba2cedd7fffa1da49a1b2d35538e5 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getServerToken.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Google_getServerToken</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Google_getServerToken</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getUserId.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getUserId.xml new file mode 100644 index 0000000000000000000000000000000000000000..c8470b08ff4f8939e21c2b2dd0eb1edc5a993bf7 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_getUserId.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Google_getUserId</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Google_getUserId</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_setServerToken.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_setServerToken.xml new file mode 100644 index 0000000000000000000000000000000000000000..9b2533411686dfc4e8732298a3b3bccdd5e124d4 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/Google_setServerToken.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ExternalMethod" module="Products.ExternalMethod.ExternalMethod"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_function</string> </key> + <value> <string>Google_setServerToken</string> </value> + </item> + <item> + <key> <string>_module</string> </key> + <value> <string>ViFiBWeb</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>Google_setServerToken</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_getConnectionParameterList.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_getConnectionParameterList.xml new file mode 100644 index 0000000000000000000000000000000000000000..b5ebedc126a998c4a72e664d128a3c1e883b4d7e --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_getConnectionParameterList.xml @@ -0,0 +1,78 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>title = context.getTitle()\n +result = []\n +found = False\n +for instance in context.getPredecessorValueList():\n + if (instance.getTitle() == title) and (instance.getSlapState() != \'destroy_requested\'):\n + found = True\n + break\n +\n +if found:\n + result = instance.SoftwareInstance_getConnectionParameterList()\n +\n +return result\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>*args, **kwargs</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>HostingSubscription_getConnectionParameterList</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_requestPerson.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_requestPerson.xml index b666979a2f9a9e4cfca57435abf1c2e901c9f1f9..a9740d37b5004d213b7392dd0b3de6873994449c 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_requestPerson.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_requestPerson.xml @@ -55,7 +55,7 @@ if state is None:\n state = {\'start_requested\': \'started\', \'destroy_requested\': \'destroyed\', \'stop_requested\': \'stopped\'}[context.getSlapState()]\n \n -person = context.ERP5Site_getAuthenticatedMemberPersonValue()\n +person = context.getDestinationSectionValue()\n person.requestSoftwareInstance(\n state=state,\n software_release=context.getRootSoftwareReleaseUrl(),\n diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb.xml index 33a858cd88d05fa5434220985c5855fb44267ab3..2b0645697eb549b808c0273da6aa4c29b0149d02 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb.xml @@ -75,6 +75,7 @@ <key> <string>bottom</string> </key> <value> <list> + <string>listbox</string> <string>my_destroy_button</string> </list> </value> @@ -82,10 +83,7 @@ <item> <key> <string>center</string> </key> <value> - <list> - <string>your_instance_xml</string> - <string>my_update_button</string> - </list> + <list/> </value> </item> <item> @@ -102,19 +100,22 @@ <value> <list> <string>my_title</string> - <string>listbox</string> + <string>my_root_software_release_url</string> + <string>my_source_reference</string> <string>last_event_listbox</string> <string>my_translated_slap_state_title</string> + <string>your_instance_xml</string> + <string>my_update_button</string> + <string>my_start_button</string> + <string>my_stop_button</string> + <string>your_connection_listbox</string> </list> </value> </item> <item> <key> <string>right</string> </key> <value> - <list> - <string>my_start_button</string> - <string>my_stop_button</string> - </list> + <list/> </value> </item> </dictionary> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/listbox.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/listbox.xml index 0d5896f637d398a17a1e9adddd1d93ab10af5efb..2fd9bab8d3aeceabc558fc0cab4969d409df852c 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/listbox.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/listbox.xml @@ -17,6 +17,7 @@ <string>select</string> <string>selection_name</string> <string>title</string> + <string>url_columns</string> </list> </value> </item> @@ -153,6 +154,21 @@ <key> <string>title</string> </key> <value> <string>My Software Instances</string> </value> </item> + <item> + <key> <string>url_columns</string> </key> + <value> + <list> + <tuple> + <string>title</string> + <string>Base_getNonEditableAbsoluteUrl</string> + </tuple> + <tuple> + <string>status</string> + <string>Base_getNonEditableAbsoluteUrl</string> + </tuple> + </list> + </value> + </item> </dictionary> </value> </item> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_destroy_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_destroy_button.xml index 862b40b64ce918e312f17c635d7eead759499d23..7a2df8299db13656179d88fa226573e6a65f57f9 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_destroy_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_destroy_button.xml @@ -105,7 +105,7 @@ <dictionary> <item> <key> <string>css_class</string> </key> - <value> <string>nolabel cancel widthAuto</string> </value> + <value> <string>alignr nolabel cancel widthAuto</string> </value> </item> <item> <key> <string>default</string> </key> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_root_software_release_url.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_root_software_release_url.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc0351f103e5f5af60100d823e705aacdd27ea48 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_root_software_release_url.xml @@ -0,0 +1,311 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_root_software_release_url</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string>nolabel</string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>URL</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +python: "<a href=%s>%s</a>" % (context.getRootSoftwareReleaseUrl(), context.getRootSoftwareReleaseUrl()) + +]]></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_source_reference.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_source_reference.xml new file mode 100644 index 0000000000000000000000000000000000000000..27b7b24b624f8c201d4e29e287a7be2cf61d4776 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_source_reference.xml @@ -0,0 +1,260 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="StringField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_source_reference</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string>inline</string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Software Type</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_start_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_start_button.xml index 22586573fa7b1c0e03d7a7d7c7d7031487d5ebb6..ce7fcd6a509a6dabc85acc4e224fcd269b3f4cc0 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_start_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_start_button.xml @@ -105,7 +105,7 @@ <dictionary> <item> <key> <string>css_class</string> </key> - <value> <string>nolabel validate widthAuto</string> </value> + <value> <string>alignr nolabel validate widthAuto</string> </value> </item> <item> <key> <string>default</string> </key> @@ -153,7 +153,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.getSlapState() != \'destroy_requested\'</string> </value> + <value> <string>python: here.getSlapState() == \'stop_requested\'</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_stop_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_stop_button.xml index df0e73cd311803f8fb71596a09566560cb6a28ba..0835183ab6986173e234fdfa63b3000b10a9847c 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_stop_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_stop_button.xml @@ -105,7 +105,7 @@ <dictionary> <item> <key> <string>css_class</string> </key> - <value> <string>nolabel cancel widthAuto</string> </value> + <value> <string>alignr nolabel cancel widthAuto</string> </value> </item> <item> <key> <string>default</string> </key> @@ -153,7 +153,7 @@ <dictionary> <item> <key> <string>_text</string> </key> - <value> <string>python: here.getSlapState() != \'destroy_requested\'</string> </value> + <value> <string>python: here.getSlapState() == \'start_requested\'</string> </value> </item> </dictionary> </pickle> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_update_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_update_button.xml index f50aafaf44cd6d51832525257326d2eed8413d12..e347d95a64d8d877b57ce1941e8c4ab2e927bdb1 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_update_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/my_update_button.xml @@ -99,7 +99,7 @@ <dictionary> <item> <key> <string>css_class</string> </key> - <value> <string>nolabel validate</string> </value> + <value> <string>alignr nolabel validate</string> </value> </item> <item> <key> <string>default</string> </key> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/your_connection_listbox.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/your_connection_listbox.xml new file mode 100644 index 0000000000000000000000000000000000000000..feeb7ad5c649b850c4fb4839c9e63fb67e71cc5c --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/HostingSubscription_viewAsWeb/your_connection_listbox.xml @@ -0,0 +1,623 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="ListBox" module="Products.ERP5Form.ListBox"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>your_connection_listbox</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>all_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>anchor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>count_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_display_style</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_style_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>domain_root_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>domain_tree</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>global_attributes</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>global_search_column</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hide_rows_on_no_search_criterion</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_action</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>meta_types</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>page_navigation_template</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>page_template</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>portal_types</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>report_root_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>report_tree</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>row_css_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>select</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>selection_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>stat_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>stat_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>style_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>untranslatable_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>url_columns</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>all_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>anchor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>count_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_display_style</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_style_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>domain_root_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>domain_tree</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>global_attributes</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>global_search_column</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hide_rows_on_no_search_criterion</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_action</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>meta_types</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>page_navigation_template</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>page_template</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>portal_types</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>report_root_list</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>report_tree</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>row_css_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>select</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>selection_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>sort_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>stat_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>stat_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>style_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>untranslatable_columns</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>url_columns</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>all_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>anchor</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>columns</string> </key> + <value> + <list> + <tuple> + <string>connection_key</string> + <string>Key</string> + </tuple> + <tuple> + <string>connection_value</string> + <string>Value</string> + </tuple> + </list> + </value> + </item> + <item> + <key> <string>count_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default_display_style</string> </key> + <value> <string>table</string> </value> + </item> + <item> + <key> <string>default_params</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_style_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>domain_root_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>domain_tree</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>editable_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>global_attributes</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>global_search_column</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>hide_rows_on_no_search_criterion</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>lines</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>list_action</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>list_method</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>meta_types</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>page_navigation_template</string> </key> + <value> <string>ListBox_viewSliderPageNavigationRenderer</string> </value> + </item> + <item> + <key> <string>page_template</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>portal_types</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>report_root_list</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>report_tree</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>row_css_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>search</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>search_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>select</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>selection_name</string> </key> + <value> <string>hosting_subscription_connection_selection</string> </value> + </item> + <item> + <key> <string>sort</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>sort_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>stat_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>stat_method</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>style_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Connection Parameters</string> </value> + </item> + <item> + <key> <string>untranslatable_columns</string> </key> + <value> + <list/> + </value> + </item> + <item> + <key> <string>url_columns</string> </key> + <value> + <list> + <tuple> + <string>connection_key</string> + <string>SoftwareInstanceConnectionKey_renderURL</string> + </tuple> + <tuple> + <string>connection_value</string> + <string>SoftwareInstanceConnectionValue_renderURL</string> + </tuple> + </list> + </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="Method" module="Products.Formulator.MethodField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>method_name</string> </key> + <value> <string>HostingSubscription_getConnectionParameterList</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb.xml index 801714bd3de8e9dc19f80d0926bba6fa735662e4..e46ce76338710f935cfc4c598351a2dd9ae8bf70 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb.xml @@ -90,9 +90,11 @@ <string>my_section_title</string> <string>my_reference</string> <string>my_title</string> - <string>your_status</string> <string>your_new_title</string> <string>my_update_button</string> + <string>my_root_software_release_url</string> + <string>my_source_reference</string> + <string>your_status</string> </list> </value> </item> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_root_software_release_url.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_root_software_release_url.xml new file mode 100644 index 0000000000000000000000000000000000000000..dc0351f103e5f5af60100d823e705aacdd27ea48 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_root_software_release_url.xml @@ -0,0 +1,311 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_root_software_release_url</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string>nolabel</string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>URL</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +python: "<a href=%s>%s</a>" % (context.getRootSoftwareReleaseUrl(), context.getRootSoftwareReleaseUrl()) + +]]></string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_source_reference.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_source_reference.xml new file mode 100644 index 0000000000000000000000000000000000000000..27b7b24b624f8c201d4e29e287a7be2cf61d4776 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_source_reference.xml @@ -0,0 +1,260 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="StringField" module="Products.Formulator.StandardFields"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>my_source_reference</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>Too much input was given.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string>inline</string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_maxwidth</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>20</int> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Software Type</string> </value> + </item> + <item> + <key> <string>truncate</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_title.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_title.xml index d7b7d71dee41c59eccbb84a1bc257b7f93a26eb9..f5eb076f59f480b2296d0edf72600ea1ae739cdf 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_title.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_title.xml @@ -12,6 +12,7 @@ <list> <string>css_class</string> <string>editable</string> + <string>enabled</string> <string>title</string> </list> </value> @@ -81,6 +82,10 @@ <key> <string>editable</string> </key> <value> <int>0</int> </value> </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>0</int> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string>my_string_field</string> </value> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_update_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_update_button.xml index f3ed4264d613beea25a6faeb08f9ab881da0cd7a..96108be51f632f9e757e1482214ab0641a075aa8 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_update_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/my_update_button.xml @@ -76,7 +76,7 @@ <dictionary> <item> <key> <string>css_class</string> </key> - <value> <string>nolabel validate</string> </value> + <value> <string>nolabel validate alignr</string> </value> </item> <item> <key> <string>default</string> </key> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/your_new_title.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/your_new_title.xml index f1c4f5ab8f14a463105b2a7253a521742b713689..57adf4ad4e42d70683b128f771d958fa81c6814e 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/your_new_title.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareInstance_viewAsWeb/your_new_title.xml @@ -12,6 +12,7 @@ <list> <string>css_class</string> <string>default</string> + <string>display_width</string> <string>title</string> </list> </value> @@ -95,6 +96,10 @@ <key> <string>default</string> </key> <value> <string></string> </value> </item> + <item> + <key> <string>display_width</string> </key> + <value> <int>30</int> </value> + </item> <item> <key> <string>field_id</string> </key> <value> <string>my_string_field</string> </value> @@ -109,7 +114,7 @@ </item> <item> <key> <string>title</string> </key> - <value> <string>New Name</string> </value> + <value> <string>Name</string> </value> </item> </dictionary> </value> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_requestFromDialog.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_requestFromDialog.xml index 9e5df0cc884f40888d7dc70b6a4be61ad8f12046..3403d82c11603bf5d2cd88c686e9bda8fffec3d5 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_requestFromDialog.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_requestFromDialog.xml @@ -50,17 +50,7 @@ </item> <item> <key> <string>_body</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -portal = context.getPortalObject()\n -\n -if not instance_xml:\n - instance_xml = """<?xml version="1.0" encoding="utf-8"?>\n - <instance>\n - <parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n - <parameter id="nbd_port">1024</parameter>\n - </instance>\n - """\n + <value> <string>portal = context.getPortalObject()\n \n if not service_title:\n service_title = "Vifib KVM %i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n @@ -84,9 +74,7 @@ person.requestSoftwareInstance(**request_kw)\n \n message = context.Base_translateString("Your instance is under creation. Please wait few minutes for partitions to appear.")\n return context.REQUEST.get(\'request_hosting_subscription\').Base_redirect(keep_items={\'portal_status_message\': message})\n - - -]]></string> </value> +</string> </value> </item> <item> <key> <string>_params</string> </key> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_viewRequestDialog/your_instance_xml.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_viewRequestDialog/your_instance_xml.xml index eaca6820965815397bbd54ab9fb223d69fa50669..a65c9c03caa1888bb9a33a7a65585f2ffdb12306 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_viewRequestDialog/your_instance_xml.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/SoftwareRelease_viewRequestDialog/your_instance_xml.xml @@ -213,8 +213,6 @@ <?xml version="1.0" encoding="utf-8"?>\n <instance>\n -<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n -<parameter id="nbd_port">1024</parameter>\n </instance> ]]></string> </value> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_browserIdInitiateLogin.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_browserIdInitiateLogin.xml new file mode 100644 index 0000000000000000000000000000000000000000..6591ef3aee89d4aa11b0a72af4feccc5aecac297 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_browserIdInitiateLogin.xml @@ -0,0 +1,86 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>def loginFailed():\n + context.getWebSiteValue().login_form.Base_redirect(keep_items={\'portal_status_message\': \'Login with Browser ID failed.\'})\n +assertion = context.REQUEST.get(\'assertion\')\n +data = context.BrowserID_validateAssertion(assertion)\n +\n +if data is None:\n + return loginFailed()\n +\n +if data.get(\'status\', \'failure\') != \'okay\':\n + return loginFailed()\n +\n +login = data.get(\'email\', \'\').encode(\'utf-8\')\n +\n +if login == \'\':\n + return loginFailed()\n +\n +hash = context.Base_getHMAC(assertion, assertion)\n +context.REQUEST.RESPONSE.setCookie(\'__ac_browser_id_hash\', hash, path=\'/\')\n +context.BrowserID_setServerToken(hash, {"login": \'bid_\' + login})\n +return context.REQUEST.RESPONSE.redirect(context.getWebSiteValue().absolute_url())\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSection_browserIdInitiateLogin</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookCallbackLogin.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookCallbackLogin.xml new file mode 100644 index 0000000000000000000000000000000000000000..6147ac9b777389ba4ef85fde0cbd29282d460afb --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookCallbackLogin.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>get = context.REQUEST.get\n +\n +def handleError():\n + context.Base_redirect(\'login_form\', keep_items={"portal_status_message": "There was problem with Facebook login: %s. Please try again later." % get(\'error_description\')})\n +\n +if get(\'error\') is not None:\n + return handleError()\n +elif get(\'code\') is not None:\n + access_token_dict = context.Facebook_getAccessTokenFromCode(get(\'code\'), context.absolute_url())\n + if access_token_dict is not None:\n + access_token = access_token_dict[\'access_token\']\n + access_token_dict[\'login\'] = \'fb_\' + context.Facebook_getUserId(access_token)\n + hash = context.Base_getHMAC(access_token, access_token)\n + context.REQUEST.RESPONSE.setCookie(\'__ac_facebook_hash\', hash, path=\'/\')\n + context.Facebook_setServerToken(hash, access_token_dict)\n + return context.REQUEST.RESPONSE.redirect(context.getWebSiteValue().absolute_url())\n +return handleError()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>code=None, access_token=None, error_reason=None, error=None, error_description=None</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSection_facebookCallbackLogin</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookInitiateLogin.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookInitiateLogin.xml new file mode 100644 index 0000000000000000000000000000000000000000..efc52318c6cbb676532be9b9bdfb38c7246f60ed --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_facebookInitiateLogin.xml @@ -0,0 +1,74 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>from ZTUtils import make_query\n +query = make_query({\n + \'client_id\': context.portal_preferences.getPreferredVifibFacebookApplicationId(),\n + \'redirect_uri\': context.facebook_callback.absolute_url(),\n + \'scope\': \'email\'\n +})\n +\n +context.REQUEST.RESPONSE.redirect(\'\'\'https://www.facebook.com/dialog/oauth?\'\'\' + query)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSection_facebookInitiateLogin</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleCallbackLogin.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleCallbackLogin.xml new file mode 100644 index 0000000000000000000000000000000000000000..685e2e62d46fbc6cf13a941bf326df8a8bc7e896 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleCallbackLogin.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>get = context.REQUEST.get\n +\n +def handleError():\n + context.Base_redirect(\'login_form\', keep_items={"portal_status_message": "There was problem with Google login: %s. Please try again later." % get(\'error\')})\n +\n +if get(\'error\') is not None:\n + return handleError()\n +elif get(\'code\') is not None:\n + access_token_dict = context.Google_getAccessTokenFromCode(get(\'code\'), context.absolute_url())\n + if access_token_dict is not None:\n + access_token = access_token_dict[\'access_token\'].encode(\'utf-8\')\n + access_token_dict[\'login\'] = \'go_\' + context.Google_getUserId(access_token)\n + hash = context.Base_getHMAC(access_token, access_token)\n + context.REQUEST.RESPONSE.setCookie(\'__ac_google_hash\', hash, path=\'/\')\n + context.Google_setServerToken(hash, access_token_dict)\n + return context.REQUEST.RESPONSE.redirect(context.getWebSiteValue().absolute_url())\n +return handleError()\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>code=None, error=None</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSection_googleCallbackLogin</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleInitiateLogin.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleInitiateLogin.xml new file mode 100644 index 0000000000000000000000000000000000000000..03e667f6d1f1a222a4f2a4b821b62a0bd1c1b98a --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_googleInitiateLogin.xml @@ -0,0 +1,75 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>from ZTUtils import make_query\n +query = make_query({\n + \'response_type\': \'code\',\n + \'client_id\': context.portal_preferences.getPreferredVifibGoogleApplicationId(),\n + \'redirect_uri\': context.google_callback.absolute_url(),\n + \'scope\': \'https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/userinfo.email\'\n +})\n +\n +context.REQUEST.RESPONSE.redirect(\'\'\'https://accounts.google.com/o/oauth2/auth?\'\'\' + query)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSection_googleInitiateLogin</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibKVM.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibKVM.xml index 736c58509feba0d5f723fba8751aae794099b051..9c485a85cc7aa216a7f141872fe3db1e87d6eaff 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibKVM.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_orderVifibKVM.xml @@ -54,13 +54,16 @@ portal = context.getPortalObject()\n \n -instance_xml = """<?xml version="1.0" encoding="utf-8"?>\n +instance_xml = """<?xml version=\'1.0\' encoding=\'utf-8\'?>\n <instance>\n -<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n -<parameter id="nbd_port">1024</parameter>\n -</instance>\n -"""\n -url = "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.68:/software/kvm/software.cfg"\n + <parameter id="frontend-instance-guid">SOFTINST-11031</parameter>\n + <parameter id="frontend-software-type">frontend</parameter>\n + <parameter id="nbd_port">1024</parameter>\n + <parameter id="nbd_ip">debian.nbd.vifib.net</parameter>\n + <parameter id="frontend-software-url">http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg</parameter>\n +</instance>"""\n +url = "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg"\n +software_type = "kvm"\n \n person = portal.ERP5Site_getAuthenticatedMemberPersonValue()\n \n @@ -69,7 +72,7 @@ request_kw = {}\n request_kw.update(\n software_release=url,\n software_title="Vifib KVM %i" % portal.portal_ids.generateNewId(id_group=("vifib", "kvm"), default=1),\n - software_type="RootSoftwareInstance",\n + software_type=software_type,\n instance_xml=instance_xml,\n sla_xml="",\n shared=False,\n diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewServiceChoiceDialog/your_instance_xml.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewServiceChoiceDialog/your_instance_xml.xml index eaca6820965815397bbd54ab9fb223d69fa50669..a65c9c03caa1888bb9a33a7a65585f2ffdb12306 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewServiceChoiceDialog/your_instance_xml.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewServiceChoiceDialog/your_instance_xml.xml @@ -213,8 +213,6 @@ <?xml version="1.0" encoding="utf-8"?>\n <instance>\n -<parameter id="nbd_ip">2a01:e35:2e27:460:e2cb:4eff:fed9:48dc</parameter>\n -<parameter id="nbd_port">1024</parameter>\n </instance> ]]></string> </value> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder.xml index 7c0fa09b4b159970f6e2e21fd393ec2402a3d05f..0eac5cb479800022a1b65045a1518f94b688b86b 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder.xml @@ -103,7 +103,11 @@ <item> <key> <string>normal</string> </key> <value> - <list/> + <list> + <string>your_user_preparation_facebook</string> + <string>your_user_preparation_google</string> + <string>your_user_preparation_browser_id</string> + </list> </value> </item> <item> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/my_pay_button.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/my_pay_button.xml index 6aa201b82b6be8d67cb9711c22b575560a8cddbb..fac1b1b5abe972e97bebf2a31ecc0b4bcb90e7e6 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/my_pay_button.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/my_pay_button.xml @@ -66,9 +66,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>field_id</string> </key> @@ -81,7 +79,7 @@ <item> <key> <string>href</string> </key> <value> - <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> </value> </item> <item> @@ -138,19 +136,6 @@ </pickle> </record> <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="TALESMethod" module="Products.Formulator.TALESField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string>python: here.ERP5Site_getAuthenticatedMemberPersonValue().Person_getOutstandingPayment() is not None</string> </value> - </item> - </dictionary> - </pickle> - </record> - <record id="3" aka="AAAAAAAAAAM="> <pickle> <global name="TALESMethod" module="Products.Formulator.TALESField"/> </pickle> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_in_progress_js.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_in_progress_js.xml index 9da01cfb964a1651117fb2f37b9ac319dc0ecfc6..bbf9e3e672d32c392d287ee4eedfec44ed7ac7e3 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_in_progress_js.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_in_progress_js.xml @@ -146,9 +146,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>external_validator</string> </key> @@ -304,21 +302,4 @@ Registration Payment is begin processed. It will take some time. </dictionary> </pickle> </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="TALESMethod" module="Products.Formulator.TALESField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -python: here.ERP5Site_getAuthenticatedMemberPersonValue().Person_countPayment([\'confirmed\']) > 0 - -]]></string> </value> - </item> - </dictionary> - </pickle> - </record> </ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_preparation_js.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_preparation_js.xml index 57cd2d234d72e5907368c9c83487d8f96c8edbf5..fc6c36b5c5630123abb2816200ed94e48b3db564 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_preparation_js.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_payment_preparation_js.xml @@ -146,9 +146,7 @@ </item> <item> <key> <string>enabled</string> </key> - <value> - <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> - </value> + <value> <string></string> </value> </item> <item> <key> <string>external_validator</string> </key> @@ -304,21 +302,4 @@ Registration Payment Information are being updated. Please wait a while. </dictionary> </pickle> </record> - <record id="2" aka="AAAAAAAAAAI="> - <pickle> - <global name="TALESMethod" module="Products.Formulator.TALESField"/> - </pickle> - <pickle> - <dictionary> - <item> - <key> <string>_text</string> </key> - <value> <string encoding="cdata"><![CDATA[ - -python: (here.ERP5Site_getAuthenticatedMemberPersonValue().Person_countPayment() == 0 or here.ERP5Site_getAuthenticatedMemberPersonValue().Person_countPayment([\'planned\']) > 0) and here.ERP5Site_getAuthenticatedMemberPersonValue().Person_getOutstandingPayment() is None - -]]></string> </value> - </item> - </dictionary> - </pickle> - </record> </ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_browser_id.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_browser_id.xml new file mode 100644 index 0000000000000000000000000000000000000000..26f4b0cbe9406e2e271f782ac491263266bd9b2b --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_browser_id.xml @@ -0,0 +1,335 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>your_user_preparation_browser_id</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<script type="text/JavaScript">\n +<!--\n +function timedRefresh(timeoutPeriod) {\n +setTimeout("location.reload(true);",timeoutPeriod);\n +}\n +timedRefresh(3000);\n +// -->\n +</script>\n +<p><img src="ERP5VCS_imgs/wait.gif"></p>\n +We are preparing your user. + +]]></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>your_user_preparation</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: here.REQUEST.get(\'__ac_browser_id_hash\') is not None and not here.BrowserID_checkUserExistence(here)</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_facebook.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_facebook.xml new file mode 100644 index 0000000000000000000000000000000000000000..5e84ac05414c7cbc78971f44daae2f950274c25f --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_facebook.xml @@ -0,0 +1,335 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>your_user_preparation_facebook</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<script type="text/JavaScript">\n +<!--\n +function timedRefresh(timeoutPeriod) {\n +setTimeout("location.reload(true);",timeoutPeriod);\n +}\n +timedRefresh(3000);\n +// -->\n +</script>\n +<p><img src="ERP5VCS_imgs/wait.gif"></p>\n +We are preparing your user. + +]]></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>your_user_preparation</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: here.REQUEST.get(\'__ac_facebook_hash\') is not None and not here.Facebook_checkUserExistence()</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_google.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_google.xml new file mode 100644 index 0000000000000000000000000000000000000000..94921076ef6c2a90eec2b41fb0b6f71ed282a3d5 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSection_viewVifibKVMOrder/your_user_preparation_google.xml @@ -0,0 +1,335 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="EditorField" module="Products.ERP5Form.EditorField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>id</string> </key> + <value> <string>your_user_preparation_google</string> </value> + </item> + <item> + <key> <string>message_values</string> </key> + <value> + <dictionary> + <item> + <key> <string>external_validator_failed</string> </key> + <value> <string>The input failed the external validator.</string> </value> + </item> + <item> + <key> <string>line_too_long</string> </key> + <value> <string>A line was too long.</string> </value> + </item> + <item> + <key> <string>required_not_found</string> </key> + <value> <string>Input is required but no input given.</string> </value> + </item> + <item> + <key> <string>too_long</string> </key> + <value> <string>You entered too many characters.</string> </value> + </item> + <item> + <key> <string>too_many_lines</string> </key> + <value> <string>You entered too many lines.</string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>overrides</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>tales</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent> + </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> + <persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent> + </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <string></string> </value> + </item> + </dictionary> + </value> + </item> + <item> + <key> <string>values</string> </key> + <value> + <dictionary> + <item> + <key> <string>alternate_name</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>css_class</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>default</string> </key> + <value> <string encoding="cdata"><![CDATA[ + +<script type="text/JavaScript">\n +<!--\n +function timedRefresh(timeoutPeriod) {\n +setTimeout("location.reload(true);",timeoutPeriod);\n +}\n +timedRefresh(3000);\n +// -->\n +</script>\n +<p><img src="ERP5VCS_imgs/wait.gif"></p>\n +We are preparing your user. + +]]></string> </value> + </item> + <item> + <key> <string>description</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>editable</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>enabled</string> </key> + <value> <int>1</int> </value> + </item> + <item> + <key> <string>external_validator</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>extra</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>5</int> </value> + </item> + <item> + <key> <string>hidden</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>max_length</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_linelength</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>max_lines</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>required</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>text_editor</string> </key> + <value> <string>text_area</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>your_user_preparation</string> </value> + </item> + <item> + <key> <string>unicode</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>whitespace_preserve</string> </key> + <value> <int>0</int> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>40</int> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </pickle> + </record> + <record id="2" aka="AAAAAAAAAAI="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: here.REQUEST.get(\'__ac_google_hash\') is not None and not here.Google_checkUserExistence()</string> </value> + </item> + </dictionary> + </pickle> + </record> + <record id="3" aka="AAAAAAAAAAM="> + <pickle> + <global name="TALESMethod" module="Products.Formulator.TALESField"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_text</string> </key> + <value> <string>python: \'\'</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSite_logout.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSite_logout.xml new file mode 100644 index 0000000000000000000000000000000000000000..01881e3d6e8d8e03336fff4f1463514790962164 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_hosting/WebSite_logout.xml @@ -0,0 +1,203 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="PythonScript" module="Products.PythonScripts.PythonScript"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>Script_magic</string> </key> + <value> <int>3</int> </value> + </item> + <item> + <key> <string>_Access_contents_information_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_bindings_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_cache_settings_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Change_permissions_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Copy_or_Move_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Delete_objects_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Manage_WebDAV_Locks_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Manage_properties_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Take_ownership_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_Undo_changes_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_View_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_View_management_screens_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_Lock_items_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_Unlock_items_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_WebDAV_access_Permission</string> </key> + <value> + <list> + <string>Manager</string> + </list> + </value> + </item> + <item> + <key> <string>_bind_names</string> </key> + <value> + <object> + <klass> + <global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/> + </klass> + <tuple/> + <state> + <dictionary> + <item> + <key> <string>_asgns</string> </key> + <value> + <dictionary> + <item> + <key> <string>name_container</string> </key> + <value> <string>container</string> </value> + </item> + <item> + <key> <string>name_context</string> </key> + <value> <string>context</string> </value> + </item> + <item> + <key> <string>name_m_self</string> </key> + <value> <string>script</string> </value> + </item> + <item> + <key> <string>name_subpath</string> </key> + <value> <string>traverse_subpath</string> </value> + </item> + </dictionary> + </value> + </item> + </dictionary> + </state> + </object> + </value> + </item> + <item> + <key> <string>_body</string> </key> + <value> <string>"""\n + Default logout handler, overwritten to give website specific portal status message.\n +"""\n +website = context.getWebSiteValue()\n +REQUEST = context.REQUEST\n +if REQUEST.has_key(\'portal_skin\'):\n + context.portal_skins.clearSkinCookie()\n +REQUEST.RESPONSE.expireCookie(\'__ac\', path=\'/\')\n +REQUEST.RESPONSE.expireCookie(\'__ac_facebook_hash\', path=\'/\')\n +REQUEST.RESPONSE.expireCookie(\'__ac_google_hash\', path=\'/\')\n +REQUEST.RESPONSE.expireCookie(\'__ac_browser_id_hash\', path=\'/\')\n +msg = context.Base_translateString(\'You have been logged out. Thank you for using this website.\')\n +return website.Base_redirect(form_id, keep_items = {\'portal_status_message\' : msg}, **kw)\n +</string> </value> + </item> + <item> + <key> <string>_params</string> </key> + <value> <string>dialog_id=None, form_id=\'\', **kw</string> </value> + </item> + <item> + <key> <string>id</string> </key> + <value> <string>WebSite_logout</string> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string>Logout handler</string> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/login_form.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/login_form.xml index e00b28b568167d0c0b651414548e0f8d5039ee56..d790545f2772bb10f568211b688122f2e3b88e35 100644 --- a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/login_form.xml +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/login_form.xml @@ -64,6 +64,50 @@ type="hidden" name="came_from"\n tal:attributes="value request/came_from" />\n <fieldset>\n + <script src="https://browserid.org/include.js" type="text/javascript"></script> \n + <div class="field nolabel validate widthAuto forgotten_password">\n + You can login with with <a href="./login_with_facebook"><img width="25px" src="./vifib_image/facebook_logo.png" alt="Facebook" title="Facebook"></a>,\n + with <a href="./login_with_google"><img src="./vifib_image/google_logo.png" alt="Google" title="Google"></a>, BrowserID \n + <a href="#" id="browserid" title="Sign-in with BrowserID"> <img src="./vifib_image/browser_id_logo.png" alt="Sign-in with BrowserID" title="Sign-in with BrowserID"></a> or use traditional methods below.\n + </div>\n +<browserid id="browser_id_login" tal:attributes=\'value python: here.getWebSiteValue().login_with_browser_id.absolute_url()\'/>\n +<script type="text/javascript">\n +$(\'#browserid\').click(function() {\n + navigator.id.get(gotAssertion);\n + return false;\n + });\n +\n +function post_to_url(path, params, method) {\n + method = method || "post"; // Set method to post by default, if not specified.\n +\n + // The rest of this code assumes you are not using a library.\n + // It can be made less wordy if you use one.\n + var form = document.createElement("form");\n + form.setAttribute("method", method);\n + form.setAttribute("action", path);\n +\n + for(var key in params) {\n + if(params.hasOwnProperty(key)) {\n + var hiddenField = document.createElement("input");\n + hiddenField.setAttribute("type", "hidden");\n + hiddenField.setAttribute("name", key);\n + hiddenField.setAttribute("value", params[key]);\n +\n + form.appendChild(hiddenField);\n + }\n + }\n +\n + document.body.appendChild(form);\n + form.submit();\n +}\n +\n +function gotAssertion(assertion) { \n + // got an assertion, now send it up to the server for verification \n + if (assertion !== null) { \n + post_to_url($(\'#browser_id_login\').attr(\'value\'), {\'assertion\': assertion})\n + } \n +} \n +</script>\n <div class="field login_name">\n <label for="name" class="required" i18n:translate="" i18n:domain="ui">Name</label>\n <div class="input"><input type="text" name="__ac_name" id="name" tal:attributes="value python: request.get(\'__ac_name\') or \'\'" /></div>\n diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/browser_id_logo.png.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/browser_id_logo.png.xml new file mode 100644 index 0000000000000000000000000000000000000000..e5f87fd37c495701e257f187b3fd65e6ab2481e3 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/browser_id_logo.png.xml @@ -0,0 +1,79 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Image" module="OFS.Image"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_EtagSupport__etag</string> </key> + <value> <string>ts42007936.54</string> </value> + </item> + <item> + <key> <string>__name__</string> </key> + <value> <string>browser_id_logo.png</string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>image/png</string> </value> + </item> + <item> + <key> <string>data</string> </key> + <value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAAE8AAAAWCAYAAACBtcG5AAAGzUlEQVRYw+2ZXUxb5xnHz6R0laqi +Kd2ajRQqpcnFsjZqd1spysWaTruaplWiSzVNUF9Uay92v4tqkxYGXdKElCRrsqwhBmJDCAsJcQDz +jQPEhGAC/sQ29vHHObYpkA+wCfz3Pu/ZOTUYB07Lbmhf6af3fc7zcey/nvec42NB+G588zExMfF8 +IpE4lJLlEkYpWxuexv4bccMb/dgWHBhA6QEbjrw+iLdf7cfLuoSTJOmwLMtNSVlOJhMJbJb9rTIO +3MZ2Iv3abdx7dQAV+wawd1MdR8KlUilsloQsa/zYJGO3BduGYiuw1wa8YkN7US8OPVW8WCx2iHVe +Uo94yWQSsiRp/LBewq7WlW9MycDKltTJ5o32FbzVrS+nkOUU93OGiweW3s4rXjweL5HiEtuGyRwC +gQAG+gc0yFZ9CTkBylP5QW0ML9x48lQOtD1BtWsF9qQCrX/Rtcx9R8dXQIOObVRHD9FHK3iQ0V/z +RfZZC/uWsatveWRX79Iv1xUvEomUxmMxsK2bQ19fXw7ZftaxoFyVAmMUBS2ZvNgTy1yguvEZnB1J +wDOThl1e5r6SthTuinP4nUV+ag291I/JDOlr5e60ZPBi7xJ+1JNhAi7mChiNRg3RSJQLsZbe3r4c +1sbEWddRvsqOGhE7mhdz+E13RhFuNIbCmiB+cimMPZ+P41dmH/cXNHyJD29O42f/mdVyDranUWbL +cFSboPVPb6Q5tCa/ul7L4asi3r0R1ezN5qk805rGc+yzP9edHhGsi6u3cDQcNUREkXVOPIee7p4c +1ouLRWOgGirCFyEIVx+voqxnnovXFXyEfdcXtOPPNszxubQ/zf1l/crxv44qYkcfKt2qjouuNN5s +W+Drq4EM5tPKdqeZjq897x1pCXYpw9d68lbBPu+OTiamdWFI6Fg4qIkXDoYNYkhkXRPLQRQj6Orq +1iB7vTgiIkZBdVSEfwUhND7U+L4xDo/8UBNhWHqCv9xNa/4y64wiHpvJptEyIaG4egQfNju5XdHt +x84LPgiXlVh3chF/vObCe6Zxbp90PF51TsIeUeC2jrwcrj2CYGVxHY9bBEuikIsXDAYNoWCIC5NN +mAkwNuZAV2eXBtl0fG2sRlgE1VIRzvkhmOY1Xj/vwGnbNNxZIjZOZbjvD9YUt2kmm0bNmLJ+s1ni +dtXIjFaL31wGIxAuMWplbp/K8qvYxQccvXnrcpXRxoS0PPhIEc8fNAQDQS6KyjT74taOzryQPzte +JTQdBtUirjRegfBP1iX1X35FbQrfO+fFzlN2vHXBjuicso1+3jKP37cl+Jpmij1q9bEttYyh+BKf +3dID7KuZ0mrxjrEn89oqmng689blyiwTjgl4c76Si+f3+g0Bf4B/cZXR0Xvo6LDmhfzZ8QQJSnWI +xoZGCKfdEIyp/FyM4ZQtxD/8kfYZvGdRuoBm8n/cL2N+cQlVtyN4p3YMBSeHIdTIWj6NE8OJvLbK +HXGeozcvhwbWna2znD0nWpXO83q9Br/Pj2BwWqO9rWNDsuMDrNOoBtFgboDwmZOJI69if1MKlXcf +8lm1I3Np3n3CuQCO3IwrQrKZ/EORx9weEh9hMLoAs3dByyVoHB+S8toqd8JzHL15q7jMOvP6DGfP +8dYW9tteueZ53V6Dz+vTuoa4dattQ9RY/1QAlE+YTWYIVZMQ/i3l8EFnCuJcetWd805oFr823uP+ +d1uj/BjNZL9y5i7eN4/hT60+nLCJrAufYDKZ1urRODYo5bVVhplwhN48jTom3rUUp/j49SH2aPfV +3dbtdhuYgJjyBTQsllsbQnE+rx+US5hMJgifOthdNrI+1U48W9GDg2dtKDON8ln4x212XZxS/Ge8 +KDjaweffWpTtVHJdyROqHPhiWNniaj0eW+XIa2vQOQi9eYQxBqFZ5uw+dm2EPdeufs5zuVylHqeH +CTGlC6/HB8ojLtdfhnCMddDnoY05M6Vsa5rzxOw858H8QoZ3asXwLM46lLtk85i4uXNsBRfZuZri +nN2fcOFyf2FMjk+WuCbdXIzN4mGdRjkEF66SXcxP+7aOag8OVvfgZLcXg6E5tHtTqOpiN6BK29ae +Jx8XAuwGEea8VNG0vnA0HA7nIed9Z9Lt9MLj2hiKc064OPV1TLi/sy3xmXvrOXkfwies9t86IZR3 +K+v/x3nWcp6JZ57mFFVeGc7ZqtnDXG1+nnVf0+R9J/RQX1vPrld29vzj35a8VG5up9d1G74QrbtU +d9horGuqNdYm64z12AyFfz6P4nLztqKo3JwuKjfdKzpqqmAdt1fXfxikNHvVVMIoZe/5DN8W/vd9 +j9AWZY8im/4P4789+eGvSTTTwgAAAABJRU5ErkJggg==</string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>22</int> </value> + </item> + <item> + <key> <string>precondition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>size</string> </key> + <value> <int>1798</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>79</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/facebook_logo.png.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/facebook_logo.png.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d81ccfa2300abfc1c521d6d0a229d89744d3e89 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/facebook_logo.png.xml @@ -0,0 +1,56 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Image" module="OFS.Image"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_EtagSupport__etag</string> </key> + <value> <string>ts41568209.17</string> </value> + </item> + <item> + <key> <string>__name__</string> </key> + <value> <string>facebook_logo.png</string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>image/png</string> </value> + </item> + <item> + <key> <string>data</string> </key> + <value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAAIwAAACMCAMAAACZHrEMAAAAWlBMVEUAAAA7W5k7W5k7W5k7W5k7 +W5mSpMfb4exthbRIZqA+Xpt1jLjR2ef///+drczO1uY7W5lshLNHZZ/z9fmFmb9UcKa2wtnn6/Kp +t9JgeqyRo8Z4jrnCzN/a4Oyzuvb+AAAABnRSTlMAv2DPIO/41WVhAAABTElEQVR42u3c2WrDMBRF +UQ9JG7e9GuzEdqb//82SFkpLhElCkE5h7y9YL4L7olNdaupQuLqpvlu1QaB29WVZB4nWF00bRGqr +qgkyNVWtg6mrIBQYMGDAgAEDpjAmbt3ofxqdczHuSmD2zlsqnx3THyYzk8D0bjATwcTJTAUz22Jj +RkzvbTmXD9OfTQfjTQczmw4mmhBmEsI4E8JMQpitCWFOdkvHLJjebipmwRyVMLMlG07uT3kuPZ+k +bMvcwIMl2ocymPQ7FsLshDBDKISJCYwHAwYMGDBgwIDRxnh7IA8GzJ2NShgHBsydHZQwEQyY/4wJ +YDJjZv+rs103+Os4yMGAAQMGDBgwYMCAAQMGDBgwEpi37hm9JzAf3WIpTLd5Ri8JzOtmMTBgwIAB +AwYMGDBgMmD4rw3m8aTGcKRmgpQGlKSmpbRGt6TmyD4BW3thMbMGyXwAAAAASUVORK5CYII=</string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>140</int> </value> + </item> + <item> + <key> <string>precondition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>size</string> </key> + <value> <int>509</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>140</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/google_logo.png.xml b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/google_logo.png.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b7a66e960991b4508ab15fdbaa9fa299c885d49 --- /dev/null +++ b/master/bt5/vifib_web/SkinTemplateItem/portal_skins/vifib_jauks_theme/vifib_image/google_logo.png.xml @@ -0,0 +1,92 @@ +<?xml version="1.0"?> +<ZopeData> + <record id="1" aka="AAAAAAAAAAE="> + <pickle> + <global name="Image" module="OFS.Image"/> + </pickle> + <pickle> + <dictionary> + <item> + <key> <string>_EtagSupport__etag</string> </key> + <value> <string>ts41840780.52</string> </value> + </item> + <item> + <key> <string>__name__</string> </key> + <value> <string>google_logo.png</string> </value> + </item> + <item> + <key> <string>content_type</string> </key> + <value> <string>image/png</string> </value> + </item> + <item> + <key> <string>data</string> </key> + <value> <string encoding="base64">iVBORw0KGgoAAAANSUhEUgAAAEIAAAAXCAYAAAC/F5msAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJ +bWFnZVJlYWR5ccllPAAACaVJREFUeNrcWAl0U1Uavu+9vKRJmqVpmyK2QlsKhdKpWCo7lB2RZVRG +RRYVhkEdRXEUNxwVGY8i23hkOc5URXQQxI2iB2UTmFJg2lKgLbSFtmmbpNmTl5e8/d55r1ooNSjL +mTk93nNuc+5//7u87///7/9vMfAL7da5e/qozdlZGBJxTAw0V30+p4r21iHQTVvaO+kZ1kGpLxm0 +SRk2fyto+bJ2s7iJ2n41a7GugjHL7OMDIcOzYZ+3H0OFKgUmYMdUBotal5Abn5A80GCSzmBS5Iug +j37v/Gf9Hd0JCNyIm7WLjNPIQuPWSFkwILxGJcti6Zo2Gff4Xv2YF0JFfWY7veaCHY/KImMXFZUh +94PJiYW1takzPShxbKNT13dVv+7mFcZ/pkwx7EpF5MvGlmtZp1L+9Bv1GInMQ/c2nQ1n+6ren0HX +Lv93DF0xfObh7/R9Xhgm0jNPClTl5mjdsvruBgSEACCIAELXFsHtQKSMWPmGvUU1LGQ7/sQVQLh0 +EOcWeM+XjzO2t3bLQ9T9gEA/AgGvEYj8J/y9opzpmYC9yR4sv/fDX1vAtBSF5Z/iX9KpmD4lA+Ph +rSpSHXqqouLQfodDvJJuolkDSjb3G5Wego1EgABNLulg9v2njl0vEJKkgADlHnt+/eihpjus1mki +wDVRXtpTsKu4nedULCPO4wQJQJ4qBUigb8Qa7odnPxK60PKnU3W2fRTDtwzWm5/cnjFwJN07p0hF +88tSTx8Kdtb37y+cywUdT5dW2r9w1AvVBh2Wn9NHv1fan+l2tFFz0uZ4LgNk8GO2O/0e9kGAx9+s +0WoHWqw6IxPhaZfNc552nfmKqnz4b+0eoYDRhSLrFz5gMfhDm22tLu3h8qpvbtWaJmVak4taho/b +Ob7s6H0g6yH+QNq9DEoY+t2rNwKCc/H8Vy6MGdX6aKI1o5OYONJjwIf2ASPQ+YyCIxacwDsmgocm +LfF9nUOtnBN/W+d9vl8WN5HZZkSw2ByoXEMO6pBPeNn9UtYc+zl91tPpytjQ/42s5Ik2Z49pfjZx +fNPdFw9cnzgF/5cVgb/oL5LlXQP6qcIP3V+xNzd3g6LSkTGrMwdtae5TgPYnZr+GM+GwSRJkP8II +4XpBqJ03a7IpRL967rxrwyafu6Gzp07z1i90eUIekpVGfm3s+5wi3LcxPzFeFV7TUNf26fJP6IrO +e01axe51NLOfI44zp2jRm4ps0KOuzFDUstLXcPL9SP3aRkUWPvtiPRLCz0NEaDCC/PtFjpC9AUoK +Y17iiI0FeS8Idk/ejhbX+k7pFDnDjKOsLQBLI+EcXORhO8EScTdnXy8Q5mDkAcbmAqejTHnXuZAo +SLQEvxZ4mSYgUiyHDc9iF4OoV5WEc85Y+/mjeJHIiEAP0KQ5+SCForDpAa8S9ORloRssHf6R/NUS +kohUxUnav04BoQs/GKjIhKCfov8RdNtrho7oacsbsuJE79+V1rBR5m3Gmbmctc/CESQphVgwMj4v +VoF1NQ25g3eIYQ4k4SpNzKoNoS9EOXZZCQ2Uh1oqEMhCfARgGMJj6f9xi/S9wvoCi8Dd2WBwlBL0 +TBQB0jxw7GX5nKMQkigb5CPwoqU7HKFT0gg4fTdpOahfaE6e0NjmW7rH4To12nZm8hKqeUWpFGlq +J0sp2rIH16WNxUhjrmXE4dH+ktGHYl0ueeKF8XFx2ONxWrxHolWFsVGINdc2NQTLZs1ngiyuRRjI +JjU5sTJKEqGOQhGCgCRySgEo0gwHNBhgIEiPddapJkF2cJUgfyd5qhlQkib4LYS6lZhKOzFp7LEM +78Gh7eEXb8nAEMSTxVDlVnkYvWSZLik1yIZxQBAP6pLg6Kazz8asSmGkYbvEsu1LifisZbGUEgZv +0zHOfdG2Y08tP//5wD801VFWuw3dzrirjyp1hY8W9gg8BCTAR8VaT8qOxssu65WEKnkYQTR/jqd5 +kGIBd/W0/FjL/OxiCOF+F2JWHAHl7n05J4Vg3bsiw5oIXeaOnHnVucMW7M5Im350s0A1lHDOj5+5 +DASldwoPOgobocyDVhX55BXLc/+JmTYYbd4kMlFAqHVTe0ypf7GrUqBsdpSuWlwqeHZVI4lu5aJI +YiOczEdYezq0sfwOT0QAVlw1tSRlwM+sTGGgp1MQQI3EfqRcc+pqfoOrkfeqcUlXsiLuz131K9fq +eoddkChvAOs6LO0vGfIE07J9Auc9d4Rj8VWYZfwFn909InSicCbv2em9DAgFBHQpyi8w3MdeWgBG +XDWhrFferJhAtF+0fOISkW4+xFFBucxIXJk+q3G1xpRxRb6QY1smJRF0JOt7fHW7KhhmTasMhkHC +t56z5pk7dL+9KS+JZvm3jgv01nehu0iRnWkWhLP1cL6jRqAspPRq00ZyzMVaZIvOeIua21Zegfau +PAbe6nxupHbp/uDxUUupILa7oU4AiEg03zS9RX/55XAcSPLVDbi2QzTDU/vV2Shb1BhiQCIkP6vN +Gv76D9lDFYIF6xLSTZ/q+0y6+LHx/d+3ALLnRkLX6z6N0Qj0JqxKo5H+KoXKD9UX/97foWcdVzGY +CYnFIsv2gPSJ+Zztma0doK7RpD3fi1AvTSU1MmtgHxAYpolwwp1HOKr4TdG5SoaN6Xznt8diQ4b0 +Bmtv6Y3las3YQRGBUDAM06trUMmCneB12YiRmFkqf0s+YZ5QQmi0Gp1eOAe5wD3Nu7Jr2nFYFP88 +CgsL271CrzoBRLAbbI1se0CXFH+7pHsjBVc90pPUkPFqNQzwvIOGUuAAF1r8M6vH9VoxDNf1X4xr +rNPxOKtFHacGBCm7AOQ4PuJsZSnPfyDjO8E73v4ecY11Cnl3pYRMTJ3VF4/reRoybXYkKDr8ryQe +xaoWuSu1jDfGnmDMs675rc3SIibktEZ8nlIoEhSmMt2lSbglVaXGw1FPTUHoeGHtVSQ5w0TcMMQA +CN1RSNe3AbHu157qSgVmUhLGT5fUXm96vZE2ZMEP+jHPBYvTZjT5tL2WjO5UGQKNZazBWHDsm4RC +OzINP/3NDf0v45feL0o9JHePwlXgR7f+v782IyBnbpsTnxZqrV7L2N453Nl6nP9gGGcqZkMxehYJ +/Mj/FRDdonnaYGrQJ8kFnykQaz5Y9RiFIaFeYt1Vv2kgBJpyCwwDSGP6opunlhu6zqdMtpnlDJYr +UiffvJFzsO4ORJwlX0P2Xr0T16ZN05q0bXoDfE9NhMowXMdQIXAb7QssYBy7X+eaXvnkNw1Eh+dq +01cXYnGps+Rk1E9+baoQ722VmMYDXMu6ryDb6LvRA/4rwAA8PdFYzR2ZFwAAAABJRU5ErkJggg==</string> </value> + </item> + <item> + <key> <string>height</string> </key> + <value> <int>23</int> </value> + </item> + <item> + <key> <string>precondition</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>size</string> </key> + <value> <int>2563</int> </value> + </item> + <item> + <key> <string>title</string> </key> + <value> <string></string> </value> + </item> + <item> + <key> <string>width</string> </key> + <value> <int>66</int> </value> + </item> + </dictionary> + </pickle> + </record> +</ZopeData> diff --git a/master/bt5/vifib_web/bt/revision b/master/bt5/vifib_web/bt/revision index eb8f2fa1aeb162439e4756fc55642cad6c193cff..43f9cb64132d45b9914202fd5b6153004aa5d34a 100644 --- a/master/bt5/vifib_web/bt/revision +++ b/master/bt5/vifib_web/bt/revision @@ -1 +1 @@ -379 \ No newline at end of file +396 \ No newline at end of file diff --git a/master/bt5/vifib_web_ui_test/PathTemplateItem/portal_tests/vifib_web_zuite/TestKVM.xml b/master/bt5/vifib_web_ui_test/PathTemplateItem/portal_tests/vifib_web_zuite/TestKVM.xml index 5ae8da5d5b5138cdc0748f8c5a787d88f47123ac..ccd17edd22e9ae4da3a225af68fdfffdb4e3a5b8 100644 --- a/master/bt5/vifib_web_ui_test/PathTemplateItem/portal_tests/vifib_web_zuite/TestKVM.xml +++ b/master/bt5/vifib_web_ui_test/PathTemplateItem/portal_tests/vifib_web_zuite/TestKVM.xml @@ -141,7 +141,7 @@ for (i = 0; i < 10000000; i++) { };</td>\n </tr-->\n <tr>\n <td>pause</td>\n - <td>1200000</td>\n + <td>5400000</td>\n <td></td>\n </tr>\n <tr>\n @@ -174,7 +174,7 @@ for (i = 0; i < 10000000; i++) { };</td>\n <td>css=td:contains(\'password\') + td</td>\n <td>password</td>\n </tr>\n -<tr>\n +<!--tr>\n <td>openAndWait</td>\n <td>${ip}</td>\n <td></td>\n @@ -199,7 +199,6 @@ for (i = 0; i < 10000000; i++) { };</td>\n <td>id=password_input</td>\n <td>13</td>\n </tr>\n -<!--Check if it works without it in chrome AND firefox before removing.\n <tr>\n <td>pause</td>\n <td>1000</td>\n @@ -209,7 +208,7 @@ for (i = 0; i < 10000000; i++) { };</td>\n <td>submit</td>\n <td>//input[@id="password_input"]/..</td>\n <td>\\13</td>\n -</tr>-->\n +</tr>\n <tr>\n <td>pause</td>\n <td>10000</td>\n @@ -229,8 +228,8 @@ for (i = 0; i < 10000000; i++) { };</td>\n <td>openAndWait</td>\n <td>${software_instance_url}</td>\n <td></td>\n -</tr>\n -<span metal:use-macro="container/Zuite_vifib_instanciation_macro_library/macros/destroy_instance" />\n +</tr-->\n +<!--span metal:use-macro="container/Zuite_vifib_instanciation_macro_library/macros/destroy_instance" /-->\n </tbody>\n </table>\n </body>\n diff --git a/master/bt5/vifib_web_ui_test/bt/revision b/master/bt5/vifib_web_ui_test/bt/revision index 3f10ffe7a4c473619c926cfb1e8d95e726e5a0ec..19c7bdba7b1e9bfe80365a50420a6d538ca503c3 100644 --- a/master/bt5/vifib_web_ui_test/bt/revision +++ b/master/bt5/vifib_web_ui_test/bt/revision @@ -1 +1 @@ -15 \ No newline at end of file +16 \ No newline at end of file diff --git a/master/product/Vifib/Tool/SlapTool.py b/master/product/Vifib/Tool/SlapTool.py index e65d4134ba7c2f9128d44c022d23b64850283f79..7ebeca77d7cda7fb0cef016d672866d8b516a866 100644 --- a/master/product/Vifib/Tool/SlapTool.py +++ b/master/product/Vifib/Tool/SlapTool.py @@ -143,15 +143,23 @@ class SlapTool(BaseTool): """ def _getComputerInformation(computer_id, user): + user_document = self.getPortalObject().portal_catalog.getResultValue( + reference=user, portal_type=['Person', 'Computer', 'Software Instance']) + user_type = user_document.getPortalType() self.REQUEST.response.setHeader('Content-Type', 'text/xml') slap_computer = Computer(computer_id) parent_uid = self._getComputerUidByReference(computer_id) slap_computer._computer_partition_list = [] - slap_computer._software_release_list = \ + if user_type == 'Computer': + slap_computer._software_release_list = \ self._getSoftwareReleaseValueListForComputer(computer_id) + else: + slap_computer._software_release_list = [] + for computer_partition in self.getPortalObject().portal_catalog( parent_uid=parent_uid, + validation_state="validated", portal_type="Computer Partition"): slap_computer._computer_partition_list.append( self._getSlapPartitionByPackingList(computer_partition.getObject())) @@ -171,19 +179,31 @@ class SlapTool(BaseTool): Reuses slap library for easy marshalling. """ - self.REQUEST.response.setHeader('Content-Type', 'text/xml') - slap_computer = Computer(computer_id) - parent_uid = self._getComputerUidByReference(computer_id) - - slap_computer._computer_partition_list = [] - slap_computer._software_release_list = \ - self._getSoftwareReleaseValueListForComputer(computer_id, full=True) - for computer_partition in self.getPortalObject().portal_catalog( - parent_uid=parent_uid, - portal_type="Computer Partition"): - slap_computer._computer_partition_list.append( - self._getSlapPartitionByPackingList(computer_partition.getObject())) - return xml_marshaller.xml_marshaller.dumps(slap_computer) + def _getFullComputerInformation(computer_id, user): + user_document = self.getPortalObject().portal_catalog.getResultValue( + reference=user, portal_type=['Person', 'Computer', 'Software Instance']) + user_type = user_document.getPortalType() + self.REQUEST.response.setHeader('Content-Type', 'text/xml') + slap_computer = Computer(computer_id) + parent_uid = self._getComputerUidByReference(computer_id) + + slap_computer._computer_partition_list = [] + if user_type == 'Computer': + slap_computer._software_release_list = \ + self._getSoftwareReleaseValueListForComputer(computer_id, full=True) + else: + slap_computer._software_release_list = [] + for computer_partition in self.getPortalObject().portal_catalog( + parent_uid=parent_uid, + validation_state="validated", + portal_type="Computer Partition"): + slap_computer._computer_partition_list.append( + self._getSlapPartitionByPackingList(computer_partition.getObject())) + return xml_marshaller.xml_marshaller.dumps(slap_computer) + user = self.getPortalObject().portal_membership.getAuthenticatedMember().getUserName() + return CachingMethod(_getFullComputerInformation, + id='_getFullComputerInformation', + cache_factory='slap_cache_factory')(computer_id, user) security.declareProtected(Permissions.AccessContentsInformation, 'getComputerPartitionCertificate') @@ -428,11 +448,64 @@ class SlapTool(BaseTool): """ # Try to get the computer partition to raise an exception if it doesn't # exist - self._getComputerPartitionDocument( + portal = self.getPortalObject() + computer_partition_document = self._getComputerPartitionDocument( computer_reference, computer_partition_reference) - return xml_marshaller.xml_marshaller.dumps( - SlapComputerPartition(computer_reference, - computer_partition_reference)) + slap_partition = SlapComputerPartition(computer_reference, + computer_partition_reference) + slap_partition._software_release_document = None + slap_partition._requested_state = 'destroyed' + slap_partition._need_modification = 0 + software_instance = None + + if computer_partition_document.getSlapState() == 'busy': + software_instance_list = portal.portal_catalog( + portal_type="Software Instance", + default_aggregate_uid=computer_partition_document.getUid(), + validation_state="validated", + limit=2, + ) + software_instance_count = len(software_instance_list) + if software_instance_count == 1: + software_instance = software_instance_list[0].getObject() + elif software_instance_count > 1: + # XXX do not prevent the system to work if one partition is broken + raise NotImplementedError, "Too many instances %s linked to %s" % \ + ([x.path for x in software_instance_list], + computer_partition_document.getRelativeUrl()) + + if software_instance is not None: + # trick client side, that data has been synchronised already for given + # document + slap_partition._synced = True + state = software_instance.getSlapState() + if state == "stop_requested": + slap_partition._requested_state = 'stopped' + if state == "start_requested": + slap_partition._requested_state = 'started' + + slap_partition._software_release_document = SoftwareRelease( + software_release=software_instance.getRootSoftwareReleaseUrl(), + computer_guid=computer_reference) + + slap_partition._need_modification = 1 + + parameter_dict = self._getSoftwareInstanceAsParameterDict( + software_instance) + # software instance has to define an xml parameter + slap_partition._parameter_dict = self._instanceXmlToDict( + parameter_dict.pop('xml')) + slap_partition._connection_dict = self._instanceXmlToDict( + parameter_dict.pop('connection_xml')) + for slave_instance_dict in parameter_dict.get("slave_instance_list", []): + if slave_instance_dict.has_key("connection_xml"): + slave_instance_dict.update(self._instanceXmlToDict( + slave_instance_dict.pop("connection_xml"))) + if slave_instance_dict.has_key("xml"): + slave_instance_dict.update(self._instanceXmlToDict( + slave_instance_dict.pop("xml"))) + slap_partition._parameter_dict.update(parameter_dict) + return xml_marshaller.xml_marshaller.dumps(slap_partition) #################################################### # Internal methods @@ -709,7 +782,8 @@ class SlapTool(BaseTool): portal.portal_preferences.getPreferredInstanceCleanupResource()]: if portal.portal_workflow.isTransitionPossible(delivery, 'stop'): delivery.stop() - delivery.deliver() + if portal.portal_workflow.isTransitionPossible(delivery, 'deliver'): + delivery.deliver() # XXX Integrate with REST API # Code duplication will be needed until SlapTool is removed @@ -842,7 +916,16 @@ class SlapTool(BaseTool): raise SoftwareInstanceNotReady else: parameter_dict = self._getSoftwareInstanceAsParameterDict(requested_software_instance) + + # software instance has to define an xml parameter + xml = self._instanceXmlToDict( + parameter_dict.pop('xml')) + connection_xml = self._instanceXmlToDict( + parameter_dict.pop('connection_xml')) + software_instance = SoftwareInstance(**parameter_dict) + software_instance._parameter_dict = xml + software_instance._connection_dict = connection_xml return xml_marshaller.xml_marshaller.dumps(software_instance) #################################################### @@ -921,6 +1004,11 @@ class SlapTool(BaseTool): def _getSoftwareInstanceAsParameterDict(self, software_instance): portal = software_instance.getPortalObject() computer_partition = software_instance.getAggregateValue(portal_type="Computer Partition") + timestamp = int(computer_partition.getModificationDate()) + + newtimestamp = int(software_instance.getBangTimestamp(int(software_instance.getModificationDate()))) + if (newtimestamp > timestamp): + timestamp = newtimestamp ip_list = [] for internet_protocol_address in computer_partition.contentValues(portal_type='Internet Protocol Address'): @@ -945,6 +1033,9 @@ class SlapTool(BaseTool): 'xml': slave_instance.getTextContent(), 'connection_xml': slave_instance.getConnectionXml(), }) + newtimestamp = int(slave_instance.getBangTimestamp(int(software_instance.getModificationDate()))) + if (newtimestamp > timestamp): + timestamp = newtimestamp return { 'xml': software_instance.getTextContent(), 'connection_xml': software_instance.getConnectionXml(), @@ -954,6 +1045,7 @@ class SlapTool(BaseTool): 'slap_software_release_url': software_instance.getRootSoftwareReleaseUrl(), 'slave_instance_list': slave_instance_list, 'ip_list': ip_list, + 'timestamp': "%i" % timestamp, } @UnrestrictedMethod diff --git a/master/product/Vifib/Tool/VifibRestApiTool.py b/master/product/Vifib/Tool/VifibRestApiTool.py new file mode 100644 index 0000000000000000000000000000000000000000..5d358b0f99d978fbfb74eefd72455544ca0186f3 --- /dev/null +++ b/master/product/Vifib/Tool/VifibRestApiTool.py @@ -0,0 +1,75 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. +# Åukasz Nowak <luke@nexedi.com> +# Romain Courteaud <romain@nexedi.com> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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 Products.ERP5Type.Tool.BaseTool import BaseTool +from AccessControl import ClassSecurityInfo +from Products.ERP5Type.Globals import InitializeClass +from Products.ERP5Type import Permissions +from ComputedAttribute import ComputedAttribute + +class VifibRestApiTool(BaseTool): + """SlapOS REST API Tool + + This is container for multiple versions of API. + """ + + id = 'portal_vifib_rest_api' + meta_type = 'ERP5 Vifib Rest API Tool' + portal_type = 'Vifib Rest API Tool' + security = ClassSecurityInfo() + security.declareObjectProtected(Permissions.AccessContentsInformation) + allowed_types = () + + security.declarePublic('v1') + @ComputedAttribute + def v1(self): + """API hooked""" + # XXX: It could be done better (more dynamic, configurable from UI) + from erp5.component.document.VifibRestAPIV1 import VifibRestAPIV1 + return VifibRestAPIV1().__of__(self) + + security.declarePrivate('manage_afterAdd') + def manage_afterAdd(self, item, container) : + """Init permissions right after creation. + + Permissions in slap tool are simple: + o Each member can access the tool. + o Only manager can view and create. + o Anonymous can not access + """ + item.manage_permission(Permissions.AddPortalContent, + ['Manager']) + item.manage_permission(Permissions.AccessContentsInformation, + ['Member', 'Manager']) + item.manage_permission(Permissions.View, + ['Manager',]) + BaseTool.inheritedAttribute('manage_afterAdd')(self, item, container) + +InitializeClass(VifibRestApiTool) diff --git a/master/product/Vifib/VifibCookieHashExtractionPlugin.py b/master/product/Vifib/VifibCookieHashExtractionPlugin.py new file mode 100644 index 0000000000000000000000000000000000000000..d2adaa79c0285131ee7f5ab098b85b7f3ce509be --- /dev/null +++ b/master/product/Vifib/VifibCookieHashExtractionPlugin.py @@ -0,0 +1,187 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012 Nexedi SA and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################## + +from Products.ERP5Type.Globals import InitializeClass +from AccessControl import ClassSecurityInfo + +from Products.PageTemplates.PageTemplateFile import PageTemplateFile +from Products.PluggableAuthService.interfaces import plugins +from Products.PluggableAuthService.utils import classImplements +from Products.PluggableAuthService.plugins.BasePlugin import BasePlugin +from Products.PluggableAuthService.PluggableAuthService import DumbHTTPExtractor +from Products.ERP5Type.Cache import DEFAULT_CACHE_SCOPE + +class VifibCookieHashExtractionPlugin(BasePlugin): + """ + Plugin to authenicate as machines. + """ + + security = ClassSecurityInfo() + + def __init__(self, id, title=None): + #Register value + self._setId(id) + self.title = title + + ##################### + # memcached helpers # + ##################### + def _getCacheFactory(self): + portal = self.getPortalObject() + cache_tool = portal.portal_caches + cache_factory = cache_tool.getRamCacheRoot().get(self.cache_factory_name) + #XXX This conditional statement should be remove as soon as + #Broadcasting will be enable among all zeo clients. + #Interaction which update portal_caches should interact with all nodes. + if cache_factory is None \ + and getattr(cache_tool, self.cache_factory_name, None) is not None: + #ram_cache_root is not up to date for current node + cache_tool.updateCache() + cache_factory = cache_tool.getRamCacheRoot().get(self.cache_factory_name) + if cache_factory is None: + raise KeyError + return cache_factory + + def getKey(self, key): + cache_factory = self._getCacheFactory() + for cache_plugin in cache_factory.getCachePluginList(): + cache_entry = cache_plugin.get(key, DEFAULT_CACHE_SCOPE) + if cache_entry is not None: + return cache_entry.getValue() + raise KeyError('Key %r not found' % key) + + #################################### + #ILoginPasswordHostExtractionPlugin# + #################################### + security.declarePrivate('extractCredentials') + def extractCredentials(self, request): + """ Extract CookieHash credentials from the request header. """ + creds = {} + cookie_hash = request.get(self.cookie_name) + if cookie_hash is not None: + try: + user_dict = self.getKey(cookie_hash) + except KeyError: + return DumbHTTPExtractor().extractCredentials(request) + if 'login' in user_dict: + creds['external_login'] = user_dict['login'] + creds['remote_host'] = request.get('REMOTE_HOST', '') + try: + creds['remote_address'] = request.getClientAddr() + except AttributeError: + creds['remote_address'] = request.get('REMOTE_ADDR', '') + return creds + return DumbHTTPExtractor().extractCredentials(request) + +#Form for new plugin in ZMI +manage_addVifibFacebookServerExtractionPluginForm = PageTemplateFile( + 'www/Vifib_addVifibFacebookServerExtractionPlugin', globals(), + __name__='manage_addVifibFacebookServerExtractionPluginForm') + +def addVifibFacebookServerExtractionPlugin(dispatcher, id, title=None, REQUEST=None): + """ Add a VifibFacebookServerExtractionPlugin to a Pluggable Auth Service. """ + + plugin = VifibFacebookServerExtractionPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'VifibFacebookServerExtractionPlugin+added.' + % dispatcher.absolute_url()) + +class VifibFacebookServerExtractionPlugin(VifibCookieHashExtractionPlugin): + cache_factory_name = 'facebook_server_auth_token_cache_factory' + cookie_name = '__ac_facebook_hash' + meta_type = "Vifib Facebook Server Extraction Plugin" + +#List implementation of class +classImplements( VifibFacebookServerExtractionPlugin, + plugins.ILoginPasswordHostExtractionPlugin + ) +InitializeClass(VifibFacebookServerExtractionPlugin) + +#Form for new plugin in ZMI +manage_addVifibGoogleServerExtractionPluginForm = PageTemplateFile( + 'www/Vifib_addVifibGoogleServerExtractionPlugin', globals(), + __name__='manage_addVifibGoogleServerExtractionPluginForm') + +def addVifibGoogleServerExtractionPlugin(dispatcher, id, title=None, REQUEST=None): + """ Add a VifibGoogleServerExtractionPlugin to a Pluggable Auth Service. """ + + plugin = VifibGoogleServerExtractionPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'VifibGoogleServerExtractionPlugin+added.' + % dispatcher.absolute_url()) + +class VifibGoogleServerExtractionPlugin(VifibCookieHashExtractionPlugin): + cache_factory_name = 'google_server_auth_token_cache_factory' + cookie_name = '__ac_google_hash' + meta_type = "Vifib Google Server Extraction Plugin" + +#List implementation of class +classImplements( VifibGoogleServerExtractionPlugin, + plugins.ILoginPasswordHostExtractionPlugin + ) +InitializeClass(VifibGoogleServerExtractionPlugin) + +#Form for new plugin in ZMI +manage_addVifibBrowserIDExtractionPluginForm = PageTemplateFile( + 'www/Vifib_addVifibBrowserIDExtractionPlugin', globals(), + __name__='manage_addVifibBrowserIDExtractionPluginForm') + +def addVifibBrowserIDExtractionPlugin(dispatcher, id, title=None, REQUEST=None): + """ Add a VifibBrowserIDExtractionPlugin to a Pluggable Auth Service. """ + + plugin = VifibBrowserIDExtractionPlugin(id, title) + dispatcher._setObject(plugin.getId(), plugin) + + if REQUEST is not None: + REQUEST['RESPONSE'].redirect( + '%s/manage_workspace' + '?manage_tabs_message=' + 'VifibBrowserIDExtractionPlugin+added.' + % dispatcher.absolute_url()) + +class VifibBrowserIDExtractionPlugin(VifibCookieHashExtractionPlugin): + cache_factory_name = 'browser_id_auth_token_cache_factory' + cookie_name = '__ac_browser_id_hash' + meta_type = "Vifib Browser ID Extraction Plugin" + +#List implementation of class +classImplements( VifibBrowserIDExtractionPlugin, + plugins.ILoginPasswordHostExtractionPlugin + ) +InitializeClass(VifibBrowserIDExtractionPlugin) + diff --git a/master/product/Vifib/__init__.py b/master/product/Vifib/__init__.py index d5290cf9777a4e7904b0d2926d33e4c076a28859..1c8c4ee42393bd2326ab5cd375250e334787ecb9 100644 --- a/master/product/Vifib/__init__.py +++ b/master/product/Vifib/__init__.py @@ -37,12 +37,13 @@ document_classes = updateGlobals(this_module, globals(), object_classes = () content_classes = () content_constructors = () -from Tool import SlapTool, VifibRestApiV1Tool -portal_tools = ( SlapTool.SlapTool, VifibRestApiV1Tool.VifibRestApiV1Tool) +from Tool import SlapTool, VifibRestApiTool +portal_tools = ( SlapTool.SlapTool, VifibRestApiTool.VifibRestApiTool) from Products.PluggableAuthService.PluggableAuthService import registerMultiPlugin import VifibMachineAuthenticationPlugin import VifibShadowAuthenticationPlugin +import VifibCookieHashExtractionPlugin def initialize(context): import Document @@ -69,6 +70,36 @@ def initialize(context): , icon='www/portal.gif' ) + context.registerClass( VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin + , permission=ManageUsers + , constructors=( + VifibCookieHashExtractionPlugin.manage_addVifibFacebookServerExtractionPluginForm, + VifibCookieHashExtractionPlugin.addVifibFacebookServerExtractionPlugin, ) + , visibility=None + , icon='www/portal.gif' + ) + + context.registerClass( VifibCookieHashExtractionPlugin.VifibGoogleServerExtractionPlugin + , permission=ManageUsers + , constructors=( + VifibCookieHashExtractionPlugin.manage_addVifibGoogleServerExtractionPluginForm, + VifibCookieHashExtractionPlugin.addVifibGoogleServerExtractionPlugin, ) + , visibility=None + , icon='www/portal.gif' + ) + + context.registerClass( VifibCookieHashExtractionPlugin.VifibBrowserIDExtractionPlugin + , permission=ManageUsers + , constructors=( + VifibCookieHashExtractionPlugin.manage_addVifibBrowserIDExtractionPluginForm, + VifibCookieHashExtractionPlugin.addVifibBrowserIDExtractionPlugin, ) + , visibility=None + , icon='www/portal.gif' + ) + registerMultiPlugin(VifibMachineAuthenticationPlugin.VifibMachineAuthenticationPlugin.meta_type) registerMultiPlugin(VifibShadowAuthenticationPlugin.VifibShadowAuthenticationPlugin.meta_type) +registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibFacebookServerExtractionPlugin.meta_type) +registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibGoogleServerExtractionPlugin.meta_type) +registerMultiPlugin(VifibCookieHashExtractionPlugin.VifibBrowserIDExtractionPlugin.meta_type) diff --git a/master/product/Vifib/tests/VifibMixin.py b/master/product/Vifib/tests/VifibMixin.py index d7a82cd88d518a687081d2da5a9b12ba3cf84098..7dcf9577fba49d20bb46ae9c469eb723fb1da3fc 100644 --- a/master/product/Vifib/tests/VifibMixin.py +++ b/master/product/Vifib/tests/VifibMixin.py @@ -87,6 +87,7 @@ class testVifibMixin(ERP5TypeTestCase): 'erp5_project', 'erp5_xhtml_jquery_style', 'erp5_credential', + 'erp5_credential_oauth2', 'erp5_km', 'erp5_web_download_theme', 'erp5_tiosafe_core', @@ -97,7 +98,8 @@ class testVifibMixin(ERP5TypeTestCase): 'erp5_ui_test', 'vifib_slapos_core', 'vifib_slapos_core_test', - 'vifib_slapos_rest_api_v1_portal_type', + 'vifib_slapos_rest_api_tool_portal_type', + 'vifib_slapos_rest_api', 'vifib_slapos_rest_api_v1', 'vifib_slapos_accounting', 'vifib_mysql_innodb_catalog', @@ -207,6 +209,31 @@ class testVifibMixin(ERP5TypeTestCase): self.bootstrapSite() self.portal._p_changed = 1 transaction.commit() + self.stabiliseAccounting() + + def stabiliseAccounting(self): + self.stepCallVifibUpdateDeliveryCausalityStateAlarm() + self.tic() + self.stepCallVifibExpandDeliveryLineAlarm() + self.tic() + self.stepCallVifibTriggerBuildAlarm() + self.tic() + self.stepCallVifibUpdateDeliveryCausalityStateAlarm() + self.tic() + self.stepCallVifibExpandDeliveryLineAlarm() + self.tic() + self.stepCallVifibTriggerBuildAlarm() + self.tic() + self.stepCallVifibUpdateDeliveryCausalityStateAlarm() + self.tic() + self.stepCallStopConfirmedSaleInvoiceTransactionAlarm() + self.tic() + self.stepCallVifibExpandDeliveryLineAlarm() + self.tic() + self.stepCallVifibTriggerBuildAlarm() + self.tic() + self.stepCallVifibUpdateDeliveryCausalityStateAlarm() + self.tic() def getDefaultSitePreferenceId(self): """Default id, usefull method to override @@ -230,6 +257,10 @@ class testVifibMixin(ERP5TypeTestCase): if isTransitionPossible(assignment, 'open'): assignment.open() + def markManualCreation(self, document): + self.portal.portal_workflow.doActionFor(document, 'edit_action', + comment='Manually created by test.') + def prepareVifibAccountingPeriod(self): vifib = self.portal.organisation_module['vifib_internet'] year = DateTime().year() @@ -247,40 +278,9 @@ class testVifibMixin(ERP5TypeTestCase): if accounting_period is None: accounting_period = vifib.newContent(portal_type='Accounting Period', start_date=start_date, stop_date=stop_date) + self.markManualCreation(accounting_period) accounting_period.start() - def setupVifibMachineAuthenticationPlugin(self): - """Sets up Vifib Authentication plugin""" - pas = self.getPortal().acl_users - vifib_auth_list = [q for q in pas.objectValues() \ - if q.meta_type == 'Vifib Machine Authentication Plugin'] - if len(vifib_auth_list) == 0: - vifib_dispacher = pas.manage_addProduct['Vifib'] - vifib_dispacher.addVifibMachineAuthenticationPlugin('vifib_auth') - vifib_auth = pas.vifib_auth - else: - if len(vifib_auth_list) > 1: - raise ValueError('More then one Vifib authentication') - vifib_auth = vifib_auth_list[0] - vifib_auth.manage_activateInterfaces(('IAuthenticationPlugin', - 'IExtractionPlugin', 'IGroupsPlugin', 'IUserEnumerationPlugin')) - - def setupVifibShadowAuthenticationPlugin(self): - """Sets up Vifib Authentication plugin""" - pas = self.getPortal().acl_users - vifib_auth_list = [q for q in pas.objectValues() \ - if q.meta_type == 'Vifib Shadow Authentication Plugin'] - if len(vifib_auth_list) == 0: - vifib_dispacher = pas.manage_addProduct['Vifib'] - vifib_dispacher.addVifibShadowAuthenticationPlugin('vifib_auth_shadow') - vifib_auth = pas.vifib_auth_shadow - else: - if len(vifib_auth_list) > 1: - raise ValueError('More then one Vifib Shadow authentication') - vifib_auth = vifib_auth_list[0] - vifib_auth.manage_activateInterfaces(('IAuthenticationPlugin', - 'IGroupsPlugin', 'IUserEnumerationPlugin')) - def bootstrapSite(self): """ Manager has to create an administrator user first. @@ -306,8 +306,8 @@ class testVifibMixin(ERP5TypeTestCase): self.logMessage("Bootstrap Vifib Without Security...") self.login() - self.setupVifibMachineAuthenticationPlugin() - self.setupVifibShadowAuthenticationPlugin() + # setup Vifib PAS + self.portal.portal_alarms.vifib_promise_pas.solve() self.prepareTestUsers() self.prepareVifibAccountingPeriod() transaction.commit() @@ -378,14 +378,14 @@ class testVifibMixin(ERP5TypeTestCase): def stepCheckSiteConsistency(self, **kw): self.portal.portal_alarms.vifib_check_consistency.activeSense() transaction.commit() - super(testVifibMixin, self).stepTic(**kw) + self.tic() self.assertEqual([], self.portal.portal_alarms.vifib_check_consistency\ .Alarm_getConsistencyCheckReportLineList()) self.assertFalse(self.portal.portal_alarms.vifib_check_consistency.sense()) self.checkDivergency() def stepCleanTic(self, **kw): - super(testVifibMixin, self).stepTic(**kw) + self.tic() def stepTic(self, **kw): def activateAlarm(): @@ -408,13 +408,13 @@ class testVifibMixin(ERP5TypeTestCase): activateAlarm() transaction.commit() - super(testVifibMixin, self).stepTic(**kw) + self.tic() # retrigger activateAlarm after tic activateAlarm() transaction.commit() # tic after activateAlarm - super(testVifibMixin, self).stepTic(**kw) + self.tic() self.checkDivergency() diff --git a/master/product/Vifib/tests/VifibSecurityMixin.py b/master/product/Vifib/tests/VifibSecurityMixin.py index b77fdf1b684eb163e6491a6a8ccc8d3494c434f0..d674c7bae8725c2c52ab291f985519b97e9e4ff3 100644 --- a/master/product/Vifib/tests/VifibSecurityMixin.py +++ b/master/product/Vifib/tests/VifibSecurityMixin.py @@ -87,6 +87,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin): career_role='internal', # password='hackme', ) + self.markManualCreation(person) if user_name != 'manager': self.assertTrue(user.has_permission('Access contents information', person)) @@ -107,6 +108,7 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin): start_date = '01/01/1900', stop_date = '01/01/2900', ) + self.markManualCreation(assignment) if user_name != 'manager': self.assertTrue(user.has_permission('Access contents information', assignment)) @@ -209,17 +211,3 @@ class testVifibSecurityMixin(SecurityTestCase, testVifibMixin): Logout """ self.logout() - - def stepAddObject(self, sequence=None, sequence_list=None, **kw): - """ - Add an object in the module - """ - portal = self.getPortal() - portal_type = sequence.get('object_portal_type') - module = portal.getDefaultModule(portal_type) - obj = module.newContent(portal_type=portal_type) - sequence.edit( - obj_id=obj.getId() - ) - transaction.commit() - self.tic() diff --git a/master/product/Vifib/tests/testVifibDefaultUseCase.py b/master/product/Vifib/tests/testVifibDefaultUseCase.py index 81683d527df1c391ad2dd943453e01d904be2938..b6148a9426ee20f009ee3078b5892753bb222e48 100644 --- a/master/product/Vifib/tests/testVifibDefaultUseCase.py +++ b/master/product/Vifib/tests/testVifibDefaultUseCase.py @@ -4,20 +4,43 @@ from testVifibSlapWebService import TestVifibSlapWebServiceMixin class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): + def _getRegistrationInvoice(self, person): + transaction_list = self.portal.portal_catalog( + resource_relative_url=self.portal.portal_preferences\ + .getPreferredRegistrationResource(), + portal_type="Invoice Line", + **{'movement.destination_uid': person.getUid()} + ) + self.assertEquals(1, len(transaction_list)) + + return transaction_list[0].getObject().getParentValue() + + def _getMonthlyInvoice(self, person): + line_list = self.portal.portal_catalog( + resource_relative_url=[ + self.portal.portal_preferences.getPreferredInstanceSetupResource(), + self.portal.portal_preferences.getPreferredInstanceHostingResource(), + self.portal.portal_preferences.getPreferredInstanceCleanupResource(), + self.portal.portal_preferences.getPreferredInstanceUpdateResource(), + self.portal.portal_preferences.getPreferredInstanceSubscriptionResource(), + ], + portal_type="Invoice Line", + **{'movement.destination_uid': person.getUid()} + ) + + transaction_list = [line.getParentValue() for line in line_list] + transaction_list = list(set(transaction_list)) + self.assertEquals(1, len(transaction_list)) + + return transaction_list[0].getObject() + def stepCheckRegistrationAccounting(self, sequence, **kw): """ """ person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ 'web_user']) - # Check that one sale invoice has been generated for the user - transaction_list = self.portal.portal_catalog( - portal_type="Sale Invoice Transaction", - destination_section_relative_url=person.getRelativeUrl(), - ) - self.assertEquals(1, len(transaction_list)) - - sale_invoice = transaction_list[0].getObject() + sale_invoice = self._getRegistrationInvoice(person) # Check invoice creation self.assertEquals( @@ -172,14 +195,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ 'web_user']) - # Check that one sale invoice has been generated for the user - transaction_list = self.portal.portal_catalog( - portal_type="Sale Invoice Transaction", - destination_section_relative_url=person.getRelativeUrl(), - ) - self.assertEquals(1, len(transaction_list)) - - sale_invoice = transaction_list[0].getObject() + sale_invoice = self._getRegistrationInvoice(person) # Check invoice creation self.assertEquals( @@ -465,7 +481,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): # 1 invoice line is expected invoice_line_list = sale_invoice.contentValues( portal_type="Invoice Line") - self.assertEquals(3, len(invoice_line_list)) + self.assertEquals(4, len(invoice_line_list)) service_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_setup'][0] @@ -473,6 +489,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): if x.getResource() == 'service_module/vifib_instance_subscription'][0] hosting_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_hosting'][0] + update_line = [x for x in invoice_line_list \ + if x.getResource() == 'service_module/vifib_instance_update'][0] self.assertEquals(True, service_line.hasPrice()) self.assertAlmostEquals(0, service_line.getPrice(), 3) @@ -486,6 +504,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals(0, hosting_line.getPrice(), 3) self.assertEquals(1, hosting_line.getQuantity()) + self.assertEquals(True, update_line.hasPrice()) + self.assertAlmostEquals(0, update_line.getPrice(), 3) + self.assertEquals(1, update_line.getQuantity()) + # 0 transaction line transaction_line_list = sale_invoice.contentValues( portal_type="Sale Invoice Transaction Line") @@ -551,7 +573,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): # 1 invoice line is expected invoice_line_list = sale_invoice.contentValues( portal_type="Invoice Line") - self.assertEquals(4, len(invoice_line_list)) + self.assertEquals(5, len(invoice_line_list)) service_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_setup'][0] @@ -561,6 +583,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): if x.getResource() == 'service_module/vifib_instance_hosting'][0] destroy_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_cleanup'][0] + update_line = [x for x in invoice_line_list \ + if x.getResource() == 'service_module/vifib_instance_update'][0] self.assertEquals(True, service_line.hasPrice()) self.assertAlmostEquals(0, service_line.getPrice(), 3) @@ -578,6 +602,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals(0, destroy_line.getPrice(), 3) self.assertEquals(1, destroy_line.getQuantity()) + self.assertEquals(True, update_line.hasPrice()) + self.assertAlmostEquals(0, update_line.getPrice(), 3) + self.assertEquals(2, update_line.getQuantity()) + # 0 transaction line transaction_line_list = sale_invoice.contentValues( portal_type="Sale Invoice Transaction Line") @@ -596,7 +624,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): portal_type="Sale Invoice Transaction", simulation_state="planned"): invoice = invoice.getObject() - invoice.confirm() + invoice.SaleInvoiceTransaction_confirmPlanned( + # force invoice confirmation (or moving to next month) + this_month=invoice.getStartDate() + 1 + ) def stepCheckWaitingInvoice(self, sequence, **kw): """ @@ -604,15 +635,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ 'web_user']) - # Check that 2 sale invoice has been generated for the user - transaction_list = self.portal.portal_catalog( - portal_type="Sale Invoice Transaction", - destination_section_relative_url=person.getRelativeUrl(), - sort_on=(('creation_date', 'DESC'),), - ) - self.assertEquals(2, len(transaction_list)) - - sale_invoice = transaction_list[0].getObject() + sale_invoice = self._getMonthlyInvoice(person) # Check invoice creation self.assertEquals( @@ -642,10 +665,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals( 1, sale_invoice.getTotalPrice(), 3) - # 5 invoice lines are expected + # 6 invoice lines are expected invoice_line_list = sale_invoice.contentValues( portal_type="Invoice Line") - self.assertEquals(5, len(invoice_line_list)) + self.assertEquals(6, len(invoice_line_list)) service_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_setup'][0] @@ -655,6 +678,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): if x.getResource() == 'service_module/vifib_instance_hosting'][0] destroy_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_cleanup'][0] + update_line = [x for x in invoice_line_list \ + if x.getResource() == 'service_module/vifib_instance_update'][0] tax_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_tax'][0] @@ -674,6 +699,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals(0, destroy_line.getPrice(), 3) self.assertEquals(1, destroy_line.getQuantity()) + self.assertEquals(True, update_line.hasPrice()) + self.assertAlmostEquals(0, update_line.getPrice(), 3) + self.assertEquals(2, update_line.getQuantity()) + self.assertEquals(True, tax_line.hasPrice()) self.assertAlmostEquals(0.196, tax_line.getPrice(), 3) self.assertAlmostEquals(0.836, tax_line.getQuantity(), 3) @@ -782,15 +811,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ 'web_user']) - # Check that 2 sale invoice has been generated for the user - transaction_list = self.portal.portal_catalog( - portal_type="Sale Invoice Transaction", - destination_section_relative_url=person.getRelativeUrl(), - sort_on=(('creation_date', 'DESC'),), - ) - self.assertEquals(2, len(transaction_list)) - - sale_invoice = transaction_list[0].getObject() + sale_invoice = self._getMonthlyInvoice(person) # Check invoice creation self.assertEquals( @@ -823,7 +844,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): # 5 invoice lines are expected invoice_line_list = sale_invoice.contentValues( portal_type="Invoice Line") - self.assertEquals(5, len(invoice_line_list)) + self.assertEquals(6, len(invoice_line_list)) service_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_setup'][0] @@ -833,6 +854,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): if x.getResource() == 'service_module/vifib_instance_hosting'][0] destroy_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_cleanup'][0] + update_line = [x for x in invoice_line_list \ + if x.getResource() == 'service_module/vifib_instance_update'][0] tax_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_tax'][0] @@ -852,6 +875,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals(0, destroy_line.getPrice(), 3) self.assertEquals(1, destroy_line.getQuantity()) + self.assertEquals(True, update_line.hasPrice()) + self.assertAlmostEquals(0, update_line.getPrice(), 3) + self.assertEquals(2, update_line.getQuantity()) + self.assertEquals(True, tax_line.hasPrice()) self.assertAlmostEquals(0.196, tax_line.getPrice(), 3) self.assertAlmostEquals(0.836, tax_line.getQuantity(), 3) @@ -1061,6 +1088,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): \ SlapLogout \ Tic \ + CallVifibTriggerBuildAlarm \ + CleanTic \ + CallVifibExpandDeliveryLineAlarm \ + CleanTic \ CallVifibUpdateDeliveryCausalityStateAlarm \ CleanTic \ CallStopConfirmedSaleInvoiceTransactionAlarm \ @@ -1093,15 +1124,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue(sequence[ 'web_user']) - # Check that 2 sale invoice has been generated for the user - transaction_list = self.portal.portal_catalog( - portal_type="Sale Invoice Transaction", - destination_section_relative_url=person.getRelativeUrl(), - sort_on=(('creation_date', 'DESC'),), - ) - self.assertEquals(2, len(transaction_list)) - - sale_invoice = transaction_list[0].getObject() + sale_invoice = self._getMonthlyInvoice(person) # Check invoice creation self.assertEquals( @@ -1134,7 +1157,7 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): # 5 invoice lines are expected invoice_line_list = sale_invoice.contentValues( portal_type="Invoice Line") - self.assertEquals(5, len(invoice_line_list)) + self.assertEquals(6, len(invoice_line_list)) service_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_setup'][0] @@ -1144,6 +1167,8 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): if x.getResource() == 'service_module/vifib_instance_hosting'][0] destroy_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_instance_cleanup'][0] + update_line = [x for x in invoice_line_list \ + if x.getResource() == 'service_module/vifib_instance_update'][0] tax_line = [x for x in invoice_line_list \ if x.getResource() == 'service_module/vifib_tax'][0] @@ -1163,6 +1188,10 @@ class TestVifibDefaultUseCase(TestVifibSlapWebServiceMixin): self.assertAlmostEquals(0, destroy_line.getPrice(), 3) self.assertEquals(2, destroy_line.getQuantity()) + self.assertEquals(True, update_line.hasPrice()) + self.assertAlmostEquals(0, update_line.getPrice(), 3) + self.assertEquals(6, update_line.getQuantity()) + self.assertEquals(True, tax_line.hasPrice()) self.assertAlmostEquals(0.196, tax_line.getPrice(), 3) self.assertAlmostEquals(1.672, tax_line.getQuantity(), 3) diff --git a/master/product/Vifib/tests/testVifibFiber.py b/master/product/Vifib/tests/testVifibFiber.py index 6844315c119e1b868f59dc9fb0c41935156e275a..5392a0b41e1705b6e07c661a256f398f387650ce 100644 --- a/master/product/Vifib/tests/testVifibFiber.py +++ b/master/product/Vifib/tests/testVifibFiber.py @@ -43,6 +43,7 @@ class TestVifibFiberSubscription(testVifibSecurityMixin): module = self.portal.getDefaultModule("Organisation") organisation = module.newContent(portal_type="Organisation", reference="vifib-support") + self.markManualCreation(organisation) organisation.validate() #Install website diff --git a/master/product/Vifib/tests/testVifibSkinSelection.py b/master/product/Vifib/tests/testVifibSkinSelection.py index 1f7843c6f95afe6caddd63632011730d6418596e..74c1ae0f4a60e2459e8691a7bf810eb7bbaba2f1 100644 --- a/master/product/Vifib/tests/testVifibSkinSelection.py +++ b/master/product/Vifib/tests/testVifibSkinSelection.py @@ -121,9 +121,10 @@ vifib_jauks_theme vifib_jauks_widget_library vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web @@ -150,6 +151,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -220,9 +222,10 @@ vifib_jauks_theme vifib_jauks_widget_library vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web @@ -250,6 +253,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -321,9 +325,10 @@ vifib_jauks_theme vifib_jauks_widget_library vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web @@ -350,6 +355,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -417,9 +423,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -445,6 +452,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -510,9 +518,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -538,6 +547,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -603,9 +613,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web @@ -632,6 +643,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -700,9 +712,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -728,6 +741,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -796,9 +810,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -824,6 +839,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -889,9 +905,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -917,6 +934,7 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource @@ -981,9 +999,10 @@ vifib_core vifib_forge_release vifib_open_trade vifib_payzen +vifib_promise vifib_simulation vifib_slap -vifib_slapos_rest_api_v1 +vifib_slapos_rest_api vifib_software_pdm vifib_test vifib_web_ui_test @@ -1009,6 +1028,101 @@ erp5_content_translation erp5_core erp5_core_proxy_field_legacy erp5_credential +erp5_credential_oauth2 +erp5_crm +erp5_dhtml_style +erp5_discount_resource +erp5_dms +erp5_fckeditor +erp5_forge +erp5_forge_release +erp5_gadget +erp5_glossary +erp5_ingestion +erp5_ingestion_test +erp5_integration +erp5_invoicing +erp5_item +erp5_item_trade +erp5_ods_core +erp5_odt_core +erp5_ooo_import +erp5_open_trade +erp5_payzen_secure_payment +erp5_pdm +erp5_project +erp5_project_trade +erp5_rss_core +erp5_secure_payment +erp5_simplified_invoicing +erp5_software_pdm +erp5_system_event +erp5_tax_resource +erp5_toolbox +erp5_trade +erp5_ui_test +erp5_ui_test_core +erp5_vcs +erp5_web +erp5_web_crm +erp5_web_minimal_theme +erp5_web_widget_library +erp5_xhtml_jquery_style +external_method +Images +activity +zpt_content +zpt_control +zpt_generic +""" + self.assertSameSkinSelection(skin_name, selection_string_list) + + def test_14_Outdated_selection(self): + """ + Check the skin folder order + """ + skin_name = 'Outdated' + selection_string_list = \ +""" +custom +vifib_upgrader +vifib_upgrader_20120423 +vifib_upgrader_before_201208 +vifib_agent +vifib_base +vifib_core +vifib_forge_release +vifib_open_trade +vifib_payzen +vifib_promise +vifib_simulation +vifib_slap +vifib_slapos_rest_api +vifib_software_pdm +vifib_test +vifib_web_ui_test +erp5_km +erp5_knowledge_pad +erp5_simulation +erp5_dms_base +erp5_dms_web +erp5_legacy_tax_system +erp5_accounting_l10n_fr +erp5_upgrader +erp5_access_tab +erp5_accounting +erp5_accounting_bbb +erp5_administration +erp5_base +erp5_bearer_token +erp5_commerce +erp5_commerce_widget_library +erp5_computer_immobilisation +erp5_content_translation +erp5_core +erp5_core_proxy_field_legacy +erp5_credential +erp5_credential_oauth2 erp5_crm erp5_dhtml_style erp5_discount_resource diff --git a/master/product/Vifib/tests/testVifibSlapAllocationScope.py b/master/product/Vifib/tests/testVifibSlapAllocationScope.py index 1ede9cfbf00f0ebeec91236b33d5f8fe2f92520a..dba5cc8fe0ead99bb17c621773251f69cf519460 100644 --- a/master/product/Vifib/tests/testVifibSlapAllocationScope.py +++ b/master/product/Vifib/tests/testVifibSlapAllocationScope.py @@ -74,7 +74,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): to owner""" self.computer_partition_amount = 2 sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -169,7 +169,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): to owner and its friends""" self.computer_partition_amount = 3 sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -272,7 +272,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): to anybody""" self.computer_partition_amount = 2 sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -344,7 +344,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): """Check that computer is close it is not only available to anybody""" sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -394,7 +394,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): def test_allocation_scope_empty(self): """Check that computer's allocation scope is not set it is unavailable""" sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -441,7 +441,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - prepare_open_public_computer = """ + prepare_open_public_computer = TestVifibSlapWebServiceMixin.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -608,6 +608,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): StoreTestVifibAdminComputerPartitionCoordinate + """ + self.stabilise_accounting + """ # request as someone else LoginTestVifibCustomerA PersonRequestSoftwareInstance @@ -764,7 +765,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): if computer is close""" self.computer_partition_amount = 2 sequence_list = SequenceList() - sequence_string = """ + sequence_string = self.stabilise_accounting + """ LoginTestVifibCustomer CustomerRegisterNewComputer Tic @@ -772,6 +773,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): LoginDefaultUser SetComputerCoordinatesFromComputerTitle + CleanTic Logout LoginTestVifibCustomer @@ -803,6 +805,7 @@ class TestVifibSlapAllocationScope(TestVifibSlapWebServiceMixin): LoginDefaultUser CallConfirmOrderedSaleOrderAlarm Tic + Tic SetSelectedComputerPartition SelectCurrentlyUsedSalePackingListUid Logout diff --git a/master/product/Vifib/tests/testVifibSlapBang.py b/master/product/Vifib/tests/testVifibSlapBang.py index 70f040fa0200bd9a452362058e7fd0258912e923..b17ca48e8cf565d05c6217b0ea5c5b0ca814c4ba 100644 --- a/master/product/Vifib/tests/testVifibSlapBang.py +++ b/master/product/Vifib/tests/testVifibSlapBang.py @@ -66,18 +66,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): sequence['computer_reference'], sequence['computer_partition_reference']) slap_computer_partition.bang(self.bang_message) - - def stepProcessSoftwareInstanceList(self, sequence, **kw): - S0 = self.portal.portal_catalog.getResultValue(uid=sequence['S0_uid']) - S0.startComputerPartition() - S1 = self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid']) - S1.stopComputerPartition() - S2 = self.portal.portal_catalog.getResultValue(uid=sequence['S2_uid']) - S2.stopComputerPartition() - S3 = self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid']) - S3.stopComputerPartition() - S4 = self.portal.portal_catalog.getResultValue(uid=sequence['S4_uid']) - S4.stopComputerPartition() + sequence.edit(expected_bang_count=sequence.get('expected_bang_count', 2) + 1) def stepSetCurrentSoftwareInstanceS1(self, sequence, **kw): S1 = self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid']) @@ -95,31 +84,36 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): .getAggregateValue(portal_type='Computer Partition').getReference() ) - def checkSoftwareInstanceBangMessage(self, software_instance): - bang_list = [q for q in software_instance.Base_getWorkflowHistoryItemList( - 'instance_slap_interface_workflow') + def checkSoftwareInstanceBangMessage(self, count, software_instance): + bang_list = [q for q in reversed(software_instance\ + .Base_getWorkflowHistoryItemList('instance_slap_interface_workflow')) if q.action == 'bang'] - self.assertEqual(5, len(bang_list)) + self.assertEqual(count, len(bang_list)) self.assertEqual(self.bang_message, bang_list[0].comment) def stepCheckS0BangMessage(self, sequence, **kw): self.checkSoftwareInstanceBangMessage( + sequence['expected_bang_count'], self.portal.portal_catalog.getResultValue(uid=sequence['S0_uid'])) def stepCheckS1BangMessage(self, sequence, **kw): self.checkSoftwareInstanceBangMessage( + sequence['expected_bang_count'], self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid'])) def stepCheckS2BangMessage(self, sequence, **kw): self.checkSoftwareInstanceBangMessage( + sequence['expected_bang_count'], self.portal.portal_catalog.getResultValue(uid=sequence['S1_uid'])) def stepCheckS3BangMessage(self, sequence, **kw): self.checkSoftwareInstanceBangMessage( + sequence['expected_bang_count'], self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid'])) def stepCheckS4BangMessage(self, sequence, **kw): self.checkSoftwareInstanceBangMessage( + sequence['expected_bang_count'], self.portal.portal_catalog.getResultValue(uid=sequence['S3_uid'])) def test_bang_computer_partition_complex_tree(self): @@ -160,8 +154,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - ProcessSoftwareInstanceList - Tic SetCurrentSoftwareInstanceS1 Logout @@ -183,8 +175,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - ProcessSoftwareInstanceList - Tic SetCurrentSoftwareInstanceS3 Logout @@ -218,6 +208,7 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): slap_computer = self.slap.registerComputer( sequence['computer_reference']) slap_computer.bang(self.bang_message) + sequence.edit(expected_bang_count=sequence.get('expected_bang_count', 2) + 5) def stepCheckComputerBangMessage(self, sequence, **kw): computer = self.portal.portal_catalog.getResultValue( @@ -590,12 +581,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def stepCheckComputerPartitionNoInstanceUpdateSalePackingList(self, - sequence, **kw): - self._checkComputerPartitionNoSalePackingList( - self.portal.portal_preferences.getPreferredInstanceUpdateResource(), - sequence) - def test_computer_bang_not_called_on_destroying_destroyed(self): """Check that bang is ignoring destruction in progress and destroyed computer partitions""" @@ -609,10 +594,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): Tic SlapLogout - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - SlapLoginCurrentComputer SoftwareInstanceDestroyed Tic @@ -629,10 +610,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): Tic SlapLogout - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - LoginERP5TypeTestCase CheckSiteConsistency Logout @@ -711,10 +688,6 @@ class TestVifibSlapBang(TestVifibSlapWebServiceMixin): Tic SlapLogout - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - LoginERP5TypeTestCase CheckSiteConsistency Logout diff --git a/master/product/Vifib/tests/testVifibSlapBug.py b/master/product/Vifib/tests/testVifibSlapBug.py index 7ce9ebdfef9e25f11ff0358754bc9c3b0a2433be..5c4533b57a9cd52ad30d5a865e9074389b4030c0 100644 --- a/master/product/Vifib/tests/testVifibSlapBug.py +++ b/master/product/Vifib/tests/testVifibSlapBug.py @@ -13,6 +13,10 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): PersonRequestSoftwareInstance \ Tic \ Logout \ + CallConfirmOrderedSaleOrderAlarm \ + CleanTic \ + CallVifibTriggerBuildAlarm \ + CleanTic \ LoginERP5TypeTestCase \ CheckSiteConsistency \ Logout \ @@ -43,7 +47,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): .prepare_stopped_computer_partition_sequence_string + """ LoginTestVifibCustomer RequestSoftwareInstanceStart - RequestSoftwareInstanceStartRaisesValueError + RequestSoftwareInstanceStart Tic Logout @@ -58,20 +62,6 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def test_bug_doubleClickOnStart_serializeIsCalled(self): - sequence_list = SequenceList() - sequence_string = self\ - .prepare_stopped_computer_partition_sequence_string + """ - LoginTestVifibCustomer - RequestSoftwareInstanceStartCheckSerializeIsCalled - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - def test_bug_doubleClickOnDestroy(self): sequence_list = SequenceList() sequence_string = self\ @@ -93,20 +83,6 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def test_bug_doubleClickOnDestroy_serializeIsCalled(self): - sequence_list = SequenceList() - sequence_string = self\ - .prepare_installed_computer_partition_sequence_string + """ - LoginTestVifibCustomer - RequestSoftwareInstanceDestroyCheckSerializeIsCalled - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - def stepArchiveSoftwareRelease(self, sequence, **kw): """ Submit the software release document. @@ -328,7 +304,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered + CheckComputerPartitionInstanceHostingSalePackingListStopped Logout # ...and request destruction @@ -338,6 +314,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser + CheckComputerPartitionInstanceHostingSalePackingListDelivered CheckComputerPartitionInstanceCleanupSalePackingListConfirmed Logout @@ -445,7 +422,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered + CheckComputerPartitionInstanceHostingSalePackingListStopped Logout # Now request destruction of second software instance... @@ -456,6 +433,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser + CheckComputerPartitionInstanceHostingSalePackingListDelivered CheckComputerPartitionInstanceCleanupSalePackingListConfirmed Logout @@ -534,7 +512,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): CheckComputerPartitionInstanceSetupSalePackingListDelivered CheckComputerPartitionInstanceCleanupSalePackingListDelivered CheckComputerPartitionIsFree - CheckComputerPartitionNoInstanceHostingSalePackingList + CheckComputerPartitionInstanceHostingSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -567,18 +545,6 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): CheckComputerPartitionInstanceCleanupSalePackingListCancelled Logout - # So all packing lists are finished, but one is cancelled, - # time to request destruction... - - LoginDefaultUser - RequestSoftwareInstanceDestroy - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionInstanceCleanupSalePackingListConfirmed - Logout - # ...and destroy it SlapLoginCurrentComputer @@ -587,7 +553,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceCleanupSalePackingListDelivered + CheckComputerPartitionInstanceCleanupSalePackingListCancelled CheckComputerPartitionIsFree Logout @@ -1212,6 +1178,9 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) + def stepSetSequenceSoftwareInstanceRequestedStateDestroyed(self, sequence, **kw): + sequence['requested_state'] = 'destroyed' + def test_request_new_with_destroyed_while_looking_for_partition_reference(self): """Prove that having destroyed SI allows to request new one with same reference, when destruction was done while looking for new partition""" @@ -1229,7 +1198,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): Tic SlapLogout - SetRandomRequestedReference + SetRandomRequestedReferenceAndTitle SlapLoginTestVifibCustomer PersonRequestSlapSoftwareInstancePrepare Tic @@ -1251,7 +1220,8 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): Logout LoginTestVifibCustomer - RequestSoftwareInstanceDestroy + SetSequenceSoftwareInstanceStateDestroyed + PersonRequestSoftwareInstance Tic Logout @@ -1363,6 +1333,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): SetRequestedComputerPartition CheckComputerPartitionNoInstanceHostingSalePackingList CheckComputerPartitionInstanceSetupSalePackingListDelivered + Tic Logout LoginERP5TypeTestCase @@ -1384,6 +1355,7 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): """ LoginTestVifibCustomer + SetSequenceSoftwareInstanceStateStopped PersonRequestSoftwareInstance Tic Logout @@ -1617,6 +1589,8 @@ class TestVifibSlapBug(TestVifibSlapWebServiceMixin): Tic Logout + """ + self.stabilise_accounting + """ + LoginWebUser CustomerRegisterNewComputer Tic diff --git a/master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py b/master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py index 7a4fe80f2a752ca1ad55b3a67ddb4f8bc1a38785..f05f20f1502a252fbcdf856a0611431fdb3b32d2 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py +++ b/master/product/Vifib/tests/testVifibSlapComputerGetComputerPartitionList.py @@ -4,7 +4,6 @@ from Products.ERP5Type.tests.backportUnittest import skip import transaction import unittest from testVifibSlapWebService import TestVifibSlapWebServiceMixin -from Products.DCWorkflow.DCWorkflow import ValidationFailed class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin): ######################################## @@ -149,11 +148,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin SelectCurrentlyUsedSalePackingListUid \ CancelSalePackingList \ Tic \ - CheckComputerPartitionInstanceSetupSalePackingListCancelled \ - SelectCurrentlyUsedSalePackingListUid \ - CancelSalePackingList \ - Tic \ - CheckComputerPartitionInstanceCleanupSalePackingListCancelled \ + CheckComputerPartitionInstanceHostingSalePackingListCancelled \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerGetComputerPartitionCall \ @@ -250,8 +245,6 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin CleanTic \ \ LoginDefaultUser \ - DeliverInstanceSetupSalePackingList \ - Tic \ CheckComputerPartitionInstanceSetupSalePackingListDelivered \ SelectCurrentlyUsedSalePackingListUid \ CancelSalePackingList \ @@ -341,7 +334,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin SlapLogout \ \ LoginTestVifibCustomer \ - SetRandomRequestedReference \ + SetSoftwareTitleRandom \ PersonRequestSlaveInstance \ Tic \ SlapLogout \ @@ -363,7 +356,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin \ LoginDefaultUser \ SetDeliveryLineAmountEqualOne \ - CheckComputerPartitionInstanceHostingSalePackingListStarted \ + CheckComputerPartitionInstanceHostingSalePackingListConfirmed \ Logout \ \ SlapLoginCurrentComputer \ @@ -371,7 +364,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin SlapLogout \ \ LoginTestVifibCustomer \ - SetRandomRequestedReference \ + SetSoftwareTitleRandom \ PersonRequestSlaveInstance \ Tic \ SlapLogout \ @@ -393,7 +386,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin \ LoginDefaultUser \ SetDeliveryLineAmountEqualOne \ - CheckComputerPartitionInstanceHostingSalePackingListStarted \ + CheckComputerPartitionInstanceHostingSalePackingListConfirmed \ Logout \ \ SlapLoginCurrentComputer \ @@ -413,7 +406,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin \ LoginDefaultUser \ SetDeliveryLineAmountEqualOne \ - CheckComputerPartitionInstanceHostingSalePackingListDelivered \ + CheckComputerPartitionInstanceHostingSalePackingListStopped \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerGetComputerPartitionCall \ @@ -488,7 +481,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin Logout \ \ SlapLoginCurrentComputer \ - CheckStartedComputerPartitionGetStateCall \ + CheckDestroyedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -696,7 +689,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin Tic \ Logout \ SlapLoginCurrentComputer \ - CheckStoppedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -705,51 +698,12 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def stepSetSoftwareInstanceValidConnectionXML(self, sequence, **kw): - software_instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - software_instance.edit(connection_xml="") - - def stepDamageSoftwareInstanceSlaXml(self, sequence, **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - if instance.getPortalType() == "Software Instance": - shared = False - elif instance.getPortalType() == "Slave Instance": - shared = True - else: - raise NotImplementedError - self.assertRaises(ValidationFailed, instance.requestStart, - software_release=instance.getRootSoftwareReleaseUrl(), - instance_xml=instance.getTextContent(), - software_type=instance.getSourceReference(), - sla_xml="""DAMAGED<BAD?xml XMLversion="1.0" encoding="utf-8"?>""", - shared=shared, - ) - def stepDamageSoftwareInstanceConnectionXml(self, sequence, **kw): instance = self.portal.portal_catalog.getResultValue( uid=sequence['software_instance_uid']) instance.edit(connection_xml=""" DAMAGED<BAD?xml XMLversion="1.0" encoding="utf-8"?>""") - def stepDamageSoftwareInstanceXml(self, sequence, **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - if instance.getPortalType() == "Software Instance": - shared = False - elif instance.getPortalType() == "Slave Instance": - shared = True - else: - raise NotImplementedError - self.assertRaises(ValidationFailed, instance.requestStart, - software_release=instance.getRootSoftwareReleaseUrl(), - instance_xml="""DAMAGED<BAD?xml XMLversion="1.0" encoding="utf-8"?>""", - software_type=instance.getSourceReference(), - sla_xml=instance.getSlaXml(), - shared=shared, - ) - def stepCheckDamageSoftwareInstanceSiteConsistency(self, sequence, **kw): software_instance = self.portal.portal_catalog.getResultValue( uid=sequence['software_instance_uid']) @@ -762,7 +716,7 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin consistency_error = consistency_error_list[0] self.assertEqual(consistency_error.getObject().getPath(), software_instance.getPath()) - self.assertTrue('Sla XML is invalid' in str(consistency_error.getMessage())) + self.assertTrue('Connection XML is invalid' in str(consistency_error.getMessage())) self.assertTrue(self.portal.portal_alarms.vifib_check_consistency.sense()) self.checkDivergency() @@ -772,15 +726,6 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin sequence_list = SequenceList() sequence_string = self\ .prepare_install_requested_computer_partition_sequence_string + """ - LoginDefaultUser - DamageSoftwareInstanceXml - Logout - - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - Tic - SlapLogout - LoginDefaultUser SetSoftwareInstanceValidXML DamageSoftwareInstanceConnectionXml @@ -791,16 +736,6 @@ class TestVifibSlapComputerGetComputerPartitionList(TestVifibSlapWebServiceMixin Tic SlapLogout - LoginDefaultUser - SetSoftwareInstanceValidConnectionXML - DamageSoftwareInstanceSlaXml - Logout - - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - Tic - SlapLogout - LoginERP5TypeTestCase CheckDamageSoftwareInstanceSiteConsistency Logout diff --git a/master/product/Vifib/tests/testVifibSlapComputerGetSoftwareReleaseList.py b/master/product/Vifib/tests/testVifibSlapComputerGetSoftwareReleaseList.py index abee8517b825bddd3953362f638e6fc4bc93798c..294918bf13a714d4cc37250ef56f142522b16045 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerGetSoftwareReleaseList.py +++ b/master/product/Vifib/tests/testVifibSlapComputerGetSoftwareReleaseList.py @@ -246,7 +246,7 @@ class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckEmptyComputerGetSoftwareReleaseListCall \ + CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -265,7 +265,7 @@ class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckEmptyComputerGetSoftwareReleaseListCall \ + CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout' + self.prepare_software_release_cleanup_confirmed_packing_list + '\ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ @@ -294,7 +294,7 @@ class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckEmptyComputerGetSoftwareReleaseListCall \ + CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -315,7 +315,7 @@ class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckEmptyComputerGetSoftwareReleaseListCall \ + CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout' + self.prepare_software_release_cleanup_confirmed_packing_list + '\ SlapLoginCurrentComputer \ CheckSuccessComputerGetSoftwareReleaseListCall \ @@ -588,6 +588,7 @@ class TestVifibSlapComputerGetSoftwareReleaseList(TestVifibSlapWebServiceMixin): SetPurchasePackingListLineSetupResource \ SetPurchasePackingListLineAggregate \ ConfirmPurchasePackingList \ + StartBuildingPurchasePackingList \ Tic \ Logout \ SlapLoginCurrentComputer \ diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionBuilding.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionBuilding.py index 7bd6f9c9307a65c04f56cbf68336826df4d1d349..0ab6d457a2d176ff34f128d2734dc8b5c810380b 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionBuilding.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionBuilding.py @@ -32,7 +32,8 @@ class TestVifibSlapComputerPartitionBuilding(TestVifibSlapWebServiceMixin): sequence_list = SequenceList() sequence_string = self.prepare_building_computer_partition_sequence_string + """ LoginTestVifibCustomer - RequestSoftwareInstanceDestroy + SetSequenceSoftwareInstanceStateDestroyed + PersonRequestSoftwareInstance Tic Logout diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionError.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionError.py index f0046552a9daa77fe129d972e1c57f60077ce12d..22848eda3b52a3239a4ad3a46c71a244637de007 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionError.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionError.py @@ -1,5 +1,4 @@ from Products.ERP5Type.tests.Sequence import SequenceList -from Products.ERP5Type.tests.backportUnittest import expectedFailure import unittest from testVifibSlapWebService import TestVifibSlapWebServiceMixin @@ -29,6 +28,7 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): Tic \ SlapLoginCurrentComputer \ CheckNotFoundComputerPartitionErrorAfterRegisterCall \ + CleanTic \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -37,35 +37,6 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - @expectedFailure - def test_ComputerPartition_error_SetupResource_CancelledState(self): - """ - Check that calling ComputerPartition.error works in - cancelled state with the setup resource - """ - sequence_list = SequenceList() - sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\ - LoginDefaultUser \ - SelectCurrentlyUsedSalePackingListUid \ - CancelSalePackingList \ - Tic \ - Logout \ - \ - SlapLoginCurrentComputer \ - CheckSuccessComputerPartitionErrorCall \ - Tic \ - SlapLogout \ - \ - LoginDefaultUser \ - CheckSalePackingListErrorText \ - Logout \ - LoginERP5TypeTestCase \ - CheckSiteConsistency \ - Logout \ - ' - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - def test_ComputerPartition_error_SetupResource_ConfirmedState(self): """ Check that calling ComputerPartition.error works in @@ -140,8 +111,6 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): sequence_list = SequenceList() sequence_string = self.prepare_installed_computer_partition_sequence_string + '\ LoginDefaultUser \ - DeliverSalePackingList \ - Tic \ CheckComputerPartitionInstanceSetupSalePackingListDelivered \ Logout \ \ @@ -312,10 +281,12 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): Logout \ SlapLoginCurrentComputer \ CheckSoftwareReleaseErrorCall \ + CleanTic \ SlapLogout \ LoginDefaultUser \ SelectCurrentlyUsedSalePackingListUid \ CheckSalePackingListErrorText \ + CleanTic \ Logout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -337,6 +308,7 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerPartitionErrorCall \ + CleanTic \ SlapLogout \ LoginDefaultUser \ CheckSalePackingListErrorText \ @@ -358,11 +330,13 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\ LoginDefaultUser \ StartSalePackingList \ + CleanTic \ StopSalePackingList \ Tic \ Logout \ SlapLoginCurrentComputer \ CheckSuccessComputerPartitionErrorCall \ + CleanTic \ SlapLogout \ LoginDefaultUser \ CheckSalePackingListErrorText \ @@ -384,15 +358,18 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): sequence_string = self.prepare_confirmed_cleanup_resource_packing_list + '\ LoginDefaultUser \ StartSalePackingList \ + CleanTic \ StopSalePackingList \ + CleanTic \ DeliverSalePackingList \ Tic \ Logout \ SlapLoginCurrentComputer \ - CheckNotFoundComputerPartitionErrorCall \ + CheckSuccessComputerPartitionErrorCall \ + CleanTic \ SlapLogout \ LoginDefaultUser \ - CheckSalePackingListNoErrorText \ + CheckSalePackingListErrorText \ CheckDeliveredSalePackingList \ Logout \ LoginERP5TypeTestCase \ @@ -522,7 +499,9 @@ class TestVifibSlapComputerPartitionError(TestVifibSlapWebServiceMixin): sequence_string = self.prepare_computer_partition_accounting_resource_sequence_string + '\ LoginDefaultUser \ StartSalePackingList \ + CleanTic \ StopSalePackingList \ + CleanTic \ DeliverSalePackingList \ Tic \ Logout \ diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionGetInstanceParameterDict.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionGetInstanceParameterDict.py index 6cf2165bace16ba1c15cbaa6e032086d01655a1a..e4550636c7cacffe6d1156ca5fd9e71dfff6b312 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionGetInstanceParameterDict.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionGetInstanceParameterDict.py @@ -104,6 +104,9 @@ class TestVifibSlapComputerPartitionGetInstanceParameterDict(TestVifibSlapWebSer """ sequence_list = SequenceList() sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\ + LoginERP5TypeTestCase \ + FillTimestamp \ + Logout \ SlapLoginCurrentSoftwareInstance \ CheckMinimalParametersTransmitted \ SlapLogout \ @@ -125,6 +128,9 @@ class TestVifibSlapComputerPartitionGetInstanceParameterDict(TestVifibSlapWebSer SetSoftwareInstanceValidXML \ Tic \ Logout \ + LoginERP5TypeTestCase \ + FillTimestamp \ + Logout \ SlapLoginCurrentSoftwareInstance \ CheckComputerPartitionGetInstanceParameterDictResult \ SlapLogout \ diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionGetState.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionGetState.py index ed032c79675a6456ba069d2893f3748724e85fdb..019a68de275177cffa2415cb78fa8477b67de560 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionGetState.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionGetState.py @@ -32,7 +32,7 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): sequence_list = SequenceList() sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\ SlapLoginCurrentComputer \ - CheckStoppedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -54,7 +54,7 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckDestroyedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -71,7 +71,7 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): sequence_list = SequenceList() sequence_string = self.prepare_building_computer_partition_sequence_string + '\ SlapLoginCurrentComputer \ - CheckStoppedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -103,25 +103,18 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): delivered state with the setup resource """ sequence_list = SequenceList() + sequence_string = self.prepare_install_requested_computer_partition_sequence_string + '\ - LoginDefaultUser \ - StartSalePackingList \ - StopSalePackingList \ - \ - CallVifibUpdateDeliveryCausalityStateAlarm \ - CleanTic \ - \ - DeliverSalePackingList \ + LoginTestVifibCustomer \ + SetSequenceSoftwareInstanceStateStopped \ + PersonRequestSoftwareInstance \ Tic \ + Logout \ + LoginDefaultUser \ CheckComputerPartitionInstanceSetupSalePackingListDelivered \ - SelectCurrentlyUsedSalePackingListUid \ - CancelSalePackingList \ - Tic \ - CheckComputerPartitionInstanceHostingSalePackingListCancelled \ - CheckComputerPartitionInstanceCleanupSalePackingListDoesNotExists \ Logout \ SlapLoginCurrentComputer \ - CheckDestroyedComputerPartitionGetStateCall \ + CheckStoppedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -160,7 +153,7 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckStoppedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -423,7 +416,7 @@ class TestVifibSlapComputerPartitionGetState(TestVifibSlapWebServiceMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckStoppedComputerPartitionGetStateCall \ + CheckStartedComputerPartitionGetStateCall \ SlapLogout \ LoginDefaultUser \ SetHostingAfterSetupStartDate \ diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py index 6450e3e8f8dd50eab2d920f390f98fb51207316e..d3854962ecab9b90e706c6762b5c501a9933d23a 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionRequest.py @@ -216,7 +216,6 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): LoginDefaultUser \ CheckComputerPartitionInstanceCleanupSalePackingListDelivered \ CheckComputerPartitionIsFree \ - CheckOpenOrderLineRemoved \ Logout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -315,7 +314,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLogout \ \ LoginDefaultUser \ - CheckComputerPartitionInstanceHostingSalePackingListDelivered \ + CheckComputerPartitionInstanceHostingSalePackingListStopped \ Logout \ \ LoginERP5TypeTestCase \ @@ -358,6 +357,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLoginCurrentSoftwareInstance \ DirectRequestComputerPartitionHttpRequestTimeoutResponseWithoutState \ Tic \ + Tic \ SlapLogout \ \ LoginERP5TypeTestCase \ @@ -611,7 +611,6 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLoginCurrentSoftwareInstance RequestComputerPartition Tic - CheckRaisesNotFoundComputerPartitionParameterDict LoginDefaultUser CallConfirmOrderedSaleOrderAlarm Tic @@ -706,13 +705,6 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLoginCurrentSoftwareInstance RequestSlaveInstanceFromComputerPartition Tic - CheckRaisesNotFoundComputerPartitionParameterDict - LoginDefaultUser - CallConfirmOrderedSaleOrderAlarm - Tic - Logout - RequestSlaveInstanceFromComputerPartition - Tic SlapLogout LoginDefaultUser @@ -1060,7 +1052,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLogout \ \ LoginDefaultUser \ - CheckComputerPartitionInstanceHostingSalePackingListStarted \ + CheckComputerPartitionInstanceHostingSalePackingListConfirmed Logout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -1222,6 +1214,7 @@ class TestVifibSlapComputerPartitionRequest(TestVifibSlapWebServiceMixin): SlapLoginCurrentSoftwareInstance \ DirectRequestComputerPartitionHttpRequestTimeoutResponseWithoutStateAndSharedTrue \ Tic \ + Tic \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ diff --git a/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py b/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py index 6012518356f1afad91ce8bfa6f1cff18f0b7b133..e04d79a90d6bac91f203d634fa0fae2505922f81 100644 --- a/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py +++ b/master/product/Vifib/tests/testVifibSlapComputerPartitionUpdate.py @@ -1,8 +1,11 @@ from Products.ERP5Type.tests.Sequence import SequenceList import unittest from testVifibSlapWebService import TestVifibSlapWebServiceMixin -from Products.DCWorkflow.DCWorkflow import ValidationFailed from random import random +from Products.ERP5Type.tests.backportUnittest import skip +from Products.ERP5Type.Errors import UnsupportedWorkflowMethod +import transaction +from _mysql_exceptions import DataError class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): def stepRequestSoftwareInstanceUpdate(self, sequence, **kw): @@ -21,7 +24,8 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): } method_dict[instance.getSlapState()]( software_release=instance.getRootSoftwareReleaseUrl(), - instance_xml=instance.getTextContent(), + instance_xml='<?xml version="1.0" ' \ + 'encoding="utf-8"?><instance><parameter id="foo">bar</parameter></instance>', software_type=instance.getSourceReference(), sla_xml=instance.getSlaXml(), shared=shared, @@ -102,7 +106,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout SlapLoginCurrentComputer @@ -149,7 +153,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout SlapLoginCurrentComputer @@ -195,7 +199,8 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + SetDeliveryLineAmountEqualTwo + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout SlapLoginCurrentComputer @@ -212,7 +217,9 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered + SetDeliveryLineAmountEqualOne + CheckComputerPartitionInstanceHostingSalePackingListStopped + SetDeliveryLineAmountEqualTwo CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout @@ -255,7 +262,8 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + SetDeliveryLineAmountEqualTwo + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout SlapLoginCurrentComputer @@ -272,8 +280,10 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + SetDeliveryLineAmountEqualOne + CheckComputerPartitionInstanceHostingSalePackingListStopped + SetDeliveryLineAmountEqualTwo + CheckComputerPartitionInstanceUpdateSalePackingListDelivered CheckUpdateSalePackingListErrorText Logout @@ -295,7 +305,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -315,7 +325,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -325,78 +335,6 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def test_update_not_created_delivered_instance_setup(self): - sequence_list = SequenceList() - sequence_string = self.prepare_published_software_release + \ - self.prepare_formated_computer + """ - LoginTestVifibAdmin - RequestSoftwareInstallation - Tic - Logout - - SlapLoginCurrentComputer - ComputerSoftwareReleaseAvailable - Tic - SlapLogout - - LoginTestVifibCustomer - PersonRequestStoppedSoftwareInstance - Tic - Logout - - LoginDefaultUser - CallConfirmOrderedSaleOrderAlarm - Tic - SetSelectedComputerPartition - SelectCurrentlyUsedSalePackingListUid - Logout - LoginDefaultUser - CheckComputerPartitionInstanceSetupSalePackingListDelivered - Logout - - SlapLoginCurrentComputer - SoftwareInstanceBuilding - Tic - SlapLogout - LoginDefaultUser - CheckComputerPartitionInstanceSetupSalePackingListDelivered - Logout - - SlapLoginCurrentComputer - SoftwareInstanceAvailable - Tic - SlapLogout - LoginDefaultUser - SetSelectedComputerPartition - CheckComputerPartitionInstanceSetupSalePackingListDelivered - CheckComputerPartitionNoInstanceHostingSalePackingList - Logout - - - LoginDefaultUser - DeliverSalePackingList - Tic - CheckComputerPartitionInstanceSetupSalePackingListDelivered - Logout - - # prepared delivered instance setup delivery - - LoginTestVifibCustomer - RequestSoftwareInstanceUpdateRaisesValidationFailed - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - def test_update_not_created_confirmed_instance_hosting(self): sequence_list = SequenceList() sequence_string = \ @@ -407,7 +345,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -427,7 +365,8 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList + SetDeliveryLineAmountEqualTwo + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -437,6 +376,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) + @skip('Update is forbidden on destroyed instance') def test_update_not_created_confirmed_instance_cleanup(self): sequence_list = SequenceList() sequence_string = \ @@ -457,6 +397,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) + @skip('Update is forbidden on destroyed instance') def test_update_not_created_started_instance_cleanup(self): sequence_list = SequenceList() sequence_string = \ @@ -492,7 +433,8 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): 'stop_requested': instance.requestStop, 'destroy_requested': instance.requestDestroy, } - self.assertRaises(ValidationFailed, method_dict[instance.getSlapState()], + self.assertRaises(UnsupportedWorkflowMethod, + method_dict[instance.getSlapState()], software_release=instance.getRootSoftwareReleaseUrl(), instance_xml=instance.getTextContent(), software_type=instance.getSourceReference(), @@ -510,7 +452,7 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): Logout LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout LoginERP5TypeTestCase @@ -520,111 +462,6 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - # low level activity locks - def stepCheckActivityStartInProgress(self, sequence, **kw): - self.assertNotEqual(0, self.portal.portal_activities. - countMessageWithTag('%s_startInProgress' % sequence[ - 'software_instance_uid'])) - - def test_update_not_created_start_in_progress(self): - sequence_list = SequenceList() - sequence_string = \ - self.prepare_stopped_computer_partition_sequence_string + """ - LoginTestVifibCustomer - RequestSoftwareInstanceStart - Logout - - LoginDefaultUser - CheckActivityStartInProgress - Logout - - LoginTestVifibCustomer - RequestSoftwareInstanceUpdate - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - - def stepCheckActivityDestroyInProgress(self, sequence, **kw): - self.assertNotEqual(0, self.portal.portal_activities. - countMessageWithTag('%s_destroyInProgress' % sequence[ - 'software_instance_uid'])) - - def test_update_not_created_destruction_in_progress(self): - sequence_list = SequenceList() - sequence_string = self\ - .prepare_installed_computer_partition_sequence_string + """ - LoginTestVifibCustomer - RequestSoftwareInstanceDestroy - Logout - - LoginDefaultUser - CheckActivityDestroyInProgress - Logout - - LoginTestVifibCustomer - RequestSoftwareInstanceUpdate - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - - def stepCheckActivityRequestInProgress(self, sequence, **kw): - hosting_subscription_uid = sequence['hosting_subscription_uid'] - requested_partition_reference = sequence.get('software_type', 'requested_reference') - tag = "%s_%s_inProgress" % (hosting_subscription_uid, - requested_partition_reference) - - self.assertNotEqual(0, self.portal.portal_activities. - countMessageWithTag(tag)) - - def test_update_not_created_request_in_progress(self): - self.computer_partition_amount = 2 - sequence_list = SequenceList() - sequence_string = self\ - .prepare_install_requested_computer_partition_sequence_string + """ - SlapLoginCurrentSoftwareInstance - RequestComputerPartitionNoTic - SlapLogout - - LoginDefaultUser - CheckActivityRequestInProgress - Logout - - LoginTestVifibCustomer - RequestSoftwareInstanceUpdate - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - def stepCheckActivityPersonRequestInProgress(self, sequence, **kw): person_uid = self.portal.ERP5Site_getAuthenticatedMemberPersonValue( 'test_vifib_customer').getUid() @@ -639,18 +476,33 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() software_release = self.portal.portal_catalog.getResultValue( uid=sequence['software_release_uid']) - software_title = self.id() + str(random()) person.requestSoftwareInstance( software_release=software_release.getUrlString(), - software_title=software_title, + software_title=self.root_software_instance_title, software_type="RootSoftwareInstance", instance_xml=self.minimal_correct_xml, sla_xml="", shared=False, state="started") - sequence.edit(root_software_instance_title=software_title) + sequence.edit(root_software_instance_title=self.root_software_instance_title) + + def stepPersonRequestSoftwareInstanceNoTicRaisesDataError(self, sequence, **kw): + person = self.portal.ERP5Site_getAuthenticatedMemberPersonValue() + software_release = self.portal.portal_catalog.getResultValue( + uid=sequence['software_release_uid']) + person.requestSoftwareInstance( + software_release=software_release.getUrlString(), + software_title=self.root_software_instance_title, + software_type="RootSoftwareInstance", + instance_xml=self.minimal_correct_xml, + sla_xml="", + shared=False, + state="started") + self.assertRaises(DataError, self.commit) + transaction.abort() def test_update_not_created_person_request_in_progress(self): + self.root_software_instance_title = self.id() + str(random()) sequence_list = SequenceList() sequence_string = self.prepare_published_software_release + \ self.prepare_formated_computer + """ @@ -684,157 +536,37 @@ class TestVifibSlapComputerPartitionUpdate(TestVifibSlapWebServiceMixin): sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - # update triggers - def stepSoftwareInstanceEditTitle(self, sequence, - **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - instance.edit( - title = instance.getTitle() + 'edited' - ) - - def stepSoftwareInstanceEditSourceReference(self, sequence, - **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - instance.edit( - source_reference = instance.getSourceReference() + 'edited' - ) - - def stepSoftwareInstanceEditTextContent(self, sequence, - **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - text_content = instance.getTextContent() - modified_xml = """<?xml version="1.0" encoding="utf-8"?> - <instance><parameter id="ignore">value</parameter></instance>""" - self.assertNotEqual(modified_xml, text_content) - instance.edit( - text_content = modified_xml - ) - - def stepSoftwareInstanceEditConnectionXml(self, sequence, - **kw): - instance = self.portal.portal_catalog.getResultValue( - uid=sequence['software_instance_uid']) - connection_xml = instance.getConnectionXml() - self.assertNotEqual(connection_xml, self.minimal_correct_xml) - instance.edit( - connection_xml = self.minimal_correct_xml - ) - - def test_update_on_title_change(self): - sequence_list = SequenceList() - sequence_string = \ - self.prepare_started_computer_partition_sequence_string + """ - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - LoginTestVifibCustomer - SoftwareInstanceEditTitle - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed - Logout - - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - - def test_update_on_source_reference_change(self): + def test_update_not_created_person_request_in_progress_long_title(self): + self.root_software_instance_title = 'a' * 256 # longer then SQL column size sequence_list = SequenceList() - sequence_string = \ - self.prepare_started_computer_partition_sequence_string + """ - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - LoginTestVifibCustomer - SoftwareInstanceEditSourceReference - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed - Logout - - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) - - def test_update_on_text_content_change(self): - sequence_list = SequenceList() - sequence_string = \ - self.prepare_started_computer_partition_sequence_string + """ - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout + sequence_string = self.prepare_published_software_release + \ + self.prepare_formated_computer + """ + LoginTestVifibAdmin + RequestSoftwareInstallation + Tic + Logout - LoginTestVifibCustomer - SoftwareInstanceEditTextContent - Tic - Logout + SlapLoginCurrentComputer + ComputerSoftwareReleaseAvailable + Tic + SlapLogout - LoginDefaultUser - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed - Logout + LoginTestVifibCustomer + PersonRequestSoftwareInstanceNoTicRaisesDataError + Logout - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout + # and this that test finishes + # it is proven that person data are begin in progress + # but there is no way to request software instance update as... + # ...it does not exists yet - LoginERP5TypeTestCase - CheckSiteConsistency - Logout + LoginERP5TypeTestCase + CheckSiteConsistency + Logout """ sequence_list.addSequenceString(sequence_string) sequence_list.play(self) - def test_no_update_on_connection_xml_change(self): - sequence_list = SequenceList() - sequence_string = \ - self.prepare_started_computer_partition_sequence_string + """ - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - LoginTestVifibCustomer - SoftwareInstanceEditConnectionXml - Tic - Logout - - LoginDefaultUser - CheckComputerPartitionNoInstanceUpdateSalePackingList - Logout - - SlapLoginCurrentComputer - CheckSuccessComputerGetComputerPartitionCall - SlapLogout - - LoginERP5TypeTestCase - CheckSiteConsistency - Logout - """ - sequence_list.addSequenceString(sequence_string) - sequence_list.play(self) def test_suite(): suite = unittest.TestSuite() diff --git a/master/product/Vifib/tests/testVifibSlapRegisterComputer.py b/master/product/Vifib/tests/testVifibSlapRegisterComputer.py index 192ba84503e25d89aa014e81c5453ded16eb3637..b06b5dbb63b5370a6658de469983cdca58b32f30 100644 --- a/master/product/Vifib/tests/testVifibSlapRegisterComputer.py +++ b/master/product/Vifib/tests/testVifibSlapRegisterComputer.py @@ -14,7 +14,7 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): does not fail """ sequence_list = SequenceList() - sequence_string = '\ + sequence_string = self.stabilise_accounting + '\ SetRandomComputerReference \ LoginDefaultUser \ CheckSuccessSlapRegisterComputerCall \ @@ -37,7 +37,7 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): """ sequence_list = SequenceList() # Note: ERP5TypeTestCase is used as login to being able to test it - sequence_string = '\ + sequence_string = self.stabilise_accounting + '\ LoginTestVifibAdmin \ CreateDraftComputer \ Tic \ @@ -59,7 +59,7 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): a validated computer exists. """ sequence_list = SequenceList() - sequence_string = '\ + sequence_string = self.stabilise_accounting + '\ LoginTestVifibAdmin \ CustomerRegisterNewComputer \ Tic \ @@ -83,7 +83,7 @@ class TestVifibSlapRegisterComputer(TestVifibSlapWebServiceMixin): Check the slap.registerComputer works in case of more then one computer available """ sequence_list = SequenceList() - sequence_string = '\ + sequence_string = self.stabilise_accounting + '\ LoginTestVifibAdmin \ CustomerRegisterNewComputer \ Tic \ diff --git a/master/product/Vifib/tests/testVifibSlapWebService.py b/master/product/Vifib/tests/testVifibSlapWebService.py index 0796c90d5b69a1409b66ed2a9b6f7ef61db02b40..713345315ebc7dd5b399a898500b3237d5cb86ef 100644 --- a/master/product/Vifib/tests/testVifibSlapWebService.py +++ b/master/product/Vifib/tests/testVifibSlapWebService.py @@ -55,7 +55,8 @@ DEFAULT_INSTANCE_DICT_PARAMETER_LIST = [ 'slap_partition_reference', 'slap_software_release_url', 'slap_software_type', - "slave_instance_list" + "slave_instance_list", + 'timestamp', ] @@ -596,8 +597,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): shared=kw.get('shared', False), state=kw['state']) - software_instance_portal_type = kw.get("instance_portal_type", - self.software_instance_portal_type) software_instance = self.portal.REQUEST.get('request_instance') hosting_subscription = self.portal.REQUEST.get('request_hosting_subscription') if (software_instance is not None): @@ -739,6 +738,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): reference=computer_reference, destination_reference=computer_reference, ) + self.markManualCreation(computer) return computer, computer_reference def stepCreateDraftComputer(self, sequence, **kw): @@ -1043,6 +1043,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetPurchasePackingListLineSetupResource SetPurchasePackingListLineAggregate ConfirmPurchasePackingList + StartBuildingPurchasePackingList Tic CheckConfirmedPurchasePackingList Logout @@ -1057,6 +1058,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetPurchasePackingListLineCleanupResource SetPurchasePackingListLineAggregate ConfirmPurchasePackingList + StartBuildingPurchasePackingList Tic CheckConfirmedPurchasePackingList Logout @@ -1087,6 +1089,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetPurchasePackingListLineAccountingResource SetPurchasePackingListLineAggregate ConfirmPurchasePackingList + StartBuildingPurchasePackingList Tic Logout LoginDefaultUser @@ -1132,6 +1135,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): LoginDefaultUser CallConfirmOrderedSaleOrderAlarm Tic + CallVifibTriggerBuildAlarm + CleanTic SetSelectedComputerPartition SelectCurrentlyUsedSalePackingListUid Logout @@ -1173,6 +1178,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): Tic SetSalePackingListLineCleanupResource SetSalePackingListLineAggregate + StartBuildingSalePackingList ConfirmSalePackingList Tic """ @@ -1229,16 +1235,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): Logout \ ' prepare_stop_requested_computer_partition_sequence_string = \ - prepare_started_computer_partition_sequence_string + '\ + prepare_installed_computer_partition_sequence_string + '\ LoginTestVifibCustomer \ SetSequenceSoftwareInstanceStateStopped \ PersonRequestSoftwareInstance \ Tic \ Logout \ - \ - LoginDefaultUser \ - CheckComputerPartitionInstanceHostingSalePackingListStopped \ - Logout \ ' prepare_stopped_computer_partition_sequence_string = \ prepare_stop_requested_computer_partition_sequence_string + '\ @@ -1248,7 +1250,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SlapLogout \ \ LoginDefaultUser \ - CheckComputerPartitionInstanceHostingSalePackingListDelivered \ + CheckComputerPartitionInstanceHostingSalePackingListStopped \ Logout \ ' @@ -1263,6 +1265,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetSalePackingListLineAccountingResource \ SetSalePackingListLineAggregate \ Tic \ + StartBuildingSalePackingList \ ConfirmSalePackingList \ Tic \ CheckComputerPartitionAccoutingResourceSalePackingListConfirmed \ @@ -1366,6 +1369,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetPurchasePackingListLineAggregate ConfirmPurchasePackingList StopPurchasePackingList + StartBuildingPurchasePackingList Tic """ @@ -1379,6 +1383,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetSalePackingListLineSetupResource SetSalePackingListLineAggregate ConfirmSalePackingList + StartBuildingSalePackingList Tic """ @@ -1393,6 +1398,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): SetSalePackingListLineSetupResource SetSalePackingListLineAggregate ConfirmSalePackingList + StartBuildingSalePackingList Tic SetComputerPartitionQuantity Tic @@ -1408,7 +1414,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): Tic \ Logout \ SlapLoginCurrentComputer \ - CheckEmptyComputerGetSoftwareReleaseListCall \ + CheckSuccessComputerGetSoftwareReleaseListCall \ SlapLogout ' + \ prepare_software_release_confirmed_packing_list + '\ LoginDefaultUser \ @@ -1570,6 +1576,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): service = module.newContent( portal_type=self.service_portal_type, title="A custom accounting service") + self.markManualCreation(service) service.validate() sequence.edit(service_uid=service.getUid()) @@ -1657,6 +1664,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): computer_partition = computer.newContent( portal_type=self.computer_partition_portal_type, reference=partition_reference) + self.markManualCreation(computer_partition) # Mark newly created computer partition as free by default computer_partition.markFree() sequence.edit(computer_partition_uid=computer_partition.getUid()) @@ -1741,6 +1749,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): portal_type=self.software_product_portal_type, title=title, ) + self.markManualCreation(software_product) sequence.edit(software_product_uid=software_product.getUid()) def stepValidateSoftwareProduct(self, sequence, **kw): @@ -1767,6 +1776,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): reference=url, contributor_value=self.portal.person_module.test_vifib_user_developer, url_string=url) + self.markManualCreation(software_release) sequence.edit(software_release_uid=software_release.getUid()) def stepCheckUnexistingSoftwareRelease(self, sequence, **kw): @@ -1940,6 +1950,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): self.assertTrue('value' in server_xml) # check that returned dict has no change REMOTE_USER = software_instance.getReference() + # re-register the partition, in order to re-read data from server + # as registerComputerPartition sends immediately synchronised computer + # partition, it is required to re-fetch it + slap_computer_partition = self.slap.registerComputerPartition( + computer.getReference(), computer_partition.getReference()) self.assertEqual('value', slap_computer_partition.getConnectionParameter('parameter')) @@ -2397,11 +2412,18 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): Check that Computer.getComputerPartitionList is successfully called. """ computer_guid = sequence["computer_reference"] + computer_uid = sequence["computer_uid"] + erp5_computer = self.portal.portal_catalog.unrestrictedSearchResults( + uid=computer_uid)[0].getObject() + computer_partition_amount = len([x for x in \ + erp5_computer.contentValues(portal_type="Computer Partition") \ + if x.getSlapState() == "busy"]) + self.slap = slap.slap() self.slap.initializeConnection(self.server_url, timeout=None) computer = self.slap.registerComputer(computer_guid) computer_partition_list = computer.getComputerPartitionList() - self.assertEquals(self.computer_partition_amount, + self.assertEquals(computer_partition_amount, len(computer_partition_list)) def stepCheckSuccessComputerPartitionGetIdCall(self, sequence, **kw): @@ -2457,7 +2479,8 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): self.slap = slap.slap() self.slap.initializeConnection(self.server_url, timeout=None) computer = self.slap.registerComputer(computer_guid) - self.assertEquals([], computer.getSoftwareReleaseList()) + self.assertEquals([], [q for q in computer.getSoftwareReleaseList() \ + if q.getState() != 'destroyed']) def stepCheckDestroyedStateGetSoftwareReleaseListCall(self, sequence, **kw): """ @@ -2485,6 +2508,11 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): self.assertTrue(isinstance(computer.getSoftwareReleaseList()[0], slap.SoftwareRelease)) + def stepStartBuildingPurchasePackingList(self, sequence, **kw): + delivery = self.portal.portal_catalog.getResultValue( + uid=sequence['purchase_packing_list_uid']) + delivery.startBuilding() + def stepCreatePurchasePackingList(self, sequence, **kw): """ Create an purchase packing list document. @@ -2504,6 +2532,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): destination_decision='person_module/test_vifib_customer', price_currency='currency_module/EUR', ) + self.markManualCreation(order) sequence.edit(purchase_packing_list_uid=order.getUid()) def stepCreatePurchasePackingListLine(self, sequence, **kw): @@ -2515,6 +2544,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): line = order.newContent( portal_type=self.purchase_packing_list_line_portal_type, quantity=1) + self.markManualCreation(line) sequence.edit(purchase_packing_list_line_uid=line.getUid()) def stepSetPurchasePackingListLineAggregate(self, sequence, **kw): @@ -2917,7 +2947,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): specialise='sale_trade_condition_module/vifib_trade_condition', source='organisation_module/vifib_internet', source_section='organisation_module/vifib_internet', - source_decision='organisation_module/vifib_internet', # XXX Hardcoded values destination='person_module/test_vifib_customer', destination_section='person_module/test_vifib_customer', @@ -2925,8 +2954,14 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): price_currency='currency_module/EUR', start_date=DateTime(), ) + self.markManualCreation(order) sequence.edit(sale_packing_list_uid=order.getUid()) + def stepStartBuildingSalePackingList(self, sequence, **kw): + delivery = self.portal.portal_catalog.getResultValue( + uid=sequence['sale_packing_list_uid']) + delivery.startBuilding() + def stepCreateSalePackingListLine(self, sequence, **kw): """ Create an sale packing list line document. @@ -2938,6 +2973,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): quantity=1, price=1 ) + self.markManualCreation(line) sequence.edit(sale_packing_list_line_uid=line.getUid()) def stepSetSalePackingListLineSetupResource(self, sequence, **kw): @@ -3237,8 +3273,6 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): def stepSelectCurrentlyUsedSalePackingListUid(self, sequence, **kw): """Sets sale_packing_list_uid to currently used to mach Computer Partition and Software Instance""" - computer_partition = self.portal.portal_catalog.getResultValue( - uid=sequence['computer_partition_uid']) software_instance = self.portal.portal_catalog.getResultValue( portal_type="Software Instance", default_aggregate_uid=sequence['computer_partition_uid']) @@ -3401,6 +3435,17 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): computer_partition.getInstanceParameterDict() + def stepFillTimestamp(self, sequence, **kw): + get = self.portal.portal_catalog.getResultValue + timestamp = int(get(uid=sequence['computer_partition_uid']\ + ).getModificationDate()) + instance = get(uid=sequence['software_instance_uid']) + newtimestamp = int(instance.getBangTimestamp(int( + instance.getModificationDate()))) + if (newtimestamp > timestamp): + timestamp = newtimestamp + sequence['partition_timestamp'] = str(timestamp) + def stepCheckMinimalParametersTransmitted(self, sequence, **kw): """ Check that slap.registerComputerPartition raises a NotFound error @@ -3424,6 +3469,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): 'requested_software_type'), 'slave_instance_list': [], 'ip_list': [], + 'timestamp': sequence['partition_timestamp'] } self.assertSameDict(expected, result) @@ -3525,6 +3571,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): 'test_parameter': 'lala', 'slave_instance_list': [], 'ip_list': [], + 'timestamp': sequence['partition_timestamp'] } self.assertSameDict(expected, result) @@ -3696,7 +3743,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): sale_packing_list_line_list = computer_partition\ .getAggregateRelatedValueList( portal_type=self.sale_packing_list_line_portal_type) - self.assertEqual(1, len(sale_packing_list_line_list)) + self.assertEqual(2, len(sale_packing_list_line_list)) sale_packing_list_line = sale_packing_list_line_list[0] software_instance = sale_packing_list_line.getAggregateValue( portal_type=self.software_instance_portal_type) @@ -3704,7 +3751,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): software_instance_sale_packing_list_line_list = software_instance\ .getAggregateRelatedList( portal_type=self.sale_packing_list_line_portal_type) - self.assertEqual(1, len(software_instance_sale_packing_list_line_list)) + self.assertEqual(2, len(software_instance_sale_packing_list_line_list)) def _checkSoftwareInstanceAndRelatedPartition(self, software_instance, partition_portal_type=computer_partition_portal_type): @@ -3712,7 +3759,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): sale_packing_list_line_list = software_instance\ .getAggregateRelatedValueList( portal_type=self.sale_packing_list_line_portal_type) - self.assertEqual(2, len(sale_packing_list_line_list)) + if (software_instance.getSlapState() == "start_requested"): + expected_count = 2 + else: + expected_count = 1 + + self.assertEqual(expected_count, len(sale_packing_list_line_list)) sale_packing_list_line = sale_packing_list_line_list[0] # This Sale Packing List Line shall have only one Computer Partition @@ -3726,7 +3778,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): computer_partition_sale_packing_list_line_list = computer_partition\ .getAggregateRelatedValueList( portal_type=self.sale_packing_list_line_portal_type) - self.assertEqual(2, len(computer_partition_sale_packing_list_line_list)) + self.assertEqual(expected_count, len(computer_partition_sale_packing_list_line_list)) def stepCheckPersonRequestedSoftwareInstanceAndRelatedComputerPartition(self, sequence, **kw): @@ -3736,9 +3788,12 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): computer_partition = self._softwareInstance_getComputerPartition( software_instance) # There should be only one Sale Packing List Line - sale_packing_list_line_list = software_instance\ - .getAggregateRelatedValueList( - portal_type=self.sale_packing_list_line_portal_type) + sale_packing_list_line_list = self.portal.portal_catalog( + portal_type=self.sale_packing_list_line_portal_type, + default_aggregate_uid=software_instance.getUid(), + default_resource_uid=self.portal.restrictedTraverse(self.portal\ + .portal_preferences.getPreferredInstanceSetupResource()).getUid() + ) self.assertEqual(1, len(sale_packing_list_line_list)) sale_packing_list_line = sale_packing_list_line_list[0] # This Sale Packing List Line shall have only one Computer Partition @@ -3754,7 +3809,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): .getAggregateRelatedValueList( portal_type=self.sale_packing_list_line_portal_type): if sequence['software_instance_uid'] in delivery_line\ - .getAggregateUidList(): + .getAggregateUidList() and delivery_line\ + .getResource() == self.portal.portal_preferences\ + .getPreferredInstanceSetupResource(): computer_partition_sale_packing_list_line_list.append(delivery_line) self.assertEqual(1, len(computer_partition_sale_packing_list_line_list)) @@ -3928,6 +3985,9 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): portal_type_list = [instance.getPortalType() for instance in instance_list] expected_portal_type_list = [self.slave_instance_portal_type, self.slave_instance_portal_type, + self.slave_instance_portal_type, + self.slave_instance_portal_type, + self.software_instance_portal_type, self.software_instance_portal_type] self.assertEquals(expected_portal_type_list, sorted(portal_type_list)) computer_partition_list = [obj.getAggregateValue( @@ -3983,7 +4043,7 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): for obj in sale_packing_list_line_list] self.assertEquals(computer_partition_list[0], computer_partition_list[1]) - self.assertEquals(2, len(computer_partition_list)) + self.assertEquals(4, len(computer_partition_list)) def stepCheckSlaveInstanceNotReady(self, sequence): slave_instance = self.portal.portal_catalog.getResultValue( @@ -4208,19 +4268,38 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): software_instance.getConnectionXml()) def stepSlaveInstanceStarted(self, sequence): - slave_instance = self.portal.portal_catalog.getResultValue( + instance = self.portal.portal_catalog.getResultValue( uid=sequence["software_instance_uid"]) - slave_instance.startComputerPartition() + if instance.getPortalType() == "Software Instance": + shared = False + elif instance.getPortalType() == "Slave Instance": + shared = True + else: + raise NotImplementedError + instance.requestStart( + software_release=instance.getRootSoftwareReleaseUrl(), + instance_xml=instance.getTextContent(), + software_type=instance.getSourceReference(), + sla_xml=instance.getSlaXml(), + shared=shared, + ) def stepSlaveInstanceStopped(self, sequence): - slave_instance = self.portal.portal_catalog.getResultValue( - uid=sequence["software_instance_uid"]) - slave_instance.stopComputerPartition() - - def stepSlaveInstanceStopComputerPartitionInstallation(self, sequence): - slave_instance = self.portal.portal_catalog.getResultValue( + instance = self.portal.portal_catalog.getResultValue( uid=sequence["software_instance_uid"]) - slave_instance.stopComputerPartitionInstallation() + if instance.getPortalType() == "Software Instance": + shared = False + elif instance.getPortalType() == "Slave Instance": + shared = True + else: + raise NotImplementedError + instance.requestStop( + software_release=instance.getRootSoftwareReleaseUrl(), + instance_xml=instance.getTextContent(), + software_type=instance.getSourceReference(), + sla_xml=instance.getSlaXml(), + shared=shared, + ) def stepSetDeliveryLineAmountEqualZero(self, sequence): sequence.edit(delivery_line_amount=0) @@ -4237,6 +4316,10 @@ class TestVifibSlapWebServiceMixin(testVifibMixin): def stepSetRandomRequestedReference(self, sequence, **kw): sequence['requested_reference'] = self.id() + str(random()) + def stepSetRandomRequestedReferenceAndTitle(self, sequence, **kw): + sequence['requested_reference'] = self.id() + str(random()) + sequence['software_title'] = sequence['requested_reference'] + def stepRenameCurrentSoftwareInstanceDead(self, sequence, **kw): software_instance = self.portal.portal_catalog.getResultValue( uid=sequence['software_instance_uid'] @@ -4384,7 +4467,7 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin): sequence_string = self\ .prepare_installed_computer_partition_sequence_string + '\ SlapLoginCurrentComputer \ - CheckRaisesNotFoundComputerPartitionDestroyedCall \ + CheckSuccessComputerPartitionDestroyedCall \ SlapLogout \ LoginERP5TypeTestCase \ CheckSiteConsistency \ @@ -4523,7 +4606,8 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin): def test_person_from_credential_request_software_instance(self): """Checks that person created from web can use the system""" sequence_list = SequenceList() - sequence_string = self.prepare_published_software_release + \ + sequence_string = self.stabilise_accounting + \ + self.prepare_published_software_release + \ self.prepare_formated_computer + """ LoginTestVifibAdmin RequestSoftwareInstallation @@ -4548,6 +4632,8 @@ class TestVifibSlapWebService(TestVifibSlapWebServiceMixin): Tic Logout + """ + self.stabilise_accounting + """ + LoginWebUser PersonRequestSoftwareInstance Tic diff --git a/master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py b/master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py index a8b8d7a19f79d7c63f4d0ffb9cec83aba606367f..3c3bf286a34d341d9255fecc521ab4b415e0e477 100644 --- a/master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py +++ b/master/product/Vifib/tests/testVifibSlapWebServiceSlaveInstance.py @@ -153,15 +153,13 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): Tic SlapLogout LoginTestVifibCustomer - SlaveInstanceStopComputerPartitionInstallation - Tic SlaveInstanceStarted Tic SlaveInstanceStopped Tic Logout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered + CheckComputerPartitionInstanceHostingSalePackingListStopped SlapLoginCurrentComputer CheckEmptySlaveInstanceListFromOneComputerPartition Logout @@ -215,7 +213,9 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): SlapLogout Tic LoginTestVifibCustomer + SetSoftwareTitleRandom PersonRequestSoftwareInstance + CleanTic CallConfirmOrderedSaleOrderAlarm Tic LoginTestVifibCustomer @@ -320,7 +320,9 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): Tic SlapLogout LoginTestVifibCustomer + SetSoftwareTitleRandom PersonRequestSoftwareInstance + CleanTic CallConfirmOrderedSaleOrderAlarm Tic SelectDifferentSoftwareReleaseUri @@ -349,6 +351,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): sequence_string = self.prepare_install_requested_computer_partition_sequence_string + """ Tic LoginAsCustomerA + SetSoftwareTitleRandom PersonRequestSlaveInstance Tic SlapLogout @@ -408,7 +411,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser SetDeliveryLineAmountEqualOne - CheckComputerPartitionInstanceHostingSalePackingListStarted + CheckComputerPartitionInstanceHostingSalePackingListConfirmed CheckComputerPartitionInstanceSetupSalePackingListDelivered LoginTestVifibCustomer RequestStopSoftwareInstanceFromCurrentComputerPartition @@ -416,7 +419,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): SlapLoginCurrentComputer SoftwareInstanceStopped Tic - CheckComputerPartitionInstanceHostingSalePackingListDelivered + CheckComputerPartitionInstanceHostingSalePackingListConfirmed StartSoftwareInstanceFromCurrentComputerPartition Tic SoftwareInstanceStarted @@ -430,8 +433,6 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): Tic SoftwareInstanceStarted Tic - CheckComputerPartitionInstanceHostingSalePackingListStarted - SetDeliveryLineAmountEqualZero CheckComputerPartitionInstanceHostingSalePackingListConfirmed Logout LoginTestVifibCustomer @@ -455,7 +456,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): Tic SetDeliveryLineAmountEqualOne LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListStarted + CheckComputerPartitionInstanceHostingSalePackingListConfirmed RequestStopSoftwareInstanceFromCurrentComputerPartition Tic SlapLoginCurrentComputer @@ -467,7 +468,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): SlapLoginCurrentComputer SoftwareInstanceStarted Tic - CheckComputerPartitionInstanceHostingSalePackingListStarted + CheckComputerPartitionInstanceHostingSalePackingListConfirmed Logout LoginERP5TypeTestCase @@ -540,7 +541,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): Tic SlapLogout LoginDefaultUser - CheckComputerPartitionInstanceHostingSalePackingListDelivered + CheckComputerPartitionInstanceHostingSalePackingListStopped Logout LoginERP5TypeTestCase @@ -608,9 +609,11 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): SlapLogout LoginDefaultUser CallConfirmOrderedSaleOrderAlarm + Tic SlapLogout LoginTestVifibCustomer CheckSlaveInstanceSecurityWithDifferentCustomer + Tic SlapLogout LoginERP5TypeTestCase @@ -719,6 +722,12 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): portal_type='Slave Instance') sequence['software_instance_uid'] = slave_instance.getUid() + def stepCheckComputerPartitionInstanceUpdateSalePackingListDelivered(self, + sequence, **kw): + self._checkComputerPartitionSalePackingListState('delivered', + self.portal.portal_preferences.getPreferredInstanceUpdateResource(), + sequence) + def test_SlaveInstance_change_parameter_dict_after_request(self): """ Check that request to change the parameter dict from a Slave Instance @@ -766,7 +775,7 @@ class TestVifibSlapWebServiceSlaveInstance(TestVifibSlapWebServiceMixin): LoginDefaultUser SetSoftwareInstanceAsCurrentRequestedSlave - CheckComputerPartitionInstanceUpdateSalePackingListConfirmed + CheckComputerPartitionInstanceUpdateSalePackingListDelivered Logout SlapLoginCurrentComputer CheckSuccessComputerGetComputerPartitionCall diff --git a/master/product/Vifib/tests/testVifibSoftwareInstance.py b/master/product/Vifib/tests/testVifibSoftwareInstance.py index 00490af4f6dea1d1be10ec26324618004ad71a15..029cf1bac8632a62e669c1685e4f4e6b25543390 100644 --- a/master/product/Vifib/tests/testVifibSoftwareInstance.py +++ b/master/product/Vifib/tests/testVifibSoftwareInstance.py @@ -10,6 +10,7 @@ class TestVifibSoftwareInstance(testVifibMixin): def _test_si_tree(self): software_instance = self.portal.software_instance_module.newContent( portal_type='Software Instance') + self.markManualCreation(software_instance) self.checkConnected = software_instance.checkConnected self.checkNotCyclic = software_instance.checkNotCyclic diff --git a/master/product/Vifib/tests/testVifibUsageReport.py b/master/product/Vifib/tests/testVifibUsageReport.py index ede71dbf0f87a0cf8e3f16cb00b81cb373af9969..6d8867ad9680c36827105a173f27603fe03f4995 100644 --- a/master/product/Vifib/tests/testVifibUsageReport.py +++ b/master/product/Vifib/tests/testVifibUsageReport.py @@ -96,6 +96,7 @@ class TestVifibUsageReportMixin(TestVifibSlapWebServiceMixin): SetSalePackingListLineCleanupResource \ SetSalePackingListLineAggregate \ ConfirmSalePackingList \ + StartBuildingSalePackingList \ Tic \ Logout \ """ diff --git a/master/product/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt b/master/product/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt new file mode 100644 index 0000000000000000000000000000000000000000..e295196daeca0c9e00809976e13612998eb8eeef --- /dev/null +++ b/master/product/Vifib/www/Vifib_addVifibBrowserIDExtractionPlugin.zpt @@ -0,0 +1,36 @@ +<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1> +<h2 tal:define="form_title string:Add Vifib Browser ID Extraction Plugin" + tal:replace="structure context/manage_form_title">FORM TITLE</h2> + +<p class="form-help">Please input the configuration</p> + +<form action="addVifibBrowserIDExtractionPlugin" method="POST"> +<table cellspacing="0" cellpadding="2" border="0"> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Id + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="id" size="40" /> + </td> + </tr> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Title + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="title" size="40" /> + </td> + </tr> + <tr> + <td colspan="2"> <input type="submit" value="add plugin"/> + </td> + </tr> +</table> +</form> + +<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1> diff --git a/master/product/Vifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt b/master/product/Vifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt new file mode 100644 index 0000000000000000000000000000000000000000..cb5403ea0ecc99ff5a8702ebb82781a0bdd9f1da --- /dev/null +++ b/master/product/Vifib/www/Vifib_addVifibFacebookServerExtractionPlugin.zpt @@ -0,0 +1,36 @@ +<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1> +<h2 tal:define="form_title string:Add ERP5 Facebook Server Extraction Plugin" + tal:replace="structure context/manage_form_title">FORM TITLE</h2> + +<p class="form-help">Please input the configuration</p> + +<form action="addVifibFacebookServerExtractionPlugin" method="POST"> +<table cellspacing="0" cellpadding="2" border="0"> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Id + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="id" size="40" /> + </td> + </tr> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Title + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="title" size="40" /> + </td> + </tr> + <tr> + <td colspan="2"> <input type="submit" value="add plugin"/> + </td> + </tr> +</table> +</form> + +<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1> diff --git a/master/product/Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt b/master/product/Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt new file mode 100644 index 0000000000000000000000000000000000000000..7b1e04e9355fc614326e960578f37226963f524c --- /dev/null +++ b/master/product/Vifib/www/Vifib_addVifibGoogleServerExtractionPlugin.zpt @@ -0,0 +1,36 @@ +<h1 tal:replace="structure context/manage_page_header">PAGE HEADER</h1> +<h2 tal:define="form_title string:Add ERP5 Google Server Extraction Plugin" + tal:replace="structure context/manage_form_title">FORM TITLE</h2> + +<p class="form-help">Please input the configuration</p> + +<form action="addVifibGoogleServerExtractionPlugin" method="POST"> +<table cellspacing="0" cellpadding="2" border="0"> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Id + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="id" size="40" /> + </td> + </tr> + <tr> + <td align="left" valign="top"> + <div class="form-label"> + Title + </div> + </td> + <td align="left" valign="top"> + <input type="text" name="title" size="40" /> + </td> + </tr> + <tr> + <td colspan="2"> <input type="submit" value="add plugin"/> + </td> + </tr> +</table> +</form> + +<h1 tal:replace="structure context/manage_page_footer">PAGE FOOTER</h1> diff --git a/master/tests/__init__.py b/master/tests/__init__.py index 713216ca296fb56ce3bcdd77ca82589b561300de..f9bf8980261eee880fbff4b4fa7fab82072083c6 100644 --- a/master/tests/__init__.py +++ b/master/tests/__init__.py @@ -6,8 +6,9 @@ class VIFIB(SavedTestSuite, ProjectTestSuite): _bt_list = [ 'vifib_slapos_core', 'vifib_slapos_core_test', + 'vifib_slapos_rest_api', 'vifib_slapos_rest_api_v1', - 'vifib_slapos_rest_api_v1_portal_type', + 'vifib_slapos_rest_api_tool_portal_type', 'vifib_slapos_rest_api_v1_test', 'vifib_base', 'vifib_core', diff --git a/setup.py b/setup.py index 7ce7f19c7cb6f65e8056bc0d9e8a7cbc7a5ad4bb..67f9a84669eb7ea54c9bf36c727949f2c3178b6c 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages import glob import os -version = '0.26-dev' +version = '0.28.2' name = 'slapos.core' long_description = open("README.txt").read() + "\n" + \ open("CHANGES.txt").read() + "\n" @@ -27,6 +27,8 @@ setup(name=name, ], keywords='slapos core', license='GPLv3', + url='http://www.slapos.org', + author='VIFIB', namespace_packages=['slapos'], packages=find_packages(), include_package_data=True, @@ -56,6 +58,7 @@ setup(name=name, 'slapgrid-supervisord = slapos.grid.svcbackend:supervisord', 'slapproxy = slapos.proxy:main', 'bang = slapos.bang:main', + 'slapos = slapos.entry:main', ] }, test_suite="slapos.tests", diff --git a/slapos-client.cfg.example b/slapos-client.cfg.example index b771c5ef0f23c1d2e084abcc0334fd075520b40a..5bfa28002adb1f0aa97f885dab6fcac68df8aa3c 100644 --- a/slapos-client.cfg.example +++ b/slapos-client.cfg.example @@ -2,28 +2,27 @@ master_url = https://slap.vifib.com/ [slapconsole] +# Put here retrieved certificate from vifib. +# Beware: put certificate from YOUR account, not the one from your node. +# You (as identified person from vifib) will request an instance, node your node. +# Conclusion: node certificate != person certificate. cert_file = certificate file location coming from your slapos master account key_file = key file location coming from your slapos master account # Below are softwares supported by Vifib alias = apache_frontend http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.74:/software/apache-frontend/software.cfg - dotclear https://svn.erp5.org/repos/public/slapos/trunk/software_release.contribution/dotclear.Kinwai.YIP/software.cfg + drupal http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.75:/software/erp5/software.cfg erp5 http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.75:/software/erp5/software.cfg erp5scalabilitytestbed http://git.erp5.org/gitweb/slapos.git/blob_plain/erp5scalabilitytestbed:/software/erp5scalabilitytestbed/software.cfg erp5_branch http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg - factux https://www.tiolive.com/vifib/P-OSOE.Factux.Wilfried.Rodrigues/Base_download - joomla https://svn.erp5.org/repos/public/slapos/trunk/software_release.contribution/joomla.Christophe.Laroulandie/software.cfg kumofs http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.64:/software/kumofs/software.cfg - kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.74:/software/kvm/software.cfg - lightforum https://svn.erp5.org/repos/public/slapos/trunk/software_release.contribution/lightforum.Christophe.Lefloch/software.cfg + kvm http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg mariadb http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.16-hotfix:/software/mariadb/software.cfg memcached http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.43:/software/memcached/software.cfg mysql http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.65:/software/mysql-5.1/software.cfg nosqltester http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/nosqltestbed:/software/nosqltestbed/software.cfg - respest https://www.tiolive.com/vifib/P-OSOE.Respest.BENHAMED/Base_download slaposwebrunner http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.66:/software/slaprunner/software.cfg - testnode http://git.erp5.org/gitweb/slapos.git/blob_plain/testnode:/software/testnode/software.cfg vifib http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.30:/software/vifib/software.cfg - wordpress http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.75:/software/wordpress/software.cfg + wordpress http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.86:/software/wordpress/software.cfg xwiki http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.46:/software/xwiki/software.cfg zabbixagent http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.5:/software/zabbix-agent/software.cfg diff --git a/slapos.cfg.example b/slapos.cfg.example index 01c38ae5a0ebff534acbf95afd0025f6bfdb981d..2f5de677f8720528a924be5a3563c8ecbbeeae67 100644 --- a/slapos.cfg.example +++ b/slapos.cfg.example @@ -5,13 +5,14 @@ master_url = https://slap.vifib.com/ # Replace computer_id by the unique identifier of your computer on vifib.net, # starting by COMP- computer_id = COMP-12345 -key_file = /etc/opt/slapos/key -cert_file = /etc/opt/slapos/certificate -certificate_repository_path = /etc/opt/slapos/pki/ +key_file = /etc/opt/slapos/ssl/computer.key +cert_file = /etc/opt/slapos/ssl/computer.crt +certificate_repository_path = /etc/opt/slapos/ssl/partition_pki [slapformat] # Replace by your network interface like eth0, eth1, slapbr0... interface_name = interfacename +create_tap = false partition_amount = 10 computer_xml = /opt/slapos/slapos.xml log_file = /opt/slapos/slapformat.log @@ -21,3 +22,131 @@ tap_base_name = slaptap # You can choose any other local network which does not conflict with your # current machine configuration ipv4_local_network = 10.0.0.0/16 +# Uncomment and change this if you are using an IPv6 tunnel (like VPN, gogoc, +# tunnelbroker.net) +# ipv6_interface = tapVPN + +[networkcache] +# Define options for binary cache, used to download already compiled software. +download-binary-cache-url = http://www.shacache.org/shacache +download-cache-url = https://www.shacache.org/shacache +download-binary-dir-url = http://www.shacache.org/shadir +# List of signatures of uploaders we trust: +# Romain Courteaud +# Sebastien Robin +# Kazuhiko Shiozaki +# Cedric de Saint Martin +# Yingjie Xu +# Gabriel Monnerat +# Åukasz Nowak +# Test Agent Signature +signature-certificate-list = + -----BEGIN CERTIFICATE----- + MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE + CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5 + MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl + ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF + AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw + boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX + Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA + ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX + mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC + q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g + QUUGLQ== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV + BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw + DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+ + YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN + XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR + L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU + /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t + LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda + FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd + R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU + hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB7jCCAVegAwIBAgIJAJWA0jQ4o9DGMA0GCSqGSIb3DQEBBQUAMA8xDTALBgNV + BAMMBHg2MXMwIBcNMTExMTI0MTAyNDQzWhgPMjExMTEwMzExMDI0NDNaMA8xDTAL + BgNVBAMMBHg2MXMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANdJNiFsRlkH + vq2kHP2zdxEyzPAWZH3CQ3Myb3F8hERXTIFSUqntPXDKXDb7Y/laqjMXdj+vptKk + 3Q36J+8VnJbSwjGwmEG6tym9qMSGIPPNw1JXY1R29eF3o4aj21o7DHAkhuNc5Tso + 67fUSKgvyVnyH4G6ShQUAtghPaAwS0KvAgMBAAGjUDBOMB0GA1UdDgQWBBSjxFUE + RfnTvABRLAa34Ytkhz5vPzAfBgNVHSMEGDAWgBSjxFUERfnTvABRLAa34Ytkhz5v + PzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFLDS7zNhlrQYSQO5KIj + z2RJe3fj4rLPklo3TmP5KLvendG+LErE2cbKPqnhQ2oVoj6u9tWVwo/g03PMrrnL + KrDm39slYD/1KoE5kB4l/p6KVOdeJ4I6xcgu9rnkqqHzDwI4v7e8/D3WZbpiFUsY + vaZhjNYKWQf79l6zXfOvphzJ + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT + MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB + D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1 + P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O + BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp + cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr + b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV + Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby + If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAIlBksrZVkK8MA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMzU3MCAXDTEyMDEyNjEwNTUyOFoYDzIxMTIwMTAyMTA1NTI4WjAT + MREwDwYDVQQDDAhDT01QLTM1NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + ts+iGUwi44vtIfwXR8DCnLtHV4ydl0YTK2joJflj0/Ws7mz5BYkxIU4fea/6+VF3 + i11nwBgYgxQyjNztgc9u9O71k1W5tU95yO7U7bFdYd5uxYA9/22fjObaTQoC4Nc9 + mTu6r/VHyJ1yRsunBZXvnk/XaKp7gGE9vNEyJvPn2bkCAwEAAaNQME4wHQYDVR0O + BBYEFKuGIYu8+6aEkTVg62BRYaD11PILMB8GA1UdIwQYMBaAFKuGIYu8+6aEkTVg + 62BRYaD11PILMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAMoTRpBxK + YLEZJbofF7gSrRIcrlUJYXfTfw1QUBOKkGFFDsiJpEg4y5pUk1s5Jq9K3SDzNq/W + it1oYjOhuGg3al8OOeKFrU6nvNTF1BAvJCl0tr3POai5yXyN5jlK/zPfypmQYxE+ + TaqQSGBJPVXYt6lrq/PRD9ciZgKLOwEqK8w= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAPHoWu90gbsgMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV + BAMMCXZpZmlibm9kZTAeFw0xMjAzMTkyMzIwNTVaFw0xMzAzMTkyMzIwNTVaMBQx + EjAQBgNVBAMMCXZpZmlibm9kZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + ozBijpO8PS5RTeKTzA90vi9ezvv4vVjNaguqT4UwP9+O1+i6yq1Y2W5zZxw/Klbn + oudyNzie3/wqs9VfPmcyU9ajFzBv/Tobm3obmOqBN0GSYs5fyGw+O9G3//6ZEhf0 + NinwdKmrRX+d0P5bHewadZWIvlmOupcnVJmkks852BECAwEAAaNQME4wHQYDVR0O + BBYEFF9EtgfZZs8L2ZxBJxSiY6eTsTEwMB8GA1UdIwQYMBaAFF9EtgfZZs8L2ZxB + JxSiY6eTsTEwMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAc43YTfc6 + baSemaMAc/jz8LNLhRE5dLfLOcRSoHda8y0lOrfe4lHT6yP5l8uyWAzLW+g6s3DA + Yme/bhX0g51BmI6gjKJo5DoPtiXk/Y9lxwD3p7PWi+RhN+AZQ5rpo8UfwnnN059n + yDuimQfvJjBFMVrdn9iP6SfMjxKaGk6gVmI= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAMNZBmoIOXPBMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMTMyMCAXDTEyMDUwMjEyMDQyNloYDzIxMTIwNDA4MTIwNDI2WjAT + MREwDwYDVQQDDAhDT01QLTEzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + 6peZQt1sAmMAmSG9BVxxcXm8x15kE9iAplmANYNQ7z2YO57c10jDtlYlwVfi/rct + xNUOKQtc8UQtV/fJWP0QT0GITdRz5X/TkWiojiFgkopza9/b1hXs5rltYByUGLhg + 7JZ9dZGBihzPfn6U8ESAKiJzQP8Hyz/o81FPfuHCftsCAwEAAaNQME4wHQYDVR0O + BBYEFNuxsc77Z6/JSKPoyloHNm9zF9yqMB8GA1UdIwQYMBaAFNuxsc77Z6/JSKPo + yloHNm9zF9yqMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAl4hBaJy1 + cgiNV2+Z5oNTrHgmzWvSY4duECOTBxeuIOnhql3vLlaQmo0p8Z4c13kTZq2s3nhd + Loe5mIHsjRVKvzB6SvIaFUYq/EzmHnqNdpIGkT/Mj7r/iUs61btTcGUCLsUiUeci + Vd0Ozh79JSRpkrdI8R/NRQ2XPHAo+29TT70= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT + MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A + sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1 + mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O + BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK + mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2 + M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs + 5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e + x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI= + -----END CERTIFICATE----- +# List of URL(s) which shouldn't be installed from binary cache, separated by +# commas. Any URL beginning by a blacklisted URL will be blacklisted as well. +binary-cache-url-blacklist = + http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD + http://git.erp5.org/gitweb/slapos.core.git/blob_plain/refs/heads diff --git a/slapos/bang.py b/slapos/bang.py index 6fa0d8a42833eec39be844f5229228cd7748e0b2..0bec8eef2bad0cdc07b4bfdf4befcffc9de1098c 100644 --- a/slapos/bang.py +++ b/slapos/bang.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or diff --git a/slapos/console.py b/slapos/console.py index e9bfa7c6746e2338384f877ff7e70d5b02eef0b1..c4ddaa404525cde6d8093b5d67e722e5c7f751f6 100644 --- a/slapos/console.py +++ b/slapos/console.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or @@ -154,11 +156,11 @@ slapos-request allows you to request slapos instances.""" % sys.argv[0] config = Config() options, arguments = RequestParser(usage=usage).check_args() config.setConfig(options, arguments[0]) - + local = init(config) - + # Request instance - # XXX-Cedric : support things like : + # XXX-Cedric : support things like : # --instance-type std --configuration-size 23 --computer-region europe/france # XXX-Cedric : add support for xml_parameter software_url = arguments[1] @@ -194,6 +196,6 @@ examples : >>> request(kvm, "myuniquekvm").getConnectionParameter("url")""" % sys.argv[0] config = Config() config.setConfig(*Parser(usage=usage).check_args()) - + local = init(config) __import__("code").interact(banner="", local=local) diff --git a/slapos/entry.py b/slapos/entry.py new file mode 100644 index 0000000000000000000000000000000000000000..efde8cb0ef370e6be688e854c3c4a3c61f808d8e --- /dev/null +++ b/slapos/entry.py @@ -0,0 +1,44 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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 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 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. +# +############################################################################## + +import sys +from register.register import main as node_register + + +def main(): + if len(sys.argv) < 3: + print "Usage: slapos node register NODE_NAME [options]" + print "%s: error: Incorrect number of arguments" % sys.argv[0] + return 0 + "Run default configuration." + if sys.argv[1] == "node" and sys.argv[2] == "register": + sys.argv=sys.argv[2:] + node_register() + else : + print "Usage: slapos node register NODE_NAME [options]" + print "%s: error: Incorrect arguments" % sys.argv[0] diff --git a/slapos/format.py b/slapos/format.py index 989ac38cd230f8b69e90a9a67f349ff998d70c0a..4496648947dd565c88decea28ed8cb6408ccd20d 100644 --- a/slapos/format.py +++ b/slapos/format.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010, 2011 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -25,6 +26,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## + from optparse import OptionParser, Option from xml_marshaller import xml_marshaller import ConfigParser @@ -179,7 +181,7 @@ class Computer(object): def __getinitargs__(self): return (self.reference, self.interface) - def getAddress(self): + def getAddress(self, allow_tap=False): """ Return a list of the interface address not attributed to any partition, (which are therefore free for the computer itself). @@ -201,11 +203,16 @@ class Computer(object): if address_dict['addr'] not in computer_partition_address_list: return address_dict - # all addresses on interface are for partition, so lets add new one - computer_tap = Tap('compdummy') - computer_tap.createWithOwner(User('root'), attach_to_tap=True) - self.interface.addTap(computer_tap) - return self.interface.addAddr() + if allow_tap: + # all addresses on interface are for partition, so lets add new one + computer_tap = Tap('compdummy') + computer_tap.createWithOwner(User('root'), attach_to_tap=True) + self.interface.addTap(computer_tap) + return self.interface.addAddr() + + # Can't find address + raise NoAddressOnInterface('No valid IPv6 found on %s.' % + self.interface.name) def send(self, config): """ @@ -230,7 +237,7 @@ class Computer(object): raise slap.NotFoundError("%s\nERROR : This SlapOS node is not recognised by " "SlapOS Master. Please make sure computer_id of slapos.cfg looks " "like 'COMP-123' and is correct.\nError is : 404 Not Found." % error) - return + return def dump(self, path_to_xml): """ @@ -304,7 +311,7 @@ class Computer(object): if alter_network and self.address is not None: self.interface.addAddr(self.address, self.netmask) - for path in self.instance_root, self.software_root: + for path in self.instance_root, self.software_root: if not os.path.exists(path): os.makedirs(path, 0755) else: @@ -670,7 +677,7 @@ class Interface(object): def _addSystemAddress(self, address, netmask, ipv6=True): """Adds system address to interface - + Returns True if address was added successfully. Returns False if there was issue. @@ -851,10 +858,6 @@ class Parser(OptionParser): help="Don't actually do anything.", default=False, action="store_true"), - Option("-b", "--no_bridge", - help="Don't use bridge but use real interface like eth0.", - default=False, - action="store_true"), Option("-v", "--verbose", default=False, action="store_true", @@ -867,6 +870,10 @@ class Parser(OptionParser): help="Shall slapformat alter user database [default: True]"), Option('--alter_network', choices=['True', 'False'], help="Shall slapformat alter network configuration [default: True]"), + Option('--now', + help="Launch slapformat without delay", + default=False, + action="store_true"), ]) def check_args(self, args): @@ -979,7 +986,7 @@ def run(config): computer.instance_root = config.instance_root computer.software_root = config.software_root config.logger.info('Updating computer') - address = computer.getAddress() + address = computer.getAddress(config.create_tap) computer.address = address['addr'] computer.netmask = address['netmask'] @@ -1006,7 +1013,7 @@ def run(config): computer_definition.write(open(filepath, 'w')) config.logger.info('Stored computer definition in %r' % filepath) computer.construct(alter_user=config.alter_user, - alter_network=config.alter_network, create_tap=not config.no_bridge) + alter_network=config.alter_network, create_tap=config.create_tap) # Dumping and sending to the erp5 the current configuration if not config.dry_run: @@ -1020,6 +1027,7 @@ class Config(object): cert_file = None alter_network = None alter_user = None + create_tap = None computer_xml = None logger = None log_file = None @@ -1048,6 +1056,11 @@ class Config(object): """ self.key_file = None self.cert_file = None + + # set up logging + self.logger = logging.getLogger("slapformat") + self.logger.setLevel(logging.INFO) + # Set options parameters for option, value in option_dict.__dict__.items(): setattr(self, option, value) @@ -1067,11 +1080,18 @@ class Config(object): 'tap_base_name', 'ipv4_local_network', 'ipv6_interface']: if getattr(self, parameter, None) is None: setattr(self, parameter, None) - + # Backward compatibility if not getattr(self, "interface_name", None) \ and getattr(self, "bridge_name", None): setattr(self, "interface_name", self.bridge_name) + self.logger.warning('bridge_name option is deprecated and should be ' + 'replaced by interface_name.') + if not getattr(self, "create_tap", None) \ + and getattr(self, "no_bridge", None): + setattr(self, "create_tap", not self.no_bridge) + self.logger.warning('no_bridge option is deprecated and should be ' + 'replaced by create_tap.') # Set defaults lately if self.alter_network is None: @@ -1080,15 +1100,15 @@ class Config(object): self.alter_user = 'True' if self.software_user is None: self.software_user = 'slapsoft' + if self.create_tap is None: + self.create_tap = True - # set up logging - self.logger = logging.getLogger("slapformat") - self.logger.setLevel(logging.INFO) + # Configure logging if self.console: self.logger.addHandler(logging.StreamHandler()) # Convert strings to booleans - for o in ['alter_network', 'alter_user', 'no_bridge']: + for o in ['alter_network', 'alter_user', 'create_tap']: attr = getattr(self, o) if isinstance(attr, str): if attr.lower() == 'true': @@ -1105,12 +1125,12 @@ class Config(object): if not self.dry_run: if self.alter_user: self.checkRequiredBinary(['groupadd', 'useradd', 'usermod']) - if not self.no_bridge: + if self.create_tap: self.checkRequiredBinary(['tunctl']) if self.alter_network: self.checkRequiredBinary(['ip']) # Required, even for dry run - if self.alter_network and not self.no_bridge: + if self.alter_network and self.create_tap: self.checkRequiredBinary(['brctl']) # Check if root is needed @@ -1118,7 +1138,7 @@ class Config(object): root_needed = True else: root_needed = False - + # check root if root_needed and os.getuid() != 0: message = "Root rights are needed" @@ -1137,20 +1157,30 @@ class Config(object): "%(name)s - %(levelname)s - %(message)s")) self.logger.addHandler(file_handler) self.logger.info('Configured logging to file %r' % self.log_file) + # Check mandatory options for parameter in ('computer_id', 'instance_root', 'master_url', 'software_root', 'computer_xml'): if not getattr(self, parameter, None): raise UsageError("Parameter '%s' is not defined." % parameter) + # Check existence of SSL certificate files, if defined + for attribute in ['key_file', 'cert_file', 'master_ca_file']: + file_location = getattr(self, attribute, None) + if file_location is not None: + if not os.path.exists(file_location): + self.logger.fatal('File %r does not exist or is no readable.' % + file_location) + sys.exit(1) + self.logger.info("Started.") if self.verbose: self.logger.setLevel(logging.DEBUG) self.logger.debug("Verbose mode enabled.") if self.dry_run: self.logger.info("Dry-run mode enabled.") - if self.no_bridge: - self.logger.info("No-bridge mode enabled.") + if self.create_tap: + self.logger.info("Tap creation mode enabled.") # Calculate path once self.computer_xml = os.path.abspath(self.computer_xml) @@ -1193,6 +1223,12 @@ def main(*args): config.logger.debug(' '.join(argument_list)) return dry_callAndRead(argument_list, raise_on_error) callAndRead = logging_callAndRead + # Add delay between 0 and 1 hour + if not config.now: + duration = float(60*60) * random.random() + print("Sleeping for %s seconds. To disable this feature, " \ + "use with --now parameter in manual." % duration) + time.sleep(duration) try: run(config) except: diff --git a/slapos/grid/SlapObject.py b/slapos/grid/SlapObject.py index 1030a418d95268c54867de5a6a861aa331849e78..9704f0682e6f3c2d6817254a39617280ea094fe0 100644 --- a/slapos/grid/SlapObject.py +++ b/slapos/grid/SlapObject.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or @@ -24,6 +26,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## + import logging import os import shutil @@ -51,7 +54,8 @@ class Software(object): upload_cache_url=None, upload_dir_url=None, shacache_cert_file=None, shacache_key_file=None, shadir_cert_file=None, shadir_key_file=None, download_binary_cache_url=None, upload_binary_cache_url=None, - download_binary_dir_url=None, upload_binary_dir_url=None): + download_binary_dir_url=None, upload_binary_dir_url=None, + binary_cache_url_blacklist = []): """Initialisation of class parameters """ self.url = url @@ -74,41 +78,45 @@ class Software(object): self.upload_binary_cache_url = upload_binary_cache_url self.download_binary_dir_url = download_binary_dir_url self.upload_binary_dir_url = upload_binary_dir_url + self.binary_cache_url_blacklist = binary_cache_url_blacklist def install(self): """ Fetches binary cache if possible. Installs from buildout otherwise. """ + self.logger.info("Installing software release %s..." % self.url) tarname = self.software_url_hash cache_dir = tempfile.mkdtemp() tarpath = os.path.join(cache_dir, tarname) + # Check if we can download from cache if (not os.path.exists(self.software_path)) \ - and download_network_cached( - self.download_binary_cache_url, - self.download_binary_dir_url, - self.url, self.software_root, - self.software_url_hash, - tarpath, self.logger, - self.signature_certificate_list): - tar = tarfile.open(tarpath) + and download_network_cached( + self.download_binary_cache_url, + self.download_binary_dir_url, + self.url, self.software_root, + self.software_url_hash, + tarpath, self.logger, + self.signature_certificate_list, + self.binary_cache_url_blacklist): + tar = tarfile.open(tarpath) + try: + self.logger.info("Extracting archive of cached software release...") + tar.extractall(path=self.software_root) + finally: + tar.close() + else: + self._install_from_buildout() + if (self.software_root and self.url and self.software_url_hash \ + and self.upload_binary_cache_url \ + and self.upload_binary_dir_url): + self.logger.info("Creating archive of software release...") + tar = tarfile.open(tarpath, "w:gz") try: - self.logger.info("Extracting archive of cached software release...") - tar.extractall(path=self.software_root) + tar.add(self.software_path, arcname=self.software_url_hash) finally: tar.close() - else: - self._install_from_buildout() - if (self.software_root and self.url and self.software_url_hash \ - and self.upload_binary_cache_url \ - and self.upload_binary_dir_url): - self.logger.info("Creating archive of software release...") - tar = tarfile.open(tarpath, "w:gz") - try: - tar.add(self.software_path, arcname=self.software_url_hash) - finally: - tar.close() - self.logger.info("Trying to upload archive of software release...") - upload_network_cached( + self.logger.info("Trying to upload archive of software release...") + upload_network_cached( self.software_root, self.url, self.software_url_hash, self.upload_binary_cache_url, @@ -120,12 +128,11 @@ class Software(object): self.shadir_cert_file, self.shadir_key_file) shutil.rmtree(cache_dir) - + def _install_from_buildout(self): """ Fetches buildout configuration from the server, run buildout with it. If it fails, we notify the server. """ - self.logger.info("Installing software release %s..." % self.url) root_stat_info = os.stat(self.software_root) os.environ = utils.getCleanEnvironment(pwd.getpwuid(root_stat_info.st_uid ).pw_dir) @@ -260,8 +267,6 @@ class Partition(object): """ Creates configuration file from template in software_path, then installs the software partition with the help of buildout """ - # XXX: Shall be no op in case if revision had not changed - # It requires implementation of revision on server self.logger.info("Installing Computer Partition %s..." \ % self.computer_partition.getId()) # Checks existence and permissions of Partition directory @@ -280,7 +285,6 @@ class Partition(object): os.environ = utils.getCleanEnvironment(pwd.getpwuid( instance_stat_info.st_uid).pw_dir) # Generates buildout part from template - # TODO how to fetch the good template? Naming conventions? template_location = os.path.join(self.software_path, 'template.cfg') config_location = os.path.join(self.instance_path, 'buildout.cfg') self.logger.debug("Copying %r to %r" % (template_location, config_location)) diff --git a/slapos/grid/__init__.py b/slapos/grid/__init__.py index c1fb153d21a2e5266b62d21084a732c1bc65eaea..05487396e54f6ac5b4ce04d351803e3888ea79d7 100644 --- a/slapos/grid/__init__.py +++ b/slapos/grid/__init__.py @@ -1,12 +1,13 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or diff --git a/slapos/grid/exception.py b/slapos/grid/exception.py index 683dbf2f833e0101648eff4ee51b102e592f6b50..51d909c9197e21729c6ca64ea7d6ad446c18d823 100644 --- a/slapos/grid/exception.py +++ b/slapos/grid/exception.py @@ -1,12 +1,13 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or diff --git a/slapos/grid/networkcache.py b/slapos/grid/networkcache.py index a6544802991325f7c357d2f7253351998a439ad7..1cd08a97a262ad4a2397089e07444c1097030bcf 100644 --- a/slapos/grid/networkcache.py +++ b/slapos/grid/networkcache.py @@ -1,6 +1,6 @@ ############################################################################## # -# Copyright (c) 2010 ViFiB SARL and Contributors. +# Copyright (c) 2010, 2011, 2012 ViFiB SARL and Contributors. # All Rights Reserved. # # This software is subject to the provisions of the Zope Public License, @@ -12,15 +12,8 @@ # ############################################################################## - -import hashlib -import os -import posixpath -import re import shutil -import urlparse import traceback -import utils import json import platform @@ -56,7 +49,8 @@ def fallback_call(function): @fallback_call def download_network_cached(cache_url, dir_url, software_url, software_root, - key, path, logger, signature_certificate_list): + key, path, logger, signature_certificate_list, + binary_cache_url_blacklist=None): """Downloads from a network cache provider return True if download succeeded. @@ -67,6 +61,10 @@ def download_network_cached(cache_url, dir_url, software_url, software_root, if not(cache_url and dir_url and software_url and software_root): return False + for url in binary_cache_url_blacklist: + if software_url.startswith(url): + return False + # In order to call nc nicely. if len(signature_certificate_list) == 0: signature_certificate_list = None diff --git a/slapos/grid/slapgrid.py b/slapos/grid/slapgrid.py index 4c7ff06934338588e15d95c01709921ec28e128b..df1312e7ee26e52f59e148bd87da31c08871ccd8 100644 --- a/slapos/grid/slapgrid.py +++ b/slapos/grid/slapgrid.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or @@ -24,42 +26,40 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## + +import argparse +import ConfigParser +from hashlib import md5 +from lxml import etree import logging import os -import sys import pkg_resources +from random import random +import socket +import subprocess +import StringIO +import sys +import tempfile +import time +import traceback import warnings if sys.version_info < (2, 6): warnings.warn('Used python version (%s) is old and have problems with' ' IPv6 connections' % sys.version.split('\n')[0]) -import socket -import subprocess -import traceback -import time -#from time import strftime +from slapos.slap.slap import NotFoundError +from slapos.slap.slap import ServerError from SlapObject import Software, Partition, WrongPermissionError, \ PathDoesNotExistError -import argparse -import ConfigParser -from utils import updateFile +from svcbackend import launchSupervisord from utils import createPrivateDirectory +from utils import dropPrivileges +from utils import getSoftwareUrlHash from utils import setRunning from utils import setFinished -from utils import getSoftwareUrlHash -from slapos import slap -from slapos.slap import NotFoundError -from slapos.slap.slap import ServerError -from utils import dropPrivileges from utils import SlapPopen -from svcbackend import launchSupervisord -import tempfile -from time import strftime -import StringIO -from lxml import etree -from time import sleep -from random import random - +from utils import updateFile +from slapos import slap MANDATORY_PARAMETER_LIST = [ 'computer_id', @@ -77,47 +77,54 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): """ parser = argparse.ArgumentParser() parser.add_argument("--instance-root", - help="The instance root directory location.") + help="The instance root directory location.") parser.add_argument("--software-root", - help="The software_root directory location.") + help="The software_root directory location.") parser.add_argument("--master-url", - help="The master server URL. Mandatory.") + help="The master server URL. Mandatory.") parser.add_argument("--computer-id", - help="The computer id defined in the server.") + help="The computer id defined in the server.") parser.add_argument("--supervisord-socket", - help="The socket supervisor will use.") + help="The socket supervisor will use.") parser.add_argument("--supervisord-configuration-path", - help="The location where supervisord configuration " \ - "will be stored.") - parser.add_argument("--usage-report-periodicity", - type=int, default="24", - help="The periodicity of usage report sends, in hours.") - parser.add_argument("--buildout", help="Location of buildout binary.", - default=None) + help="The location where supervisord configuration will be stored.") + parser.add_argument("--buildout", default=None, + help="Location of buildout binary.") parser.add_argument("--pidfile", - help="The location where pidfile will be created.") + help="The location where pidfile will be created.") parser.add_argument("--logfile", - help="The location where slapgrid logfile will be " \ - "created.") + help="The location where slapgrid logfile will be created.") parser.add_argument("--key_file", help="SSL Authorisation key file.") parser.add_argument("--cert_file", help="SSL Authorisation certificate file.") - parser.add_argument("--signature_private_key_file", help="Signature private key file.") - parser.add_argument("--master_ca_file", help="Root certificate of SlapOS " - "master key.") + parser.add_argument("--signature_private_key_file", + help="Signature private key file.") + parser.add_argument("--master_ca_file", + help="Root certificate of SlapOS master key.") parser.add_argument("--certificate_repository_path", help="Path to directory where downloaded certificates would be stored.") parser.add_argument("-c", "--console", action="store_true", default=False, help="Enables console output and live output from subcommands.") parser.add_argument("-v", "--verbose", action="store_true", default=False, help="Be verbose.") - parser.add_argument("--promise-timeout", - type=int, default=3, - help="Promise timeout in seconds.") + parser.add_argument("--promise-timeout", type=int, default=3, + help="Promise timeout in seconds.") parser.add_argument("configuration_file", nargs=1, type=argparse.FileType(), help="SlapOS configuration file.") - parser.add_argument("--maximal_delay", help="The maximal delay value in seconds. " \ - "A negative value leads start immediately.") + parser.add_argument("--now", action="store_true", default=False, + help="Launch slapgrid without delay.") + parser.add_argument("--develop", action="store_true", default=False, + help="Launch slapgrid in develop mode. In develop mode, slapgrid " + "will process all Softare Releases and/or Computer Partitions.") + parser.add_argument("--only_sr", + help="Force the update of a single software release (use url hash)," + "event if is already installed. This option will make all others " + "sofware releases be ignored.") + parser.add_argument("--only_cp", + help="Update a single or a list of computer partitions " + "(ie.:slappartX, slappartY)," + "this option will make all others computer partitions be ignored.") + # Parses arguments if argument_tuple == (): @@ -141,7 +148,6 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): if argument_value is not None: option_dict.update({argument_key: argument_value}) # Configures logger. - #XXX: We need to configure it as soon as possible, so I do it here. logger_format = '%(asctime)s %(name)-18s: %(levelname)-8s %(message)s' if option_dict['verbose']: level = logging.DEBUG @@ -192,12 +198,12 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): for f in mandatory_file_list: if f is not None: if not os.path.exists(f): - parser.error('File %r does not exists.' % f) + parser.error('File %r does not exist.' % f) certificate_repository_path = option_dict.get('certificate_repository_path') if certificate_repository_path is not None: if not os.path.isdir(certificate_repository_path): - parser.error('Directory %r does not exists' % + parser.error('Directory %r does not exist' % certificate_repository_path) # Supervisord configuration location @@ -219,14 +225,24 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): else: signature_certificate_list = None - maximal_delay = float(option_dict.get("maximal_delay", "300")) + # Parse cache / binary options + option_dict["binary-cache-url-blacklist"] = [ + url.strip() for url in option_dict.get("binary-cache-url-blacklist", "" + ).split('\n') if url] + + # Sleep for a random time to avoid SlapOS Master being DDOSed by an army of + # SlapOS Nodes configured with cron. + if option_dict["now"]: + maximal_delay = 0 + else: + maximal_delay = int(option_dict.get("maximal_delay", "300")) if maximal_delay > 0: - duration = maximal_delay * random() + duration = int(maximal_delay * random()) logging.info("Sleeping for %s seconds. To disable this feature, " \ "check maximal_delay parameter in manual." % duration) time.sleep(duration) - # Returning new Slapgrid instance and options + # Return new Slapgrid instance and options return ([Slapgrid(software_root=option_dict['software_root'], instance_root=option_dict['instance_root'], master_url=option_dict['master_url'], @@ -234,7 +250,6 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): supervisord_socket=option_dict['supervisord_socket'], supervisord_configuration_path=option_dict[ 'supervisord_configuration_path'], - usage_report_periodicity=option_dict['usage_report_periodicity'], key_file=key_file, cert_file=cert_file, master_ca_file=master_ca_file, @@ -245,6 +260,8 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): option_dict.get('download-binary-cache-url', None), upload_binary_cache_url=\ option_dict.get('upload-binary-cache-url', None), + binary_cache_url_blacklist=\ + option_dict.get('binary-cache-url-blacklist', []), upload_cache_url=option_dict.get('upload-cache-url', None), download_binary_dir_url=\ option_dict.get('download-binary-dir-url', None), @@ -258,6 +275,9 @@ def parseArgumentTupleAndReturnSlapgridObject(*argument_tuple): shacache_key_file=option_dict.get('shacache-key-file', None), shadir_cert_file=option_dict.get('shadir-cert-file', None), shadir_key_file=option_dict.get('shadir-key-file', None), + develop=option_dict.get('develop', False), + software_release_filter_list=option_dict.get('only_sr', None), + computer_partition_filter_list=option_dict.get('only_cp', None), ), option_dict]) @@ -325,7 +345,6 @@ class Slapgrid(object): computer_id, supervisord_socket, supervisord_configuration_path, - usage_report_periodicity, buildout, key_file=None, cert_file=None, @@ -333,6 +352,7 @@ class Slapgrid(object): signature_certificate_list=None, download_binary_cache_url=None, upload_binary_cache_url=None, + binary_cache_url_blacklist=None, upload_cache_url=None, download_binary_dir_url=None, upload_binary_dir_url=None, @@ -344,7 +364,10 @@ class Slapgrid(object): shacache_cert_file=None, shacache_key_file=None, shadir_cert_file=None, - shadir_key_file=None): + shadir_key_file=None, + develop=False, + software_release_filter_list=None, + computer_partition_filter_list=None): """Makes easy initialisation of class parameters""" # Parses arguments self.software_root = os.path.abspath(software_root) @@ -353,7 +376,6 @@ class Slapgrid(object): self.computer_id = computer_id self.supervisord_socket = supervisord_socket self.supervisord_configuration_path = supervisord_configuration_path - self.usage_report_periodicity = usage_report_periodicity self.key_file = key_file self.cert_file = cert_file self.master_ca_file = master_ca_file @@ -362,6 +384,7 @@ class Slapgrid(object): self.signature_certificate_list = signature_certificate_list self.download_binary_cache_url = download_binary_cache_url self.upload_binary_cache_url = upload_binary_cache_url + self.binary_cache_url_blacklist = binary_cache_url_blacklist self.upload_cache_url = upload_cache_url self.download_binary_dir_url = download_binary_dir_url self.upload_binary_dir_url = upload_binary_dir_url @@ -384,6 +407,16 @@ class Slapgrid(object): self.console = console self.buildout = buildout self.promise_timeout = promise_timeout + self.develop = develop + if software_release_filter_list is not None: + self.software_release_filter_list = \ + software_release_filter_list.split(",") + else: + self.software_release_filter_list= [] + self.computer_partition_filter_list = [] + if computer_partition_filter_list is not None: + self.computer_partition_filter_list = \ + computer_partition_filter_list.split(",") def checkEnvironmentAndCreateStructure(self): """Checks for software_root and instance_root existence, then creates @@ -408,7 +441,8 @@ class Slapgrid(object): updateFile(self.supervisord_configuration_path, pkg_resources.resource_stream(__name__, 'templates/supervisord.conf.in').read() % dict( - supervisord_configuration_directory=self.supervisord_configuration_directory, + supervisord_configuration_directory=\ + self.supervisord_configuration_directory, supervisord_socket=os.path.abspath(self.supervisord_socket), supervisord_loglevel='info', supervisord_logfile=os.path.abspath(os.path.join( @@ -441,6 +475,8 @@ class Slapgrid(object): state = software_release.getState() try: software_release_uri = software_release.getURI() + url_hash = md5(software_release_uri).hexdigest() + software_path = os.path.join(self.software_root, url_hash) software = Software(url=software_release_uri, software_root=self.software_root, console=self.console, buildout=self.buildout, @@ -448,6 +484,7 @@ class Slapgrid(object): signature_certificate_list=self.signature_certificate_list, download_binary_cache_url=self.download_binary_cache_url, upload_binary_cache_url=self.upload_binary_cache_url, + binary_cache_url_blacklist=self.binary_cache_url_blacklist, upload_cache_url=self.upload_cache_url, download_binary_dir_url=self.download_binary_dir_url, upload_binary_dir_url=self.upload_binary_dir_url, @@ -457,12 +494,23 @@ class Slapgrid(object): shadir_cert_file=self.shadir_cert_file, shadir_key_file=self.shadir_key_file) if state == 'available': - software_release.building() - software.install() + completed_tag = os.path.join(software_path, '.completed') + if self.develop or (not os.path.exists(completed_tag) and \ + len(self.software_release_filter_list) == 0) or \ + url_hash in self.software_release_filter_list: + try: + software_release.building() + except NotFoundError: + pass + software.install() + file_descriptor = open(completed_tag, 'w') + file_descriptor.write(time.asctime()) + file_descriptor.close() elif state == 'destroyed': - logger.info('Destroying %r...' % software_release_uri) - software.destroy() - logger.info('Destroyed %r.' % software_release_uri) + if os.path.exists(software_path): + logger.info('Destroying %r...' % software_release_uri) + software.destroy() + logger.info('Destroyed %r.' % software_release_uri) except (SystemExit, KeyboardInterrupt): exception = traceback.format_exc() software_release.error(exception) @@ -474,9 +522,15 @@ class Slapgrid(object): clean_run = False else: if state == 'available': - software_release.available() + try: + software_release.available() + except NotFoundError: + pass elif state == 'destroyed': - software_release.destroyed() + try: + software_release.destroyed() + except NotFoundError: + pass logger.info("Finished software releases...") return clean_run @@ -549,6 +603,36 @@ class Slapgrid(object): clean_run = True for computer_partition in self.getComputerPartitionList(): computer_partition_id = computer_partition.getId() + + # Check if we defined explicit list of partitions to process. + # If so, if current partition not in this list, skip. + if len(self.computer_partition_filter_list) > 0 and \ + (computer_partition_id not in self.computer_partition_filter_list): + continue + + instance_path = os.path.join(self.instance_root, computer_partition_id) + + # Try to get partition timestamp (last modification date) + timestamp_path = os.path.join(instance_path, '.timestamp') + parameter_dict = computer_partition.getInstanceParameterDict() + if 'timestamp' in parameter_dict: + timestamp = parameter_dict['timestamp'] + else: + timestamp = None + + # Check if timestamp from server is more recent than local one. + # If not: it's not worth processing this partition (nothing has changed). + if computer_partition_id not in self.computer_partition_filter_list and \ + (not self.develop) and os.path.exists(timestamp_path): + old_timestamp = open(timestamp_path).read() + if timestamp: + try: + if int(timestamp) <= int(old_timestamp): + continue + except ValueError: + os.remove(timestamp_path) + exception = traceback.format_exc() + logger.error(exception) try: software_url = computer_partition.getSoftwareRelease().getURI() except NotFoundError: @@ -557,8 +641,7 @@ class Slapgrid(object): getSoftwareUrlHash(software_url)) local_partition = Partition( software_path=software_path, - instance_path=os.path.join(self.instance_root, - computer_partition.getId()), + instance_path=instance_path, supervisord_partition_configuration_path=os.path.join( self.supervisord_configuration_directory, '%s.conf' % computer_partition_id), @@ -570,7 +653,6 @@ class Slapgrid(object): software_release_url=software_url, certificate_repository_path=self.certificate_repository_path, console=self.console, buildout=self.buildout) - # There are no conditions to try to instanciate partition try: computer_partition_state = computer_partition.getState() if computer_partition_state == "started": @@ -585,39 +667,31 @@ class Slapgrid(object): local_partition.stop() computer_partition.stopped() elif computer_partition_state == "destroyed": - # Stop, but safely + local_partition.stop() try: - local_partition.stop() - try: - computer_partition.stopped() - except (SystemExit, KeyboardInterrupt): - exception = traceback.format_exc() - computer_partition.error(exception) - raise - except Exception: - pass + computer_partition.stopped() except (SystemExit, KeyboardInterrupt): exception = traceback.format_exc() computer_partition.error(exception) raise except Exception: - clean_run = False - exception = traceback.format_exc() - logger.error(exception) - computer_partition.error(exception) + pass else: error_string = "Computer Partition %r has unsupported state: %s" % \ (computer_partition_id, computer_partition_state) computer_partition.error(error_string) raise NotImplementedError(error_string) + # If partition has been successfully processed, write timestamp + if timestamp: + timestamp_path = os.path.join(instance_path, '.timestamp') + open(timestamp_path, 'w').write(timestamp) except (SystemExit, KeyboardInterrupt): exception = traceback.format_exc() computer_partition.error(exception) raise - except Exception: + except Exception as exception: clean_run = False - exception = traceback.format_exc() - logger.error(exception) + logger.error(traceback.format_exc()) try: computer_partition.error(exception) except (SystemExit, KeyboardInterrupt): @@ -677,7 +751,7 @@ class Slapgrid(object): "<source></source>" \ "<destination></destination>" \ "</arrow>" \ - % (strftime("%Y-%m-%d at %H:%M:%S"), + % (time.strftime("%Y-%m-%d at %H:%M:%S"), self.computer_id) for computer_partition_usage in computer_partition_usage_list: @@ -685,12 +759,13 @@ class Slapgrid(object): usage_string = StringIO.StringIO(computer_partition_usage.usage) root = etree.parse(usage_string) except UnicodeError: - logger.info("Failed to read %s." % (computer_partition_usage.usage)) - logger.error(UnicodeError) + self.logger.info("Failed to read %s." % ( + computer_partition_usage.usage)) + self.logger.error(UnicodeError) raise "Failed to read %s." % (computer_partition_usage.usage) except (etree.XMLSyntaxError, etree.DocumentInvalid) as e: - logger.info("Failed to parse %s." % (usage_string)) - logger.error(e) + self.logger.info("Failed to parse %s." % (usage_string)) + self.logger.error(e) raise _formatXMLError(e) except Exception: raise "Failed to generate XML report." @@ -699,10 +774,12 @@ class Slapgrid(object): xml_movements += "<movement>" for children in movement.getchildren(): if children.tag == "reference": - xml_movements += "<%s>%s</%s>" % (children.tag, computer_partition_usage.getId(), children.tag) + xml_movements += "<%s>%s</%s>" % (children.tag, + computer_partition_usage.getId(), children.tag) else: - xml_movements += "<%s>%s</%s>" % (children.tag, children.text, children.tag) - xml_movements += "</movement>" + xml_movements += "<%s>%s</%s>" % (children.tag, children.text, + children.tag) + xml_movements += "</movement>" xml_foot = "</transaction>" \ "</journal>" @@ -727,7 +804,7 @@ class Slapgrid(object): except IOError: computer_consumption_model = \ pkg_resources.resource_string( - __name__, + __name__, '../../../../slapos/slap/doc/computer_consumption.xsd') try: @@ -738,116 +815,129 @@ class Slapgrid(object): except IOError: partition_consumption_model = \ pkg_resources.resource_string( - __name__, + __name__, '../../../../slapos/slap/doc/partition_consumption.xsd') clean_run = True #We loop on the different computer partitions computer_partition_list = slap_computer_usage.getComputerPartitionList() for computer_partition in computer_partition_list: - computer_partition_id = computer_partition.getId() - - #We want execute all the script in the report folder - instance_path = os.path.join(self.instance_root, - computer_partition.getId()) - report_path = os.path.join(instance_path, 'etc', 'report') - if os.path.isdir(report_path): - script_list_to_run = os.listdir(report_path) - else: - script_list_to_run = [] - - #We now generate the pseudorandom name for the xml file - # and we add it in the invocation_list - f = tempfile.NamedTemporaryFile() - name_xml = '%s.%s' % ('slapreport', os.path.basename(f.name)) - path_to_slapreport = os.path.join(instance_path, 'var', 'xml_report', - name_xml) - - failed_script_list = [] - for script in script_list_to_run: - - invocation_list = [] - invocation_list.append(os.path.join(instance_path, 'etc', 'report', - script)) - #We add the xml_file name in the invocation_list - #f = tempfile.NamedTemporaryFile() - #name_xml = '%s.%s' % ('slapreport', os.path.basename(f.name)) - #path_to_slapreport = os.path.join(instance_path, 'var', name_xml) - - invocation_list.append(path_to_slapreport) - #Dropping privileges - uid, gid = None, None - stat_info = os.stat(instance_path) - #stat sys call to get statistics informations - uid = stat_info.st_uid - gid = stat_info.st_gid - kw = dict() - if not self.console: - kw.update(stdout=subprocess.PIPE, stderr=subprocess.STDOUT) - process_handler = SlapPopen(invocation_list, - preexec_fn=lambda: dropPrivileges(uid, gid), - cwd=os.path.join(instance_path, 'etc', 'report'), - env=None, **kw) - result = process_handler.communicate()[0] - if self.console: - result = 'Please consult messages above' - if process_handler.returncode is None: - process_handler.kill() - if process_handler.returncode != 0: - clean_run = False - failed_script_list.append("Script %r failed with %s." % (script, result)) - logger.warning("Failed to run %r, the result was. \n%s" % - (invocation_list, result)) - if len(failed_script_list): - computer_partition.error('\n'.join(failed_script_list)) + try: + computer_partition_id = computer_partition.getId() + + #We want execute all the script in the report folder + instance_path = os.path.join(self.instance_root, + computer_partition.getId()) + report_path = os.path.join(instance_path, 'etc', 'report') + if os.path.isdir(report_path): + script_list_to_run = os.listdir(report_path) + else: + script_list_to_run = [] + + #We now generate the pseudorandom name for the xml file + # and we add it in the invocation_list + f = tempfile.NamedTemporaryFile() + name_xml = '%s.%s' % ('slapreport', os.path.basename(f.name)) + path_to_slapreport = os.path.join(instance_path, 'var', 'xml_report', + name_xml) + + failed_script_list = [] + for script in script_list_to_run: + invocation_list = [] + invocation_list.append(os.path.join(instance_path, 'etc', 'report', + script)) + #We add the xml_file name in the invocation_list + #f = tempfile.NamedTemporaryFile() + #name_xml = '%s.%s' % ('slapreport', os.path.basename(f.name)) + #path_to_slapreport = os.path.join(instance_path, 'var', name_xml) + + invocation_list.append(path_to_slapreport) + #Dropping privileges + uid, gid = None, None + stat_info = os.stat(instance_path) + #stat sys call to get statistics informations + uid = stat_info.st_uid + gid = stat_info.st_gid + kw = dict() + if not self.console: + kw.update(stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + process_handler = SlapPopen(invocation_list, + preexec_fn=lambda: dropPrivileges(uid, gid), + cwd=os.path.join(instance_path, 'etc', 'report'), + env=None, **kw) + result = process_handler.communicate()[0] + if self.console: + result = 'Please consult messages above' + if process_handler.returncode is None: + process_handler.kill() + if process_handler.returncode != 0: + clean_run = False + failed_script_list.append("Script %r failed with %s." % (script, + result)) + logger.warning("Failed to run %r, the result was. \n%s" % + (invocation_list, result)) + if len(failed_script_list): + computer_partition.error('\n'.join(failed_script_list)) + # Whatever happens, don't stop processing other instances + except Exception: + computer_partition_id = computer_partition.getId() + exception = traceback.format_exc() + issue = "Cannot run usage script(s) for %r: %s" % ( + computer_partition_id, exception) + logger.info(issue) - #Now we loop through the different computer partitions to ggetId()et reports + #Now we loop through the different computer partitions to report report_usage_issue_cp_list = [] for computer_partition in computer_partition_list: - filename_delete_list = [] - computer_partition_id = computer_partition.getId() - instance_path = os.path.join(self.instance_root, computer_partition_id) - dir_reports = os.path.join(instance_path, 'var', 'xml_report') - #The directory xml_report contain a number of files equal - #to the number of software instance running inside the same partition - if os.path.isdir(dir_reports): - filename_list = os.listdir(dir_reports) - else: - filename_list = [] - #logger.debug('name List %s' % filename_list) - usage = '' - - for filename in filename_list: - - file_path = os.path.join(dir_reports, filename) - if os.path.exists(file_path): - usage_file = open(file_path, 'r') - usage = usage_file.read() - usage_file.close() - - #We check the validity of xml content of each reports - if not self.validateXML(usage, partition_consumption_model): - logger.info('WARNING: The XML file %s generated by slapreport is not valid - ' \ - 'This report is left as is at %s where you can inspect what went wrong ' % (filename, dir_reports)) - #Warn the SlapOS Master that a partition generates corrupted xml report - else: - computer_partition_usage = self.slap.registerComputerPartition( - self.computer_id, computer_partition_id) - computer_partition_usage.setUsage(usage) - computer_partition_usage_list.append(computer_partition_usage) - filename_delete_list.append(filename) + try: + filename_delete_list = [] + computer_partition_id = computer_partition.getId() + instance_path = os.path.join(self.instance_root, computer_partition_id) + dir_reports = os.path.join(instance_path, 'var', 'xml_report') + #The directory xml_report contain a number of files equal + #to the number of software instance running inside the same partition + if os.path.isdir(dir_reports): + filename_list = os.listdir(dir_reports) else: - logger.debug("Usage report %r not found, ignored" % file_path) + filename_list = [] + #logger.debug('name List %s' % filename_list) + usage = '' + + for filename in filename_list: + + file_path = os.path.join(dir_reports, filename) + if os.path.exists(file_path): + usage_file = open(file_path, 'r') + usage = usage_file.read() + usage_file.close() + + #We check the validity of xml content of each reports + if not self.validateXML(usage, partition_consumption_model): + logger.info('WARNING: The XML file %s generated by slapreport is ' + 'not valid - This report is left as is at %s where you can ' + 'inspect what went wrong ' % (filename, dir_reports)) + # Warn the SlapOS Master that a partition generates corrupted xml + # report + else: + computer_partition_usage = self.slap.registerComputerPartition( + self.computer_id, computer_partition_id) + computer_partition_usage.setUsage(usage) + computer_partition_usage_list.append(computer_partition_usage) + filename_delete_list.append(filename) + else: + logger.debug("Usage report %r not found, ignored" % file_path) - #last_push_date = self.computer.getLastUsagePush() - #periodicity_timedelta = datetime.timedelta( - # self.usage_report_periodicity) - #if periodicity_timedelta + last_push_date < datetime.datetime.today(): - # Pushes informations, if any + #After sending the aggregated file we remove all the valid xml reports + for filename in filename_delete_list: + os.remove(os.path.join(dir_reports, filename)) - #After sending the aggregated file we remove all the valid xml reports - for filename in filename_delete_list: - os.remove(os.path.join(dir_reports, filename)) + # Whatever happens, don't stop processing other instances + except Exception: + computer_partition_id = computer_partition.getId() + exception = traceback.format_exc() + issue = "Cannot run usage script(s) for %r: %s" % ( + computer_partition_id, exception) + logger.info(issue) for computer_partition_usage in computer_partition_usage_list: logger.info('computer_partition_usage_list : %s - %s' % \ @@ -883,26 +973,26 @@ class Slapgrid(object): software_url = computer_partition.getSoftwareRelease().getURI() except NotFoundError: software_url = None - software_path = os.path.join(self.software_root, - getSoftwareUrlHash(software_url)) - local_partition = Partition( - software_path=software_path, - instance_path=os.path.join(self.instance_root, - computer_partition.getId()), - supervisord_partition_configuration_path=os.path.join( - self.supervisord_configuration_directory, '%s.conf' % - computer_partition_id), - supervisord_socket=self.supervisord_socket, - computer_partition=computer_partition, - computer_id=self.computer_id, - partition_id=computer_partition_id, - server_url=self.master_url, - software_release_url=software_url, - certificate_repository_path=self.certificate_repository_path, - console=self.console, buildout=self.buildout - ) if computer_partition.getState() == "destroyed": try: + software_path = os.path.join(self.software_root, + getSoftwareUrlHash(software_url)) + local_partition = Partition( + software_path=software_path, + instance_path=os.path.join(self.instance_root, + computer_partition.getId()), + supervisord_partition_configuration_path=os.path.join( + self.supervisord_configuration_directory, '%s.conf' % + computer_partition_id), + supervisord_socket=self.supervisord_socket, + computer_partition=computer_partition, + computer_id=self.computer_id, + partition_id=computer_partition_id, + server_url=self.master_url, + software_release_url=software_url, + certificate_repository_path=self.certificate_repository_path, + console=self.console, buildout=self.buildout + ) local_partition.stop() try: computer_partition.stopped() @@ -912,6 +1002,11 @@ class Slapgrid(object): raise except Exception: pass + if computer_partition.getId() in report_usage_issue_cp_list: + logger.info('Ignoring destruction of %r, as not report usage was ' + 'sent' % computer_partition.getId()) + continue + local_partition.destroy() except (SystemExit, KeyboardInterrupt): exception = traceback.format_exc() computer_partition.error(exception) @@ -921,11 +1016,6 @@ class Slapgrid(object): exception = traceback.format_exc() computer_partition.error(exception) logger.error(exception) - if computer_partition.getId() in report_usage_issue_cp_list: - logger.info('Ignoring destruction of %r, as not report usage was ' - 'sent' % computer_partition.getId()) - continue - local_partition.destroy() try: computer_partition.destroyed() except slap.NotFoundError: diff --git a/slapos/grid/svcbackend.py b/slapos/grid/svcbackend.py index 84c3fcdac60b0f5c349002af14b1793ab01248b8..8f10db8b5e321478dced35c82b2ec590eec615cb 100644 --- a/slapos/grid/svcbackend.py +++ b/slapos/grid/svcbackend.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or @@ -65,7 +67,7 @@ def launchSupervisord(socket, configuration_file): break else: if status['statename'] == 'RUNNING' and status['statecode'] == 1: - logger.info('Supervisord already running.') + logger.debug('Supervisord already running.') return elif status['statename'] == 'SHUTDOWN_STATE' and status['statecode'] == 6: logger.info('Supervisor in shutdown procedure, will check again later.') diff --git a/slapos/grid/utils.py b/slapos/grid/utils.py index 89e5f72b1c94b9ead08a1f1a82b98f80f46212e5..63172ebd1b6165fd4d738fce5f4ffcf660b2680e 100644 --- a/slapos/grid/utils.py +++ b/slapos/grid/utils.py @@ -1,12 +1,14 @@ +# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential # consequences resulting from its eventual inadequacies and bugs # End users who are looking for a ready-to-use solution with commercial -# guarantees and support are strongly adviced to contract a Free Software +# guarantees and support are strongly advised to contract a Free Software # Service Company # # This program is Free Software; you can redistribute it and/or @@ -24,6 +26,7 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # ############################################################################## + import logging import hashlib import os diff --git a/slapos/proxy/__init__.py b/slapos/proxy/__init__.py index e4b0c6c1a93fb304572a5642417a6b2fc3d60f7b..66a3c58d4355b50e0b337b30331ef385d0de91ab 100644 --- a/slapos/proxy/__init__.py +++ b/slapos/proxy/__init__.py @@ -1,3 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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 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 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. +# +############################################################################## + import os import sys from optparse import OptionParser, Option diff --git a/slapos/proxy/views.py b/slapos/proxy/views.py index e6662f35cf155933591aa3881d91ba7f36cb9963..7880af71ba507c069a3ed5ff7fb59d52e76d14e5 100644 --- a/slapos/proxy/views.py +++ b/slapos/proxy/views.py @@ -1,3 +1,32 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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 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 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 flask import g, Flask, request, abort import xml_marshaller from lxml import etree @@ -101,6 +130,24 @@ def getComputerInformation(): raise UnauthorizedError, "Only accept request for: %s" % \ app.config['computer_id'] +@app.route('/getFullComputerInformation', methods=['GET']) +def getFullComputerInformation(): + computer_id = request.args['computer_id'] + if app.config['computer_id'] == computer_id: + slap_computer = Computer(computer_id) + slap_computer._software_release_list = [] + for sr in execute_db('software', 'select * from %s'): + slap_computer._software_release_list.append(SoftwareRelease( + software_release=sr['url'], computer_guid=computer_id)) + slap_computer._computer_partition_list = [] + for partition in execute_db('partition', 'SELECT * FROM %s'): + slap_computer._computer_partition_list.append(partitiondict2partition( + partition)) + return xml_marshaller.xml_marshaller.dumps(slap_computer) + else: + raise UnauthorizedError, "Only accept request for: %s" % \ + app.config['computer_id'] + @app.route('/setComputerPartitionConnectionXml', methods=['POST']) def setComputerPartitionConnectionXml(): computer_id = request.form['computer_id'] diff --git a/slapos/register/__init__.py b/slapos/register/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f48ad10528712b2b8960f1863d156b88ed1ce311 --- /dev/null +++ b/slapos/register/__init__.py @@ -0,0 +1,6 @@ +# See http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages +try: + __import__('pkg_resources').declare_namespace(__name__) +except ImportError: + from pkgutil import extend_path + __path__ = extend_path(__path__, __name__) diff --git a/slapos/register/register.py b/slapos/register/register.py new file mode 100644 index 0000000000000000000000000000000000000000..4e73defab4d8f92551f376369930f5ba0de408be --- /dev/null +++ b/slapos/register/register.py @@ -0,0 +1,343 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (c) 2012 Vifib SARL and Contributors. All Rights Reserved. +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsibility of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# guarantees and support are strongly advised to contract a Free Software +# Service Company +# +# 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 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 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. +# +############################################################################## + + +import base64 +from getpass import getpass +import logging +from optparse import OptionParser, Option +import os +import pkg_resources +import shutil +import sys +import urllib2 + + +class SlapError(Exception): + """ + Slap error + """ + def __init__(self, message): + self.msg = message + +class UsageError(SlapError): + pass + +class ExecError(SlapError): + pass + +class Parser(OptionParser): + """ + Parse all arguments. + """ + def __init__(self, usage=None, version=None): + """ + Initialize all options possibles. + """ + OptionParser.__init__(self, usage=usage, version=version, + option_list=[ + Option("--interface-name", + help="Interface name to access internet", + default='eth0', + type=str), + Option("--master-url", + help="URL of vifib master", + default='https://slap.vifib.com', + type=str), + Option("--master-url-web", + help="URL of vifib master webservice to register certificates", + default='https://www.vifib.net', + type=str), + Option("--partition-number", + help="Number of partition on computer", + default='10', + type=int), + Option("--ipv4-local-network", + help="Base of ipv4 local network", + default='10.0.0.0/16', + type=str), + Option("--ipv6-interface", + help="Interface name to get ipv6", + default='', + type=str), + Option("--login", + help="User login on Vifib master webservice", + default=None, + type=str), + Option("--password", + help="User password on Vifib master webservice", + default=None, + type=str), + Option("-n", "--dry-run", + help="Simulate the execution steps", + default=False, + action="store_true"), + ]) + + def check_args(self): + """ + Check arguments + """ + (options, args) = self.parse_args() + if len(args) != 1: + self.error("Incorrect number of arguments") + node_name = args[0] + + if options.password != None and options.login == None : + self.error("Please enter your login with your password") + + if options.ipv6_interface != '' : + options.ipv6_interface = ('ipv6_interface = ' + options.ipv6_interface) + + return options, node_name + + +def get_login(): + """Get user id and encode it for basic identification""" + login = raw_input("Vifib Login: ") + password = getpass() + identification = base64.encodestring('%s:%s' % (login, password))[:-1] + return identification + + +def check_login(identification,master_url_web): + """Check if logged correctly on vifib""" + request = urllib2.Request(master_url_web) + # Prepare header for basic authentification + authheader = "Basic %s" % identification + request.add_header("Authorization", authheader) + home_page_url = urllib2.urlopen(request).read() + if 'Logout' in home_page_url: + return 1 + else : return 0 + + +def get_certificates(identification,node_name,master_url_web): + """Download certificates on vifib master""" + register_server_url = '/'.join([master_url_web, ("add-a-server/WebSection_registerNewComputer?dialog_id=WebSection_viewServerInformationDialog&dialog_method=WebSection_registerNewComputer&title={}&object_path=/erp5/web_site_module/hosting/add-a-server&update_method=&cancel_url=https%3A//www.vifib.net/add-a-server/WebSection_viewServerInformationDialog&Base_callDialogMethod=&field_your_title=Essai1&dialog_category=None&form_id=view".format(node_name))]) + request = urllib2.Request(register_server_url) + # Prepare header for basic authentification + authheader = "Basic %s" % identification + request.add_header("Authorization", authheader) + url = urllib2.urlopen(request) + page = url.read() + return page + + +def parse_certificates(source): + """Parse html gotten from vifib to make certificate and key files""" + c_start = source.find("Certificate:") + c_end = source.find("</textarea>",c_start) + k_start = source.find("-----BEGIN PRIVATE KEY-----") + k_end = source.find("</textarea>",k_start) + return [source[c_start:c_end],source[k_start:k_end]] + + +def get_computer_name(certificate): + """Parse certificate to get computer name and return it""" + k=certificate.find("COMP-") + i=certificate.find("/email",k) + return certificate[k:i] + +def save_former_config(config): + """Save former configuration if found""" + # Check for config file in /etc/opt/slapos/ + if os.path.exists('/etc/opt/slapos/slapos.cfg'): + former_slapos_configuration='/etc/opt/slapos' + else : former_slapos_configuration = 0 + if former_slapos_configuration: + saved_slapos_configuration = former_slapos_configuration + '.old' + while True: + if os.path.exists(saved_slapos_configuration): + print "Slapos configuration detected in %s" % saved_slapos_configuration + if saved_slapos_configuration[len(saved_slapos_configuration)-1]!= 'd' : + saved_slapos_configuration = saved_slapos_configuration[:len(saved_slapos_configuration)-1] \ + + str( int(saved_slapos_configuration[len(saved_slapos_configuration)-1])+1 ) + else : + saved_slapos_configuration += ".1" + else: break + config.logger.info( "Former slapos configuration detected in %s moving to %s" % (former_slapos_configuration,saved_slapos_configuration)) + shutil.move(former_slapos_configuration,saved_slapos_configuration) + + + +def slapconfig(config): + """Base Function to configure slapos in /etc/opt/slapos""" + dry_run = config.dry_run + try: + # Create slapos configuration directory if needed + slap_configuration_directory = os.path.normpath(config.slapos_configuration) + slap_configuration_file = os.path.join(slap_configuration_directory, 'slapos.cfg') + if not os.path.exists(slap_configuration_directory): + config.logger.info ("Creating directory: %s" % slap_configuration_directory) + if not dry_run: + os.mkdir(slap_configuration_directory, 0711) + + user_certificate_repository_path = os.path.join(slap_configuration_directory,'ssl') + if not os.path.exists(user_certificate_repository_path): + config.logger.info ("Creating directory: %s" % user_certificate_repository_path) + if not dry_run: + os.mkdir(user_certificate_repository_path, 0711) + + key_file = os.path.join(user_certificate_repository_path, 'key') + cert_file = os.path.join(user_certificate_repository_path, 'certificate') + for (src, dst) in [(config.key, key_file), (config.certificate, + cert_file)]: + config.logger.info ("Copying to %r, and setting minimum privileges" % dst) + if not dry_run: + destination = open(dst,'w') + destination.write(''.join(src)) + destination.close() + os.chmod(dst, 0600) + os.chown(dst, 0, 0) + + certificate_repository_path = os.path.join(slap_configuration_directory,'ssl','partition_pki') + if not os.path.exists(certificate_repository_path): + config.logger.info ("Creating directory: %s" % certificate_repository_path) + if not dry_run: + os.mkdir(certificate_repository_path, 0711) + + # Put slapgrid configuration file + config.logger.info ("Creating slap configuration: %s" % slap_configuration_file) + if not dry_run: + open(slap_configuration_file, 'w').write( + pkg_resources.resource_stream(__name__, + 'templates/slapos.cfg.in').read() % dict( + computer_id=config.computer_id, master_url=config.master_url, + key_file=key_file, cert_file=cert_file, + certificate_repository_path=certificate_repository_path, + partition_amount=config.partition_number, + interface=config.interface_name, + ipv4_network=config.ipv4_local_network, + ipv6_interface=config.ipv6_interface + )) + config.logger.info ("SlapOS configuration: DONE") + finally: + return 0 + +# Class containing all parameters needed for configuration +class Config: + def setConfig(self, option_dict, node_name): + """ + Set options given by parameters. + """ + # Set options parameters + for option, value in option_dict.__dict__.items(): + setattr(self, option, value) + self.node_name = node_name + + # Define logger for register + self.logger = logging.getLogger('Register') + self.logger.setLevel(logging.DEBUG) + # create console handler and set level to debug + self.ch = logging.StreamHandler() + self.ch.setLevel(logging.INFO) + # create formatter + self.formatter = logging.Formatter('%(levelname)s - %(message)s') + # add formatter to ch + self.ch.setFormatter(self.formatter) + # add ch to logger + self.logger.addHandler(self.ch) + + + + def COMPConfig(self, slapos_configuration, + computer_id, + certificate, + key): + self.slapos_configuration= slapos_configuration + self.computer_id=computer_id + self.certificate=certificate + self.key=key + + def displayUserConfig(self): + self.logger.debug ("Computer Name : %s" % self.node_name) + self.logger.debug ("Master URL: %s" % self.master_url) + self.logger.debug ("Number of partition: %s" % self.partition_number) + self.logger.debug ("Interface Name: %s" % self.interface_name) + self.logger.debug ("Ipv4 sub network: %s" % self.ipv4_local_network) + self.logger.debug ("Ipv6 Interface: %s" %self.ipv6_interface) + +def register(config): + """Register new computer on VIFIB and generate slapos.cfg""" + # Get User identification and check them + if config.login == None : + while True : + print ("Please enter your Vifib login") + user_id = get_login() + if check_login(user_id,config.master_url_web): break + config.logger.warning ("Wrong login/password") + elif config.password == None : + if not check_login(base64.encodestring('%s:%s' % (config.login,getpass()))[:-1],config.master_url_web): + config.logger.error ("Wrong login/password") + return 1 + else: + if not check_login(base64.encodestring('%s:%s' % (config.login,config.password))[:-1],config.master_url_web): + config.logger.error ("Wrong login/password") + return 1 + # Get source code of page having certificate and key + certificate_key = get_certificates(user_id,config.node_name,config.master_url_web) + # Parse certificate and key and get computer id + certificate_key = parse_certificates(certificate_key) + certificate = certificate_key[0] + key = certificate_key[1] + COMP = get_computer_name(certificate) + # Getting configuration parameters + slapos_configuration='/etc/opt/slapos/' + config.COMPConfig(slapos_configuration=slapos_configuration, + computer_id=COMP, + certificate = certificate, + key = key + ) + # Save former configuration + if not config.dry_run: + save_former_config(config) + # Prepare Slapos Configuration + slapconfig(config) + return 0 + +def main(): + "Run default configuration." + usage = "usage: slapos node %s NODE_NAME [options] " % sys.argv[0] + try: + # Parse arguments + config = Config() + config.setConfig(*Parser(usage=usage).check_args()) + return_code = register(config) + except UsageError, err: + print >>sys.stderr, err.msg + print >>sys.stderr, "For help use --help" + return_code = 16 + except ExecError, err: + print >>sys.stderr, err.msg + return_code = 16 + except SystemExit, err: + # Catch exception raise by optparse + return_code = err + + sys.exit(return_code) diff --git a/slapos/register/templates/slapos.cfg.in b/slapos/register/templates/slapos.cfg.in new file mode 100644 index 0000000000000000000000000000000000000000..24fe568c966bb07598ad31749493669486033e34 --- /dev/null +++ b/slapos/register/templates/slapos.cfg.in @@ -0,0 +1,128 @@ +[slapos] +software_root = /opt/slapgrid +instance_root = /srv/slapgrid +master_url = %(master_url)s +computer_id = %(computer_id)s +key_file = %(key_file)s +cert_file = %(cert_file)s +certificate_repository_path = %(certificate_repository_path)s + +[slapformat] +interface_name = %(interface)s +computer_xml = /opt/slapos/slapos.xml +log_file = /opt/slapos/slapformat.log +create_tap = false +partition_amount = %(partition_amount)s +partition_base_name = slappart +user_base_name = slapuser +tap_base_name = slaptap +# You can choose any other local network which does not conflict with your +# current machine configuration +ipv4_local_network = %(ipv4_network)s +%(ipv6_interface)s + +[networkcache] +# Define options for binary cache, used to download already compiled software. +download-binary-cache-url = http://www.shacache.org/shacache +download-cache-url = https://www.shacache.org/shacache +download-binary-dir-url = http://www.shacache.org/shadir +# List of signatures of uploaders we trust: +# Romain Courteaud +# Sebastien Robin +# Kazuhiko Shiozaki +# Cedric de Saint Martin +# Yingjie Xu +# Gabriel Monnerat +# Åukasz Nowak +signature-certificate-list = + -----BEGIN CERTIFICATE----- + MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE + CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5 + MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl + ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF + AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw + boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX + Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA + ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX + mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC + q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g + QUUGLQ== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB8jCCAVugAwIBAgIJAPu2zchZ2BxoMA0GCSqGSIb3DQEBBQUAMBIxEDAOBgNV + BAMMB3RzeGRldjMwHhcNMTExMDE0MTIxNjIzWhcNMTIxMDEzMTIxNjIzWjASMRAw + DgYDVQQDDAd0c3hkZXYzMIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrPbh+ + YGmo6mWmhVb1vTqX0BbeU0jCTB8TK3i6ep3tzSw2rkUGSx3niXn9LNTFNcIn3MZN + XHqbb4AS2Zxyk/2tr3939qqOrS4YRCtXBwTCuFY6r+a7pZsjiTNddPsEhuj4lEnR + L8Ax5mmzoi9nE+hiPSwqjRwWRU1+182rzXmN4QIDAQABo1AwTjAdBgNVHQ4EFgQU + /4XXREzqBbBNJvX5gU8tLWxZaeQwHwYDVR0jBBgwFoAU/4XXREzqBbBNJvX5gU8t + LWxZaeQwDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0BAQUFAAOBgQA07q/rKoE7fAda + FED57/SR00OvY9wLlFEF2QJ5OLu+O33YUXDDbGpfUSF9R8l0g9dix1JbWK9nQ6Yd + R/KCo6D0sw0ZgeQv1aUXbl/xJ9k4jlTxmWbPeiiPZEqU1W9wN5lkGuLxV4CEGTKU + hJA/yXa1wbwIPGvX3tVKdOEWPRXZLg== + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB7jCCAVegAwIBAgIJAJWA0jQ4o9DGMA0GCSqGSIb3DQEBBQUAMA8xDTALBgNV + BAMMBHg2MXMwIBcNMTExMTI0MTAyNDQzWhgPMjExMTEwMzExMDI0NDNaMA8xDTAL + BgNVBAMMBHg2MXMwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANdJNiFsRlkH + vq2kHP2zdxEyzPAWZH3CQ3Myb3F8hERXTIFSUqntPXDKXDb7Y/laqjMXdj+vptKk + 3Q36J+8VnJbSwjGwmEG6tym9qMSGIPPNw1JXY1R29eF3o4aj21o7DHAkhuNc5Tso + 67fUSKgvyVnyH4G6ShQUAtghPaAwS0KvAgMBAAGjUDBOMB0GA1UdDgQWBBSjxFUE + RfnTvABRLAa34Ytkhz5vPzAfBgNVHSMEGDAWgBSjxFUERfnTvABRLAa34Ytkhz5v + PzAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAFLDS7zNhlrQYSQO5KIj + z2RJe3fj4rLPklo3TmP5KLvendG+LErE2cbKPqnhQ2oVoj6u9tWVwo/g03PMrrnL + KrDm39slYD/1KoE5kB4l/p6KVOdeJ4I6xcgu9rnkqqHzDwI4v7e8/D3WZbpiFUsY + vaZhjNYKWQf79l6zXfOvphzJ + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT + MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB + D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1 + P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O + BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp + cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr + b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV + Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby + If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAIlBksrZVkK8MA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMzU3MCAXDTEyMDEyNjEwNTUyOFoYDzIxMTIwMTAyMTA1NTI4WjAT + MREwDwYDVQQDDAhDT01QLTM1NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + ts+iGUwi44vtIfwXR8DCnLtHV4ydl0YTK2joJflj0/Ws7mz5BYkxIU4fea/6+VF3 + i11nwBgYgxQyjNztgc9u9O71k1W5tU95yO7U7bFdYd5uxYA9/22fjObaTQoC4Nc9 + mTu6r/VHyJ1yRsunBZXvnk/XaKp7gGE9vNEyJvPn2bkCAwEAAaNQME4wHQYDVR0O + BBYEFKuGIYu8+6aEkTVg62BRYaD11PILMB8GA1UdIwQYMBaAFKuGIYu8+6aEkTVg + 62BRYaD11PILMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAMoTRpBxK + YLEZJbofF7gSrRIcrlUJYXfTfw1QUBOKkGFFDsiJpEg4y5pUk1s5Jq9K3SDzNq/W + it1oYjOhuGg3al8OOeKFrU6nvNTF1BAvJCl0tr3POai5yXyN5jlK/zPfypmQYxE+ + TaqQSGBJPVXYt6lrq/PRD9ciZgKLOwEqK8w= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAPHoWu90gbsgMA0GCSqGSIb3DQEBBQUAMBQxEjAQBgNV + BAMMCXZpZmlibm9kZTAeFw0xMjAzMTkyMzIwNTVaFw0xMzAzMTkyMzIwNTVaMBQx + EjAQBgNVBAMMCXZpZmlibm9kZTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + ozBijpO8PS5RTeKTzA90vi9ezvv4vVjNaguqT4UwP9+O1+i6yq1Y2W5zZxw/Klbn + oudyNzie3/wqs9VfPmcyU9ajFzBv/Tobm3obmOqBN0GSYs5fyGw+O9G3//6ZEhf0 + NinwdKmrRX+d0P5bHewadZWIvlmOupcnVJmkks852BECAwEAAaNQME4wHQYDVR0O + BBYEFF9EtgfZZs8L2ZxBJxSiY6eTsTEwMB8GA1UdIwQYMBaAFF9EtgfZZs8L2ZxB + JxSiY6eTsTEwMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAc43YTfc6 + baSemaMAc/jz8LNLhRE5dLfLOcRSoHda8y0lOrfe4lHT6yP5l8uyWAzLW+g6s3DA + Yme/bhX0g51BmI6gjKJo5DoPtiXk/Y9lxwD3p7PWi+RhN+AZQ5rpo8UfwnnN059n + yDuimQfvJjBFMVrdn9iP6SfMjxKaGk6gVmI= + -----END CERTIFICATE----- + -----BEGIN CERTIFICATE----- + MIIB9jCCAV+gAwIBAgIJAMNZBmoIOXPBMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV + BAMMCENPTVAtMTMyMCAXDTEyMDUwMjEyMDQyNloYDzIxMTIwNDA4MTIwNDI2WjAT + MREwDwYDVQQDDAhDT01QLTEzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA + 6peZQt1sAmMAmSG9BVxxcXm8x15kE9iAplmANYNQ7z2YO57c10jDtlYlwVfi/rct + xNUOKQtc8UQtV/fJWP0QT0GITdRz5X/TkWiojiFgkopza9/b1hXs5rltYByUGLhg + 7JZ9dZGBihzPfn6U8ESAKiJzQP8Hyz/o81FPfuHCftsCAwEAAaNQME4wHQYDVR0O + BBYEFNuxsc77Z6/JSKPoyloHNm9zF9yqMB8GA1UdIwQYMBaAFNuxsc77Z6/JSKPo + yloHNm9zF9yqMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAl4hBaJy1 + cgiNV2+Z5oNTrHgmzWvSY4duECOTBxeuIOnhql3vLlaQmo0p8Z4c13kTZq2s3nhd + Loe5mIHsjRVKvzB6SvIaFUYq/EzmHnqNdpIGkT/Mj7r/iUs61btTcGUCLsUiUeci + Vd0Ozh79JSRpkrdI8R/NRQ2XPHAo+29TT70= + -----END CERTIFICATE----- diff --git a/slapos/slap/__init__.py b/slapos/slap/__init__.py index 7ff618156c5ec5d0ed9b15b4d8ff77effdc6f9e4..0fb119e80dc0cbaa5e364e2792c4354d0ce973f3 100644 --- a/slapos/slap/__init__.py +++ b/slapos/slap/__init__.py @@ -1,6 +1,7 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -10,8 +11,8 @@ # Service Company # # 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 3 +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -19,7 +20,7 @@ # 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 +# You should have received a copy of the GNU Lesser 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. # diff --git a/slapos/slap/interface/__init__.py b/slapos/slap/interface/__init__.py index c1fb153d21a2e5266b62d21084a732c1bc65eaea..bc0a327d8a433e05d0127c4bfbe050a29329ecda 100644 --- a/slapos/slap/interface/__init__.py +++ b/slapos/slap/interface/__init__.py @@ -1,6 +1,7 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -10,8 +11,8 @@ # Service Company # # 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 3 +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -19,7 +20,7 @@ # 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 +# You should have received a copy of the GNU Lesser 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. # diff --git a/slapos/slap/interface/slap.py b/slapos/slap/interface/slap.py index 744ab3ea197ac2eb9fadb5352ded5fb4140bdce9..a909fa283cfbef3a451c5e6f334275b68b4a164b 100644 --- a/slapos/slap/interface/slap.py +++ b/slapos/slap/interface/slap.py @@ -1,6 +1,7 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -10,8 +11,8 @@ # Service Company # # 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 3 +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -19,7 +20,7 @@ # 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 +# You should have received a copy of the GNU Lesser 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. # @@ -52,7 +53,7 @@ class IRequester(Interface): slapgrid server. """ - def request(software_release, software_type, partition_reference, + def request(software_release, software_type, partition_reference, shared=False, partition_parameter_kw=None, filter_kw=None): """ Request software release instanciation to slapgrid server. @@ -92,13 +93,13 @@ class IBuildoutController(Interface): def available(): """ - Notify (to the slapgrid server) that the software instance is + Notify (to the slapgrid server) that the software instance is available. """ def building(): """ - Notify (to the slapgrid server) that the buildout is not + Notify (to the slapgrid server) that the buildout is not available and under creation. """ @@ -121,6 +122,20 @@ class ISoftwareRelease(IBuildoutController): Returns a string representing the uri of the software release. """ + def getState(): + """ + Returns a string representing the expected state of the software + installation. + + The result can be: available, destroyed + """ + + def destroyed(): + """ + Notify (to the slapgrid server) that the software installation has + been correctly destroyed. + """ + class IComputerPartition(IBuildoutController, IRequester): """ Computer Partition interface specification @@ -132,13 +147,13 @@ class IComputerPartition(IBuildoutController, IRequester): def stopped(): """ - Notify (to the slapgrid server) that the software instance is + Notify (to the slapgrid server) that the software instance is available and stopped. """ def started(): """ - Notify (to the slapgrid server) that the software instance is + Notify (to the slapgrid server) that the software instance is available and started. """ @@ -176,6 +191,13 @@ class IComputerPartition(IBuildoutController, IRequester): profile. """ + def getConnectionParameterDict(): + """ + Returns a dictionary of connection parameters. + + The contained values are connection parameters of a compute partition. + """ + def setUsage(usage_log): """ Associate a usage log to the computer partition. @@ -194,6 +216,55 @@ class IComputerPartition(IBuildoutController, IRequester): log -- a text explaining why the method was called """ + def getCertificate(): + """ + Returns a dictionnary containing the authentification certificates + associated to the computer partition. + The dictionnary keys are: + key -- value is a SSL key + certificate -- value is a SSL certificate + + Raise an INotFoundError if no software release is associated. + """ + + def setConnectionDict(connection_dict, slave_reference=None): + """ + Store the connection parameters associated to a partition. + + connection_dict -- dictionary of parameter used to fill the + connection dict of the partition. + + slave_reference -- current reference of the slave instance to modify + """ + + def getInstanceParameter(key): + """ + Returns the instance parameter associated to the key. + + Raise an INotFoundError if no key is defined. + + key -- a string name of the parameter + """ + + def getConnectionParameter(key): + """ + Return the connection parameter associate to the key. + + Raise an INotFoundError if no key is defined. + + key -- a string name of the parameter + """ + + def rename(partition_reference, slave_reference=None): + """ + Change the partition reference of a partition + + partition_reference -- new local reference of the instance used by the recipe + to identify the instances. + + slave_reference -- current reference of the slave instance to modify + """ + class IComputer(Interface): """ Computer interface specification @@ -203,7 +274,7 @@ class IComputer(Interface): installed. """ - def getSoftwareReleaseList(): + def getSoftwareReleaseList(): """ Returns the list of software release which has to be supplied by the computer. @@ -211,7 +282,7 @@ class IComputer(Interface): Raise an INotFoundError if computer_guid doesn't exist. """ - def getComputerPartitionList(): + def getComputerPartitionList(): """ Returns the list of configured computer partitions associated to this computer. @@ -221,7 +292,7 @@ class IComputer(Interface): def reportUsage(computer_partition_list): """ - Report the computer usage to the slapgrid server. + Report the computer usage to the slapgrid server. IComputerPartition.setUsage has to be called on each computer partition to define each usage. @@ -238,6 +309,13 @@ class IComputer(Interface): log -- a text explaining why the method was called """ + def updateConfiguration(configuration_xml): + """ + Report the current computer configuration. + + configuration_xml -- computer XML description generated by slapformat + """ + class IOpenOrder(IRequester): """ Open Order interface specification @@ -261,7 +339,7 @@ class ISupply(Interface): software_release -- uri of the software release which has to be instanciated - computer_guid -- the identifier of the computer inside the slapgrid + computer_guid -- the identifier of the computer inside the slapgrid server. """ @@ -269,7 +347,7 @@ class slap(Interface): """ Initialise slap connection to the slapgrid server - Slapgrid server URL is defined during the slap library installation, + Slapgrid server URL is defined during the slap library installation, as recipes should not use another server. """ @@ -297,7 +375,7 @@ class slap(Interface): computer_guid -- the identifier of the computer inside the slapgrid server. - partition_id -- the identifier of the computer partition inside the + partition_id -- the identifier of the computer partition inside the slapgrid server. Raise an INotFoundError if computer_guid doesn't exist. @@ -314,8 +392,8 @@ class slap(Interface): """ Instanciate an open order in the slap library. """ - + def registerSupply(): - """ + """ Instanciate a supply in the slap library. """ diff --git a/slapos/slap/slap.py b/slapos/slap/slap.py index 7e663623c3e617e933a2a80493553a5f17d0682e..64e67367274683e425f811818205955da7fe2aaf 100644 --- a/slapos/slap/slap.py +++ b/slapos/slap/slap.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -11,8 +12,8 @@ # Service Company # # 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 3 +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -20,14 +21,14 @@ # 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 +# You should have received a copy of the GNU Lesser 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. # ############################################################################## __all__ = ["slap", "ComputerPartition", "Computer", "SoftwareRelease", "Supply", "OpenOrder", "NotFoundError", "Unauthorized", - "ResourceNotReady"] + "ResourceNotReady", "ServerError"] from interface import slap as interface from xml_marshaller import xml_marshaller @@ -42,6 +43,8 @@ import zope.interface Simple, easy to (un)marshall classes for slap client/server communication """ +DEFAULT_SOFTWARE_TYPE = 'default' + # httplib.HTTPSConnection with key verification class HTTPSConnectionCA(httplib.HTTPSConnection): """Patched version of HTTPSConnection which verifies server certificate""" @@ -64,7 +67,11 @@ class HTTPSConnectionCA(httplib.HTTPSConnection): class SlapDocument: - pass + def __init__(self, connection_helper=None): + if connection_helper is not None: + # Do not require connection_helper to be provided, but when it's not, + # cause failures when accessing _connection_helper property. + self._connection_helper = connection_helper class SoftwareRelease(SlapDocument): """ @@ -79,6 +86,7 @@ class SoftwareRelease(SlapDocument): XXX **kw args only kept for compatibility """ + SlapDocument.__init__(self, kw.pop('connection_helper', None)) self._software_instance_list = [] if software_release is not None: software_release = software_release.encode('UTF-8') @@ -100,17 +108,17 @@ class SoftwareRelease(SlapDocument): def available(self): self._connection_helper.POST('/availableSoftwareRelease', { - 'url': self._software_release, + 'url': self._software_release, 'computer_id': self._computer_guid}) def building(self): self._connection_helper.POST('/buildingSoftwareRelease', { - 'url': self._software_release, + 'url': self._software_release, 'computer_id': self._computer_guid}) def destroyed(self): self._connection_helper.POST('/destroyedSoftwareRelease', { - 'url': self._software_release, + 'url': self._software_release, 'computer_id': self._computer_guid}) def getState(self): @@ -176,16 +184,24 @@ class OpenOrder(SlapDocument): } if software_type is not None: request_dict['software_type'] = software_type + else: + # Let's enforce a default software type + request_dict['software_type'] = DEFAULT_SOFTWARE_TYPE try: self._connection_helper.POST('/requestComputerPartition', request_dict) except ResourceNotReady: - return ComputerPartition(request_dict=request_dict) + return ComputerPartition( + request_dict=request_dict, + connection_helper=self._connection_helper, + ) else: xml = self._connection_helper.response.read() software_instance = xml_marshaller.loads(xml) computer_partition = ComputerPartition( software_instance.slap_computer_id.encode('UTF-8'), - software_instance.slap_computer_partition_id.encode('UTF-8')) + software_instance.slap_computer_partition_id.encode('UTF-8'), + connection_helper=self._connection_helper, + ) if shared: computer_partition._synced = True computer_partition._connection_dict = software_instance._connection_dict @@ -197,21 +213,32 @@ def _syncComputerInformation(func): Synchronize computer object with server information """ def decorated(self, *args, **kw): - computer = self._connection_helper.getComputerInformation(self._computer_id) + if getattr(self, '_synced', 0): + return func(self, *args, **kw) + # XXX: This is a ugly way to keep backward compatibility, + # We should stablise slap library soon. + try: + computer = self._connection_helper.getFullComputerInformation(self._computer_id) + except NotFoundError: + computer = self._connection_helper.getComputerInformation(self._computer_id) for key, value in computer.__dict__.items(): if isinstance(value, unicode): # convert unicode to utf-8 setattr(self, key, value.encode('utf-8')) else: setattr(self, key, value) + setattr(self, '_synced', True) + for computer_partition in self.getComputerPartitionList(): + setattr(computer_partition, '_synced', True) return func(self, *args, **kw) - return decorated + return decorated class Computer(SlapDocument): zope.interface.implements(interface.IComputer) - def __init__(self, computer_id): + def __init__(self, computer_id, connection_helper=None): + SlapDocument.__init__(self, connection_helper) self._computer_id = computer_id def __getinitargs__(self): @@ -225,10 +252,14 @@ class Computer(SlapDocument): Raise an INotFoundError if computer_guid doesn't exist. """ + for software_relase in self._software_release_list: + software_relase._connection_helper = self._connection_helper return self._software_release_list @_syncComputerInformation def getComputerPartitionList(self): + for computer_partition in self._computer_partition_list: + computer_partition._connection_helper = self._connection_helper return [x for x in self._computer_partition_list if x._need_modification] def reportUsage(self, computer_usage): @@ -255,7 +286,12 @@ def _syncComputerPartitionInformation(func): def decorated(self, *args, **kw): if getattr(self, '_synced', 0): return func(self, *args, **kw) - computer = self._connection_helper.getComputerInformation(self._computer_id) + # XXX: This is a ugly way to keep backward compatibility, + # We should stablise slap library soon. + try: + computer = self._connection_helper.getFullComputerInformation(self._computer_id) + except NotFoundError: + computer = self._connection_helper.getComputerInformation(self._computer_id) found_computer_partition = None for computer_partition in computer._computer_partition_list: if computer_partition.getId() == self.getId(): @@ -290,6 +326,7 @@ def _syncComputerPartitionInformation(func): setattr(self, key, new_dict) else: setattr(self, key, value) + setattr(self, '_synced', True) return func(self, *args, **kw) return decorated @@ -298,7 +335,9 @@ class ComputerPartition(SlapDocument): zope.interface.implements(interface.IComputerPartition) - def __init__(self, computer_id=None, partition_id=None, request_dict=None): + def __init__(self, computer_id=None, partition_id=None, request_dict=None, + connection_helper=None): + SlapDocument.__init__(self, connection_helper) if request_dict is not None and (computer_id is not None or partition_id is not None): raise TypeError('request_dict conflicts with computer_id and ' @@ -334,6 +373,10 @@ class ComputerPartition(SlapDocument): raise ValueError("Unexpected type of filter_kw '%s'" % \ filter_kw) + # Let enforce a default software type + if software_type is None: + software_type = DEFAULT_SOFTWARE_TYPE + request_dict = { 'computer_id': self._computer_id, 'computer_partition_id': self._partition_id, 'software_release': software_release, @@ -348,13 +391,18 @@ class ComputerPartition(SlapDocument): try: self._connection_helper.POST('/requestComputerPartition', request_dict) except ResourceNotReady: - return ComputerPartition(request_dict=request_dict) + return ComputerPartition( + request_dict=request_dict, + connection_helper=self._connection_helper, + ) else: xml = self._connection_helper.response.read() software_instance = xml_marshaller.loads(xml) computer_partition = ComputerPartition( software_instance.slap_computer_id.encode('UTF-8'), - software_instance.slap_computer_partition_id.encode('UTF-8')) + software_instance.slap_computer_partition_id.encode('UTF-8'), + connection_helper=self._connection_helper, + ) if shared: computer_partition._synced = True computer_partition._connection_dict = getattr(software_instance, @@ -424,6 +472,10 @@ class ComputerPartition(SlapDocument): def getInstanceParameterDict(self): return getattr(self, '_parameter_dict', None) or {} + @_syncComputerPartitionInformation + def getConnectionParameterDict(self): + return getattr(self, '_connection_dict', None) or {} + @_syncComputerPartitionInformation def getSoftwareRelease(self): """ @@ -436,11 +488,20 @@ class ComputerPartition(SlapDocument): return self._software_release_document def setConnectionDict(self, connection_dict, slave_reference=None): - self._connection_helper.POST('/setComputerPartitionConnectionXml', { - 'computer_id': self._computer_id, - 'computer_partition_id': self._partition_id, - 'connection_xml': xml_marshaller.dumps(connection_dict), - 'slave_reference': slave_reference}) + if self.getConnectionParameterDict() != connection_dict: + self._connection_helper.POST('/setComputerPartitionConnectionXml', { + 'computer_id': self._computer_id, + 'computer_partition_id': self._partition_id, + 'connection_xml': xml_marshaller.dumps(connection_dict), + 'slave_reference': slave_reference}) + + @_syncComputerPartitionInformation + def getInstanceParameter(self, key): + parameter_dict = getattr(self, '_parameter_dict', None) or {} + if key in parameter_dict: + return parameter_dict[key] + else: + raise NotFoundError("%s not found" % key) @_syncComputerPartitionInformation def getConnectionParameter(self, key): @@ -473,7 +534,7 @@ class ComputerPartition(SlapDocument): # result = func(self, *args, **kw) # setattr(self, key, result) # return result -# return decorated +# return decorated class ConnectionHelper: error_message_timeout = "\nThe connection timed out. Please try again later." @@ -497,6 +558,10 @@ class ConnectionHelper: self.GET('/getComputerInformation?computer_id=%s' % computer_id) return xml_marshaller.loads(self.response.read()) + def getFullComputerInformation(self, computer_id): + self.GET('/getFullComputerInformation?computer_id=%s' % computer_id) + return xml_marshaller.loads(self.response.read()) + def connect(self): connection_dict = dict( host=self.host) @@ -522,6 +587,8 @@ class ConnectionHelper: raise socket.error(str(e) + self.error_message_timeout) raise ssl.SSLError(str(e) + self.ssl_error_message_connect_fail) except socket.error, e: + if e.message == "timed out": + raise socket.error(str(e) + self.error_message_timeout) raise socket.error(self.error_message_connect_fail + str(e)) # check self.response.status and raise exception early if self.response.status == httplib.REQUEST_TIMEOUT: @@ -575,55 +642,40 @@ class slap: def initializeConnection(self, slapgrid_uri, key_file=None, cert_file=None, master_ca_file=None, timeout=60): - self._initialiseConnectionHelper(slapgrid_uri, key_file, cert_file, - master_ca_file, timeout) - - def _initialiseConnectionHelper(self, slapgrid_uri, key_file, cert_file, - master_ca_file, timeout): - SlapDocument._slapgrid_uri = slapgrid_uri scheme, netloc, path, query, fragment = urlparse.urlsplit( - SlapDocument._slapgrid_uri) + slapgrid_uri) if not(query == '' and fragment == ''): raise AttributeError('Passed URL %r issue: not parseable'% - SlapDocument._slapgrid_uri) - if scheme not in ('http', 'https'): - raise AttributeError('Passed URL %r issue: there is no support for %r p' - 'rotocol' % (SlapDocument._slapgrid_uri, scheme)) + slapgrid_uri) if scheme == 'http': connection_wrapper = httplib.HTTPConnection - else: + elif scheme == 'https': if master_ca_file is not None: connection_wrapper = HTTPSConnectionCA else: connection_wrapper = httplib.HTTPSConnection - slap._connection_helper = \ - SlapDocument._connection_helper = ConnectionHelper(connection_wrapper, + else: + raise AttributeError('Passed URL %r issue: there is no support for %r p' + 'rotocol' % (slapgrid_uri, scheme)) + self._connection_helper = ConnectionHelper(connection_wrapper, netloc, path, key_file, cert_file, master_ca_file, timeout) - def _register(self, klass, *registration_argument_list): - if len(registration_argument_list) == 1 and type( - registration_argument_list[0]) == type([]): - # in case if list is explicitly passed and there is only one - # argument in registration convert it to list - registration_argument_list = registration_argument_list[0] - document = klass(*registration_argument_list) - return document - def registerSoftwareRelease(self, software_release): """ Registers connected representation of software release and returns SoftwareRelease class object """ - return SoftwareRelease(software_release=software_release) + return SoftwareRelease(software_release=software_release, + connection_helper=self._connection_helper, + ) def registerComputer(self, computer_guid): """ Registers connected representation of computer and returns Computer class object """ - self.computer_guid = computer_guid - return self._register(Computer, computer_guid) + return Computer(computer_guid, connection_helper=self._connection_helper) def registerComputerPartition(self, computer_guid, partition_id): """ @@ -633,11 +685,14 @@ class slap: self._connection_helper.GET('/registerComputerPartition?' \ 'computer_reference=%s&computer_partition_reference=%s' % ( computer_guid, partition_id)) - xml = self._connection_helper.response.read() - return xml_marshaller.loads(xml) + result = xml_marshaller.loads(self._connection_helper.response.read()) + # XXX: dirty hack to make computer partition usable. xml_marshaller is too + # low-level for our needs here. + result._connection_helper = self._connection_helper + return result def registerOpenOrder(self): - return OpenOrder() + return OpenOrder(connection_helper=self._connection_helper) def registerSupply(self): - return Supply() + return Supply(connection_helper=self._connection_helper) diff --git a/slapos/slap/tests/__init__.py b/slapos/slap/tests/__init__.py index c1fb153d21a2e5266b62d21084a732c1bc65eaea..bc0a327d8a433e05d0127c4bfbe050a29329ecda 100644 --- a/slapos/slap/tests/__init__.py +++ b/slapos/slap/tests/__init__.py @@ -1,6 +1,7 @@ ############################################################################## # -# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. +# Copyright (c) 2010, 2011, 2012 Vifib SARL and Contributors. +# All Rights Reserved. # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsibility of assessing all potential @@ -10,8 +11,8 @@ # Service Company # # 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 3 +# modify it under the terms of the GNU Lesser General Public License +# as published by the Free Software Foundation; either version 2.1 # of the License, or (at your option) any later version. # # This program is distributed in the hope that it will be useful, @@ -19,7 +20,7 @@ # 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 +# You should have received a copy of the GNU Lesser 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. # diff --git a/slapos/tests/slap.py b/slapos/tests/slap.py index cb8d215317112bb389dfc80fc578ec5e203c858f..46b5c3e791cf89541041ac64a1c9bf8cfcd51b68 100644 --- a/slapos/tests/slap.py +++ b/slapos/tests/slap.py @@ -45,6 +45,7 @@ class SlapMixin(unittest.TestCase): self.server_url = 'http://localhost/' else: self.server_url = self._server_url + print 'Testing against SLAP server %r' % self.server_url def tearDown(self): if self._server_url is None: @@ -81,7 +82,7 @@ class TestSlap(SlapMixin): def test_slap_initialisation(self): """ - Asserts that slap initialisation works properly in case of + Asserts that slap initialisation works properly in case of passing correct url """ slap_instance = slapos.slap.slap() @@ -91,17 +92,17 @@ class TestSlap(SlapMixin): def test_slap_initialisation_wrong_url(self): """ - Asserts that slap initialisation raises exception when passed url + Asserts that slap initialisation raises exception when passed url is not correct """ server_url = 'https://user:pass@server/path/path?parameter=notAcceptable' slap_instance = slapos.slap.slap() - self.assertRaises(AttributeError, + self.assertRaises(AttributeError, slap_instance.initializeConnection, server_url) def test_registerComputer_with_new_guid(self): """ - Asserts that calling slap.registerComputer with new guid returns + Asserts that calling slap.registerComputer with new guid returns Computer object """ computer_guid = self._getTestComputerId() @@ -112,7 +113,7 @@ class TestSlap(SlapMixin): def test_registerComputer_with_existing_guid(self): """ - Asserts that calling slap.registerComputer with already used guid + Asserts that calling slap.registerComputer with already used guid returns Computer object """ computer_guid = self._getTestComputerId() @@ -128,7 +129,7 @@ class TestSlap(SlapMixin): # SoftwareRelease is currently used as suboject of Slap transmission object def test_registerSoftwareRelease_with_new_uri(self): """ - Asserts that calling slap.registerSoftwareRelease with new guid + Asserts that calling slap.registerSoftwareRelease with new guid returns SoftwareRelease object """ software_release_uri = 'http://server/' + self._getTestComputerId() @@ -140,7 +141,7 @@ class TestSlap(SlapMixin): def test_registerSoftwareRelease_with_existing_uri(self): """ - Asserts that calling slap.registerSoftwareRelease with already + Asserts that calling slap.registerSoftwareRelease with already used guid returns SoftwareRelease object """ software_release_uri = 'http://server/' + self._getTestComputerId() @@ -156,7 +157,7 @@ class TestSlap(SlapMixin): def test_registerComputerPartition_new_partition_id_known_computer_guid(self): """ - Asserts that calling slap.registerComputerPartition on known computer + Asserts that calling slap.registerComputerPartition on known computer returns ComputerPartition object """ self.computer_guid = self._getTestComputerId() @@ -165,13 +166,13 @@ class TestSlap(SlapMixin): self.partition_id = 'PARTITION_01' self.slap.registerComputer(self.computer_guid) - partition = self.slap.registerComputerPartition(self.computer_guid, + partition = self.slap.registerComputerPartition(self.computer_guid, self.partition_id) self.assertTrue(isinstance(partition, slapos.slap.ComputerPartition)) def test_registerComputerPartition_existing_partition_id_known_computer_guid(self): """ - Asserts that calling slap.registerComputerPartition on known computer + Asserts that calling slap.registerComputerPartition on known computer returns ComputerPartition object """ self.test_registerComputerPartition_new_partition_id_known_computer_guid() @@ -181,7 +182,7 @@ class TestSlap(SlapMixin): def test_registerComputerPartition_unknown_computer_guid(self): """ - Asserts that calling slap.registerComputerPartition on unknown + Asserts that calling slap.registerComputerPartition on unknown computer raises (not defined yet) exception """ computer_guid = self._getTestComputerId() @@ -211,7 +212,7 @@ class TestComputer(SlapMixin): def test_computer_getComputerPartitionList_only_partition(self): """ - Asserts that calling Computer.getComputerPartitionList with only + Asserts that calling Computer.getComputerPartitionList with only Computer Partitions returns empty list """ self.computer_guid = self._getTestComputerId() @@ -225,7 +226,7 @@ class TestComputer(SlapMixin): def test_computer_reportUsage_non_valid_xml_raises(self): """ - Asserts that calling Computer.reportUsage with non DTD + Asserts that calling Computer.reportUsage with non DTD (not defined yet) XML raises (not defined yet) exception """ self.computer_guid = self._getTestComputerId() @@ -240,7 +241,7 @@ class TestComputer(SlapMixin): def test_computer_reportUsage_valid_xml_invalid_partition_raises(self): """ - Asserts that calling Computer.reportUsage with DTD (not defined + Asserts that calling Computer.reportUsage with DTD (not defined yet) XML which refers to invalid partition raises (not defined yet) exception """ @@ -429,7 +430,7 @@ class TestComputerPartition(SlapMixin): def _test_new_computer_partition_state(self, state): """ - Helper method to automate assertions of failing states on new Computer + Helper method to automate assertions of failing states on new Computer Partition """ self.computer_guid = self._getTestComputerId() @@ -443,28 +444,28 @@ class TestComputerPartition(SlapMixin): def test_available_new_ComputerPartition_raises(self): """ - Asserts that calling ComputerPartition.available on new partition + Asserts that calling ComputerPartition.available on new partition raises (not defined yet) exception """ self._test_new_computer_partition_state('available') def test_building_new_ComputerPartition_raises(self): """ - Asserts that calling ComputerPartition.building on new partition raises + Asserts that calling ComputerPartition.building on new partition raises (not defined yet) exception """ self._test_new_computer_partition_state('building') def test_started_new_ComputerPartition_raises(self): """ - Asserts that calling ComputerPartition.started on new partition raises + Asserts that calling ComputerPartition.started on new partition raises (not defined yet) exception """ self._test_new_computer_partition_state('started') def test_stopped_new_ComputerPartition_raises(self): """ - Asserts that calling ComputerPartition.stopped on new partition raises + Asserts that calling ComputerPartition.stopped on new partition raises (not defined yet) exception """ self._test_new_computer_partition_state('stopped') @@ -489,7 +490,7 @@ class TestSoftwareRelease(SlapMixin): def _test_new_software_release_state(self, state): """ - Helper method to automate assertions of failing states on new Software + Helper method to automate assertions of failing states on new Software Release """ self.software_release_uri = 'http://server/' + self._getTestComputerId() @@ -502,14 +503,14 @@ class TestSoftwareRelease(SlapMixin): def test_available_new_SoftwareRelease_raises(self): """ - Asserts that calling SoftwareRelease.available on new software release + Asserts that calling SoftwareRelease.available on new software release raises (not defined yet) exception """ self._test_new_software_release_state('available') def test_building_new_SoftwareRelease_raises(self): """ - Asserts that calling SoftwareRelease.building on new software release + Asserts that calling SoftwareRelease.building on new software release raises (not defined yet) exception """ self._test_new_software_release_state('building') @@ -589,7 +590,6 @@ class TestOpenOrder(SlapMixin): self.assertTrue(requested_partition_id, computer_partition.getId()) if __name__ == '__main__': - print 'Testing against SLAP server %r' % SERVER_URL print 'You can point to any SLAP server by setting TEST_SLAP_SERVER_URL '\ 'environment variable' unittest.main()