Exemplo n.º 1
0
def main():
    fields = {
        "host": {
            "required": True,
            "type": "str"
        },
        "port": {
            "required": True,
            "type": "str"
        },
        "group_name": {
            "required": True,
            "type": "str"
        },
        "package_name": {
            "required": True,
            "type": "str"
        },
        "package_version": {
            "required": True,
            "type": "str"
        },
        "aem_username": {
            "required": True,
            "type": "str"
        },
        "aem_password": {
            "required": True,
            "type": "str",
            "no_log": True
        }
    }

    module = AnsibleModule(argument_spec=fields)

    host = module.params['host']
    port = module.params['port']
    group_name = module.params['group_name']
    package_name = module.params['package_name']
    package_version = module.params['package_version']

    aem_username = module.params['aem_username']
    aem_password = module.params['aem_password']

    try:
        aem = pyaem2.PyAem2(aem_username, aem_password, host, port)
        result = aem.is_package_uploaded(group_name, package_name,
                                         package_version)

        module.exit_json(failed=False,
                         changed=True,
                         meta=result.message,
                         uploaded='is not uploaded' not in result.message)

    except pyaem2.PyAem2Exception as err:
        module.fail_json(failed=True,
                         changed=False,
                         username=aem_username,
                         msg=str(err),
                         uploaded=False)
Exemplo n.º 2
0
def aemDeploy():
    print ("Deploying Release")
    PkgName=existingRelease()[0]
    PkgVersion=float(existingRelease()[1])
    pkgDownloadName=existingRelease()[2]
    aem=pyaem2.PyAem2('admin', 'admin', env[1], 4502)
    #Uploading
    os.system("curl -u admin:admin -F cmd=upload -F force=true -F package=@Download_Dir/"+str(pkgDownloadName)+" http://"+env[1]+":4502/crx/packmgr/service/.json")
    #installing
    os.system("curl -u admin:admin -X POST http://"+env[1]+":4502/crx/packmgr/service/.json/eProjectName/packages/groupName/"+str(pkgDownloadName)+"?cmd=install")
Exemplo n.º 3
0
    def test_init_ssl_debug(self):

        aem = pyaem2.PyAem2('someusername',
                            'somepassword',
                            'localhost',
                            4502,
                            use_ssl=True,
                            debug=True)
        self.assertTrue(hasattr(aem, 'content_repo'))
        self.assertTrue(hasattr(aem, 'package_manager'))
        self.assertTrue(hasattr(aem, 'package_manager_service_html'))
        self.assertTrue(hasattr(aem, 'package_manager_service_json'))
        self.assertTrue(hasattr(aem, 'package_manager_service_jsp'))
        self.assertTrue(hasattr(aem, 'web_console'))
Exemplo n.º 4
0
def aemUpdate():
    print ("Updating Local Release")
    aem=pyaem2.PyAem2('admin', 'admin', 'localhost', 4502)
    PkgName=existingRelease()[0]
    PkgVersion=float(existingRelease()[1])
    pkgDownloadName=existingRelease()[2]
    if(str('-'.join(re.split('-',PkgName)[:2:-1]))==str(date.today())):
        PkgVersion=round(PkgVersion+0.1,1)
        print (crxApiUpdate("http://localhost:4502/crx/packmgr/update.jsp?groupName=groupName&packageName=ProjectName-"+env[0]+"-Release-"+datetime.today().strftime('%d-%m-%Y')+"&version="+str(PkgVersion)+"&path=/eProjectName/packages/groupName/"+pkgDownloadName))
        aem.build_package('groupName', 'ProjectName-'+env[0]+'-Release-'+datetime.today().strftime('%d-%m-%Y'), str(PkgVersion))
        aem.download_package('groupName', 'ProjectName-'+env[0]+'-Release-'+datetime.today().strftime('%d-%m-%Y'), str(PkgVersion), 'Download dir')
    else:
        print (crxApiUpdate("http://localhost:4502/crx/packmgr/update.jsp?groupName=groupName&packageName=ProjectName-"+env[0]+"-Release-"+datetime.today().strftime('%d-%m-%Y')+"&version=1.0&path=/eProjectName/packages/groupName/"+pkgDownloadName))
        aem.build_package('groupName', 'ProjectName-'+env[0]+'-Release-'+datetime.today().strftime('%d-%m-%Y'), '1.0')
        aem.download_package('groupName', 'ProjectName-'+env[0]+'-Release-'+datetime.today().strftime('%d-%m-%Y'), "1.0", 'Download_Dir')
