コード例 #1
0
 def validateImage(self, root, path):
     super(GoogleService, self).validateImage(root, path)
     validate.path_val(root, path + ['machineType'], 'string',
                       'n1-standard-1')
     validate.path_val(root, path + ['source'], 'string')
     validate.path_val(root, path + ['zone'], 'string')
     validate.obj_only(root, path,
                       {'cmds', 'machineType', 'source', 'zone'})
コード例 #2
0
 def validateImage(self, root, path):
     super(AmazonService, self).validateImage(root, path)
     validate.path_val(root, path + ['instanceType'], 'string',
                       'n1-standard-1')
     validate.path_val(root, path + ['sourceAmi'], 'string')
     validate.path_val(root, path + ['sshUser'], 'string')
     validate.obj_only(root, path,
                       {'cmds', 'instanceType', 'sourceAmi', 'sshUser'})
コード例 #3
0
ファイル: service_google.py プロジェクト: Bobcui001/jsonnet
    def validateEnvironment(self, root, path):
        fields = {'kind', 'project', 'region', 'sshUser', 'serviceAccount'}
        validate.obj_only(root, path, fields)
        validate.path_val(root, path + ['project'], 'string')
        validate.path_val(root, path + ['region'], 'string')
        validate.path_val(root, path + ['sshUser'], 'string')

        acc = validate.path_val(root, path + ['serviceAccount'], 'object')
        validate.path_val(root, path + ['serviceAccount', 'client_email'], 'string')
        validate.path_val(root, path + ['serviceAccount', 'private_key'], 'string')
        validate.path_val(root, path + ['serviceAccount', 'type'], validate.is_value('service_account'), 'service_account')
        validate.path_val(root, path + ['serviceAccount', 'client_id'], 'string', '')
        validate.path_val(root, path + ['serviceAccount', 'private_key_id'], 'string', '')
        fields = {'client_email', 'private_key', 'type', 'client_id', 'private_key_id'}
        validate.obj_only(root, path + ['serviceAccount'], fields)
コード例 #4
0
ファイル: service_google.py プロジェクト: xiangfu0/jsonnet
    def validateEnvironment(self, root, path):
        fields = {'kind', 'project', 'region', 'sshUser', 'serviceAccount'}
        validate.obj_only(root, path, fields)
        validate.path_val(root, path + ['project'], 'string')
        validate.path_val(root, path + ['region'], 'string')
        validate.path_val(root, path + ['sshUser'], 'string')

        acc = validate.path_val(root, path + ['serviceAccount'], 'object')
        validate.path_val(root, path + ['serviceAccount', 'client_email'], 'string')
        validate.path_val(root, path + ['serviceAccount', 'private_key'], 'string')
        validate.path_val(root, path + ['serviceAccount', 'type'], validate.is_value('service_account'), 'service_account')
        validate.path_val(root, path + ['serviceAccount', 'client_id'], 'string', '')
        validate.path_val(root, path + ['serviceAccount', 'private_key_id'], 'string', '')
        fields = {'client_email', 'private_key', 'type', 'client_id', 'private_key_id'}
        validate.obj_only(root, path + ['serviceAccount'], fields)
コード例 #5
0
ファイル: service_google.py プロジェクト: johnboiles/jsonnet
    def validateEnvironment(self, env_name, env):
        ctx = 'Environment "%s"' % env_name
        fields = ['kind', 'project', 'region', 'sshUser', 'serviceAccount']
        validate.obj_only(ctx, env, fields)
        validate.obj_field(ctx, env, 'project', 'string')
        validate.obj_field(ctx, env, 'region', 'string')
        validate.obj_field(ctx, env, 'sshUser', 'string')

        acc = validate.obj_field(ctx, env, 'serviceAccount', validate.is_type('object'))
        validate.obj_field(ctx + ' serviceAccount', acc, 'client_email', 'string')
        validate.obj_field(ctx + ' serviceAccount', acc, 'private_key', 'string')
        validate.obj_field_opt(ctx + ' serviceAccount', acc, 'type', validate.is_value('service_account'))
        validate.obj_field_opt(ctx + ' serviceAccount', acc, 'client_id', 'string')
        validate.obj_field_opt(ctx + ' serviceAccount', acc, 'private_key_id', 'string')
        fields = ['client_email', 'private_key', 'type', 'client_id', 'private_key_id']
        validate.obj_only(ctx + ' serviceAccount', acc, fields)
