krichot / arse

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Automated Reporting for System Engineers (A.R.S.E.)

Installation

Install Python

Check that you are running a Python on your machine. Open a terminal and execute:

python -V

Python 3.8.5

If you don't have Python on your machine install it by following the official documentation: https://www.python.org/downloads/

If you are running 2.X version of Python upgrade it.

NOTE: It might be, that you have python 3.X on your machine already installed, but it might be behind the python3 command. Try:

python3 -V

Python 3.8.5

If it works for you just use command python3 instead of python and continue with the setup.

Install pip

pip is package manager we will need to download and install a couple of third party libraries for Python in order for our script to work.

You can check if you have a pip installed:

python -m pip --version

pip 20.2.4 from /usr/local/lib/python3.8/site-packages/pip (python 3.8)

If you don't have pip installed run following:

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

Install selenium and pandas libraries

Check if you have pandas module installed:

pip list | grep pandas

pandas            1.1.4

If not run this command:

pip install pandas

Check if you have selenium module installed:

pip list | grep selenium

selenium          3.141.0

If not run this command:

pip install selenium

Check if you have xlrd module installed:

pip list | grep openpyxl

openpyxl          3.0.6

If not run this command:

pip install openpyxl

Install Firefox driver for selenium

Assuming you have Firefox on your computer the reporting script will need driver to control the browser.

Download the lastest driver here: https://github.com/mozilla/geckodriver/releases

Whereever you will save the Firefox driver you will need to reference it in you PATH variable. For example if the file is in /Users/mminarik/python directory I would need to add this line into my terminal configuration file (~/.bash_profile).

export PATH="/Users/mminarik/python:$PATH"

After that you will need to close and reopen your terminal window. You can verify you did it correctly by finding the path in the output of this command:

echo $PATH | tr ":" "\n"

/Users/mminarik/python
/usr/local/opt/libpq/bin
/usr/local/Cellar/python/3.6.5_1/Frameworks/Python.framework/Versions/3.6/bin
/usr/local/sbin
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/Applications/VMware Fusion.app/Contents/Public
/Library/Apple/usr/bin
/Library/Frameworks/Mono.framework/Versions/Current/Commands

And you should also see this:

geckodriver -V 

geckodriver 0.28.0 (c00d2b6acd3f 2020-11-03 16:29 +0200)

The source code of this program is available from
testing/geckodriver in https://hg.mozilla.org/mozilla-central.

This program is subject to the terms of the Mozilla Public License 2.0.
You can obtain a copy of the license at https://mozilla.org/MPL/2.0/.

Clone this repository

You will need multiple files in a single directory. The easiest way how to get this done is to clone this git repository. To do so run this command:

git clone https://github.com/michal-minarik/arse.git

If you don't have git installed on your machine follow the official docs to get it.

Getting started

Prepare input file

When you cloned the repository a sample file sample_input.xlsx was created for you. Rename/duplicate this file and name it input.xlsx, keep it in the same directory. Now you can input your activities into this file.

Follow the structure from the sample file and the input file structure

NOTE: Pre-populating this file with data from your calendar is not fully implemented. It's a roadmap item. :-)

Basic usage

You are all set to run the script. Navigate to the directory where you cloned the repository and execute:

python arse.py

The script will recap, what it will import into SFDC.

Tasks to be reported:

------------
                 date          activity      type       subject  hours related_object        related_to     status
0 2020-12-02 17:30:00  EMEA SE Activity  Workshop  TEST_ACCOUNT    0.5        Account                 *  Completed
1 2020-12-02 18:30:00  EMEA SE Activity  Workshop    TEST_OPPTY    0.5    Opportunity                 *  Completed
------------

Then it will autodetect your username and prompts for a password. This password is your domain password.

Your VMware username: ********
Password: 

That's it. Now the script will open a controlled Firefox browser and load all tasks. Once it's done you will see the message:

Reporting done

Customize localization

Because your SFDC might talk in different language you must set up your localization settings correctly in the config.json file. There are two main points where the automation typically fails.

Date format

When importing tasks you will see in the Firefox window error: Invalid Date.

To fix this issue, open the config.json file and change this line to match your SFDC date format:

"date_format": "%d.%m.%Y",

Decimal separator

When importing tasks you will see in the Firefox window error: Invalid Number.

To fix this issue, open the config.json file and change this line to match your SFDC numbering format:

"decimal_separator": ","

Input file structure

Fields for EMEA SE Activity

Following fields are mandatory and must be filled:

Field Decription Value
date Activity date Date
activity Internal or normal activity definition EMEA SE Activity
type Activity type EMEA SE Activity - type values
subject Activity subject Text
hours Worked hours Integer
related_object Related to SFDC type EMEA SE Activity - related_object values
related_to Related to SFDC resource Text (exact name of the SFDC resource e.g. opportunity name)
status Task status EMEA SE Activity - status values

EMEA SE Activity - type values

  • Account Management
  • App Domain Architecture
  • Beta Program / Mgmt
  • Customer Adopt
  • Customer Reference
  • Dell Technologies Play
  • Demo
  • DICE
  • DOMINO
  • Champions - SME program
  • Live Optics
  • Non VMware Marketing Event (Inc. VMUG)
  • Partner Management
  • Partner Presales Centre
  • PoC / PoV
  • Post Sales Support
  • PowerBlocks
  • Pre-Sales PSO / Scoping
  • Pre-Sales Support
  • Presentation
  • Projects
  • RFI / RFP / RFQ
  • Roadmap
  • Self Driving Ops
  • Trial
  • VBC
  • Virtual Customer Lab
  • VMware Marketing Events
  • Workshop

EMEA SE Activity - related_object values

  • Account
  • Opportunity

EMEA SE Activity - status values

  • Not Started
  • In Progress
  • Completed

Fields for SE Internal Activity

Following fields are mandatory and must be filled:

Field Decription Value
date Activity date Date
activity Internal or normal activity definition SE Internal Activity
type Activity type SE Internal Activity - type values
subject Activity subject Text
hours Worked hours Integer
status Task status SE Internal Activity - status values

SE Internal Activity - type values

  • Admin
  • Conferences
  • Demo
  • Champions - SME program
  • Internal Enablement
  • Internal Event Support
  • Management or Team Activities
  • Meetings
  • Paid Time Off, Holiday
  • POC
  • Recruiting
  • Service Learning
  • Training

SE Internal Activity - status values

  • Not Started
  • In Progress
  • Completed

Advanced parameters

If the script does not detect your username correctly (for example you are not running corporate image), you can force a username prompt:

python arse.py --prompt-username

About

License:GNU General Public License v3.0


Languages

Language:Python 74.8%Language:HTML 18.5%Language:Dockerfile 4.7%Language:JavaScript 1.3%Language:Shell 0.7%