Exemplo n.º 5
0
def main():
    fields = {
        "host": {"required": True, "type": "str"},
        "port": {"required": True, "type": "str"},
        "user_or_group_name": {"required": True, "type": "str"},
        "path": {"required": True, "type": "str"},
        "permissions": {"required": True, "type": "str"},
        "aem_username": {"required": True, "type": "str"},
        "aem_password": {"required": True, "type": "str", "no_log": True}
    }

    module = AnsibleModule(argument_spec=fields)

    host = module.params['host']
    port = module.params['port']
    user_or_group_name = module.params['user_or_group_name']
    path = module.params['path']
    permissions = module.params['permissions']

    aem_username = module.params['aem_username']
    aem_password = module.params['aem_password']

    try:
        aem = pyaem2.PyAem2(aem_username, aem_password, host, port)

        result = aem.set_permission(user_or_group_name, path, permissions)

        module.exit_json(
            failed=False,
            changed='set on path' in result.message,
            msg=result.message
        )

    except pyaem2.PyAem2Exception as err:
        module.fail_json(
            failed=True,
            changed=False,
            host=host,
            port=port,
            username=aem_username,
            password=aem_password,
            msg=str(err),
            installed=False
        )
def main():
    fields = {
        "host": {"required": True, "type": "str"},
        "port": {"required": True, "type": "str"},
        "group_name": {"required": True, "type": "str"},
        "package_name": {"required": True, "type": "str"},
        "package_version": {"required": True, "type": "str"},
        "aem_username": {"required": True, "type": "str"},
        "aem_password": {"required": True, "type": "str", "no_log": True},
        "file_path": {"required": True, "type": "str"}
    }

    module = AnsibleModule(argument_spec=fields)

    host = module.params['host']
    port = module.params['port']
    group_name = module.params['group_name']
    package_name = module.params['package_name']
    package_version = module.params['package_version']
    file_path = module.params['file_path']

    aem_username = module.params['aem_username']
    aem_password = module.params['aem_password']

    try:
        aem = pyaem2.PyAem2(aem_username, aem_password, host, port)
        result = aem.upload_package_sync(group_name, package_name, package_version, file_path, force='true')

        module.exit_json(
            failed=False,
            changed=True,
            msg=result.message
        )

    except pyaem2.PyAem2Exception as err:
        module.fail_json(
            failed=True,
            changed=False,
            username=aem_username,
            msg=str(err)
        )
Exemplo n.º 7
0
__author__ = 'maxbarrass'

import os
import time
import json
import sys
import argparse

import pyaem2

aem = pyaem2.PyAem2('admin', 'admin', 'localhost', 4502)

try:

    path_name = "test"
    path_base = "/content/pytest/*"
    path_type = "nt:OrderedFolder"

    params = {
        ':nameHint': path_name,
        'jcr:primaryType': path_type,
        'jcr:mixinTypes': 'rep:AccessControllable'
    }

    try:
        result = aem.create_path(path_base, **params)

        if result.is_failure():
            print(json.dumps({'failed': True, 'msg': result.message}))
        else:
            print(json.dumps({'msg': result.message}))
Exemplo n.º 8
0
    def setUp(self):

        self.aem = pyaem2.PyAem2('someusername', 'somepassword', 'localhost',
                                 4502)