Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[training#1] add catalog ls task into node discovery graph #2

Open
wants to merge 1 commit into
base: sample_master
Choose a base branch
from

Conversation

iceiilin
Copy link
Owner

@iceiilin iceiilin commented Sep 4, 2017

Background

Training#1: Design a Linux catalog task which parse the ls -l /var and store the result into source ls.

Related PR:

iceiilin/on-taskgraph#2

Implementation:

add task definition and command parser for catalog ls task

Result:

After node discovery, a "ls" catalog source is shown as below:

onrack@lyne-env:~$ http :8080/api/2.0/nodes/59acfc42fb8955313565944b/catalogs/ls
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Connection: keep-alive
Content-Length: 2256
Content-Type: application/json; charset=utf-8
Date: Mon, 04 Sep 2017 07:14:58 GMT
ETag: W/"8d0-o2+9cR5kqs5430MBQB2PN97lCdY"
X-Powered-By: Express

{
    "createdAt": "2017-09-04T07:12:20.813Z",
    "data": [
        {
            "file_type": "directory",
            "group": "root",
            "link_count": "2",
            "modifiedtime": "Apr 10 2014",
            "name": "backups",
            "owner": "root",
            "permission": {
                "group": "r-x",
                "others": "r-x",
                "user": "rwx"
            },
            "size": "3"
        },
        {
            "file_type": "directory",
            "group": "root",
            "link_count": "1",
            "modifiedtime": "Sep 4 07:11",
            "name": "cache",
            "owner": "root",
            "permission": {
                "group": "r-x",
                "others": "r-x",
                "user": "rwx"
            },
            "size": "100"
        },
...
        {
            "file_type": "directory",
            "group": "root",
            "link_count": "2",
            "modifiedtime": "Jun 21 00:23",
            "name": "tmp",
            "owner": "root",
            "permission": {
                "group": "rwx",
                "others": "rwt",
                "user": "rwx"
            },
            "size": "3"
        }
    ],
    "id": "734f37ac-34bc-4b77-9d1e-35df396944a1",
    "node": "59acfc42fb8955313565944b",
    "source": "ls",
    "updatedAt": "2017-09-04T07:12:20.813Z"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant