Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
slapos slapos
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 122
    • Merge requests 122
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • slaposslapos
  • Merge requests
  • !152

Closed
Created Apr 06, 2017 by Boxiang Sun@DaetalusDeveloper
  • Report abuse
Report abuse

Fix the 'configuration._' not defined error when not provide '_' parameter.

  • Overview 0
  • Commits 1
  • Changes 2

There will be an error when we don't provide _ in webrunner. The instance-parameter:configuration is something like '''!py!{'full_address_list': [], '_': '{}'}'''

This commit process it by these steps:

  1. Remove the !py prefix by str[4:].
  2. Use double quotes replace single quotes within the str.
  3. Get the dict {'full_address_list': [], '_': '{}'}
  4. Get the value of the '_' key, in this case, it is a string "{}". Use json to convert it to a dict {}.

Notes:

  • Use eval or ast.literal_eval can do it in 1 or 2 steps. But it is unsafe and can not process json string which contains true, false, etc.
  • The test suite was passed in here with this commit: Daetalus/slapos@6e15fa38 . The commit includes in here contains some formatting.

Please let me know if there has trouble to hardcode the str[4:] or there has corner case that I didn't cover.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: jstestnode
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7