コード例 #6
0
ファイル: service.py プロジェクト: Bobcui001/jsonnet
 def validateCmds(self, root, path):
     cmds = validate.array(root, path, validate.is_any_type({'string', 'object'}), [])
     for i, cmd in enumerate(cmds):
         cmd_path = path + [i]
         if isinstance(cmd, basestring):
             # Any string will do for validation purposes.
             pass
         elif isinstance(cmd, dict):
             kinds = {'CopyFile', 'LiteralFile', 'EnsureDir'}
             kind = validate.path_val(root, cmd_path + ['kind'], validate.is_any_value(kinds))
             if kind == 'CopyFile':
                 fields = {'owner', 'group', 'dirPermissions', 'filePermissions', 'from', 'to'}
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             elif kind == 'LiteralFile':
                 fields = {'owner', 'group', 'filePermissions', 'content', 'to'}
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             elif cmd['kind'] == 'EnsureDir':
                 fields = {'owner', 'group', 'dirPermissions', 'dir'}
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             else:
                 raise RuntimeError('Internal error: %s' % kind)
         else:
             raise RuntimeError('Internal error: %s' % type(cmd))
コード例 #7
0
 def validateCmds(self, root, path):
     cmds = validate.array(root, path,
                           validate.is_any_type({'string', 'object'}), [])
     for i, cmd in enumerate(cmds):
         cmd_path = path + [i]
         if isinstance(cmd, basestring):
             # Any string will do for validation purposes.
             pass
         elif isinstance(cmd, dict):
             kinds = {'CopyFile', 'LiteralFile', 'EnsureDir'}
             kind = validate.path_val(root, cmd_path + ['kind'],
                                      validate.is_any_value(kinds))
             if kind == 'CopyFile':
                 fields = {
                     'owner', 'group', 'dirPermissions', 'filePermissions',
                     'from', 'to'
                 }
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             elif kind == 'LiteralFile':
                 fields = {
                     'owner', 'group', 'filePermissions', 'content', 'to'
                 }
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             elif cmd['kind'] == 'EnsureDir':
                 fields = {'owner', 'group', 'dirPermissions', 'dir'}
                 for f in fields:
                     validate.path_val(root, cmd_path + [f], 'string')
                 validate.obj_only(root, cmd_path, fields | {'kind'})
             else:
                 raise RuntimeError('Internal error: %s' % kind)
         else:
             raise RuntimeError('Internal error: %s' % type(cmd))
コード例 #8
0
 def validateEnvironment(self, root, path):
     fields = {'kind', 'accessKey', 'secretKey', 'region'}
     validate.obj_only(root, path, fields)
     validate.path_val(root, path + ['region'], 'string')
     validate.path_val(root, path + ['accessKey'], 'string')
     validate.path_val(root, path + ['secretKey'], 'string')
コード例 #9
0
 def validateEnvironment(self, root, path):
     fields = {'kind', 'accessKey', 'secretKey', 'region'}
     validate.obj_only(root, path, fields)
     validate.path_val(root, path + ['region'], 'string')
     validate.path_val(root, path + ['accessKey'], 'string')
     validate.path_val(root, path + ['secretKey'], 'string')
コード例 #10
0
 def validateImage(self, root, path):
     super(AmazonService, self).validateImage(root, path)
     validate.path_val(root, path + ['instanceType'], 'string', 'n1-standard-1')
     validate.path_val(root, path + ['sourceAmi'], 'string')
     validate.path_val(root, path + ['sshUser'], 'string')
     validate.obj_only(root, path, {'cmds', 'instanceType', 'sourceAmi', 'sshUser'})
コード例 #11
0
ファイル: service_google.py プロジェクト: Bobcui001/jsonnet
 def validateImage(self, root, path):
     super(GoogleService, self).validateImage(root, path)
     validate.path_val(root, path + ['machineType'], 'string', 'n1-standard-1')
     validate.path_val(root, path + ['source'], 'string')
     validate.path_val(root, path + ['zone'], 'string')
     validate.obj_only(root, path, {'cmds', 'machineType', 'source', 'zone'})