Sunday, 30 July 2017

Error: Hash Sum mismatch in GitLab

Recently, I have faced following error during instillation of Gitlab in Ubuntu.

odedra@odedra-Lenovo-Z50-70:~$ sudo apt-get install gitlab-ce
Reading package lists... Done
Building dependency tree      
Reading state information... Done
The following NEW packages will be installed:
  gitlab-ce
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 356 MB of archives.
After this operation, 1,102 MB of additional disk space will be used.
Fetched 356 MB in 15s (22.5 MB/s)
E: Failed to fetch https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/gitlab-ce_9.4.1-ce.0_amd64.deb  Hash Sum mismatch

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Solution:

wget -c https://packages.gitlab.com/gitlab/gitlab-ce/ubuntu/pool/trusty/main/g/gitlab-ce/gitlab-ce_9.4.1-ce.0_amd64.deb

dpkg -i gitlab-ce_9.4.1-ce.0_amd64.deb

Above commands will download package manually and install in system. For more manual package list as per your System requirements.

Few screen shots represent successful implementation of Community Edition.






Common Installation problems list and it's solution

How to install GitLab in Ubuntu ?

GitLab is a web-based Git repository manager with wiki and issue tracking features, using an open source license, developed by GitLab Inc.

It has three products.

    1. Community Edition,
    2. Enterprise Edition Starter and
    3. Enterprise Edition Premium.
  
*Community Edition*

1. Install and configure the necessary dependencies

    sudo apt-get install curl openssh-server ca-certificates postfix -y

2. Add the GitLab package server and install the package

    curl -sS https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.deb.sh | sudo bash
    sudo apt-get install gitlab-ce

3. Configure and start GitLab

    sudo gitlab-ctl reconfigure

4. Browse to the hostname and login

    On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.

    The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.


*Enterprise Edition*

1. Install and configure the necessary dependencies

    sudo apt-get install curl openssh-server ca-certificates postfix -y

2. Add the GitLab package server and install the package

    curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh | sudo bash
    sudo apt-get install gitlab-ee

3. Configure and start GitLab

    sudo gitlab-ctl reconfigure

4. Browse to the hostname and login

    On your first visit, you'll be redirected to a password reset screen to provide the password for the initial administrator account. Enter your desired password and you'll be redirected back to the login screen.

    The default account's username is root. Provide the password you created earlier and login. After login you can change the username if you wish.
  
Few screen shots represent successful implementation of Community Edition.








Source reference 

Monday, 27 February 2017

ValueError Expected singleton in Odoo


Expected Singleton:

Class methods required single invoking object (Single Browsable Record) to invoke the method and suppose it will call by multiple invoking objects (Browsable Recordsets) then method is not able to identify for which object it should process, therefore it will raise an error Expected Singleton.

New API decorator is used to define method calling pattern whether methods allows only single object or multiple objects to invoke this method.


For Example:


if self.location_id:     #face ValueError Expected singleton because self contains multiple recordset.
 
    ########

Need to change with following:

for warehouse in self:

    if warehouse.location_id:

        ########


@api.one

This decorator loops automatically on Records of RecordSet for you. Self is redefined as current record

Note:

Caution: the returned value is put in a list. This is not always supported by the web client, e.g. on button action
methods. In that case, you should use @api.multi to decorate your method, and probably call self.ensure_one() in
the method definition.

@api.multi

Self will be the current RecordSet without iteration. It is the default behavior (multiple browsable objects). Methods which returns non premitive type data(list, dictionary, function) must be decorated with @api.multi 

@api.model

This decorator will convert old API calls to decorated function to new API signature. It allows to be polite when
migrating code. Self does not contain any record/recordset in methods which are decorated by this decorator.

So simply call like this

self.env['model_name'].method_name(arguments)

Tuesday, 7 February 2017

ImportError: No module named packaging.version

Recently, I face ImportError: No module named packaging.version  and I would like to share knowledge to fix that problem.

Terminal:

pip --version
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)



I am trying to upgrade pip

python -m pip install -U pip

    Traceback (most recent call last):
      File "<string>", line 3, in <module>
      File "setuptools/__init__.py", line 12, in <module>
        import setuptools.version
      File "setuptools/version.py", line 1, in <module>
        import pkg_resources
      File "pkg_resources/__init__.py", line 70, in <module>
        import packaging.version
    ImportError: No module named packaging.version
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 3, in <module>

  File "setuptools/__init__.py", line 12, in <module>

    import setuptools.version

  File "setuptools/version.py", line 1, in <module>

    import pkg_resources

  File "pkg_resources/__init__.py", line 70, in <module>

    import packaging.version

ImportError: No module named packaging.version



Solution:

sudo su root

apt-get purge -y python-pip


wget https://bootstrap.pypa.io/get-pip.py


python ./get-pip.py


apt-get install python-pip



Error: Hash Sum mismatch in GitLab

Recently, I have faced following error during instillation of Gitlab in Ubuntu. odedra@odedra-Lenovo-Z50-70:~$ sudo apt-get install gitla...